Skip to content

Commit 4dedbf8

Browse files
davem330torvalds
authored andcommitted
sparc64: kill page table quicklists
With the recent mmu_gather changes that included generic RCU freeing of page-tables, it is now quite straightforward to implement gup_fast() on sparc64. This patch: Remove the page table quicklists. They are pointless and make it harder to use RCU page table freeing and share code with other architectures. BTW, this is the second time this has happened, see commit 3c93646 ("[SPARC64]: Kill pgtable quicklists and use SLAB.") Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c15bef3 commit 4dedbf8

3 files changed

Lines changed: 26 additions & 21 deletions

File tree

‎arch/sparc/Kconfig‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ config IOMMU_HELPER
8181
bool
8282
default y if SPARC64
8383

84-
config QUICKLIST
85-
bool
86-
default y if SPARC64
87-
8884
config STACKTRACE_SUPPORT
8985
bool
9086
default y if SPARC64

‎arch/sparc/include/asm/pgalloc_64.h‎

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <linux/sched.h>
66
#include <linux/mm.h>
77
#include <linux/slab.h>
8-
#include <linux/quicklist.h>
98

109
#include <asm/spitfire.h>
1110
#include <asm/cpudata.h>
@@ -14,69 +13,68 @@
1413

1514
/* Page table allocation/freeing. */
1615

16+
extern struct kmem_cache *pgtable_cache;
17+
1718
static inline pgd_t *pgd_alloc(struct mm_struct *mm)
1819
{
19-
return quicklist_alloc(0, GFP_KERNEL, NULL);
20+
return kmem_cache_alloc(pgtable_cache, GFP_KERNEL);
2021
}
2122

2223
static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
2324
{
24-
quicklist_free(0, NULL, pgd);
25+
kmem_cache_free(pgtable_cache, pgd);
2526
}
2627

2728
#define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD)
2829

2930
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
3031
{
31-
return quicklist_alloc(0, GFP_KERNEL, NULL);
32+
return kmem_cache_alloc(pgtable_cache,
33+
GFP_KERNEL|__GFP_REPEAT);
3234
}
3335

3436
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
3537
{
36-
quicklist_free(0, NULL, pmd);
38+
kmem_cache_free(pgtable_cache, pmd);
3739
}
3840

3941
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
4042
unsigned long address)
4143
{
42-
return quicklist_alloc(0, GFP_KERNEL, NULL);
44+
return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
4345
}
4446

4547
static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
4648
unsigned long address)
4749
{
4850
struct page *page;
49-
void *pg;
51+
pte_t *pte;
5052

51-
pg = quicklist_alloc(0, GFP_KERNEL, NULL);
52-
if (!pg)
53+
pte = pte_alloc_one_kernel(mm, address);
54+
if (!pte)
5355
return NULL;
54-
page = virt_to_page(pg);
56+
page = virt_to_page(pte);
5557
pgtable_page_ctor(page);
5658
return page;
5759
}
5860

5961
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
6062
{
61-
quicklist_free(0, NULL, pte);
63+
free_page((unsigned long)pte);
6264
}
6365

6466
static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
6567
{
6668
pgtable_page_dtor(ptepage);
67-
quicklist_free_page(0, NULL, ptepage);
69+
__free_page(ptepage);
6870
}
6971

70-
7172
#define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
7273
#define pmd_populate(MM,PMD,PTE_PAGE) \
7374
pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE))
7475
#define pmd_pgtable(pmd) pmd_page(pmd)
7576

76-
static inline void check_pgt_cache(void)
77-
{
78-
quicklist_trim(0, NULL, 25, 16);
79-
}
77+
#define check_pgt_cache() do { } while (0)
8078

8179
#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte)
8280
#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd)

‎arch/sparc/mm/tsb.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ static void setup_tsb_params(struct mm_struct *mm, unsigned long tsb_idx, unsign
236236
}
237237
}
238238

239+
struct kmem_cache *pgtable_cache __read_mostly;
240+
239241
static struct kmem_cache *tsb_caches[8] __read_mostly;
240242

241243
static const char *tsb_cache_names[8] = {
@@ -253,6 +255,15 @@ void __init pgtable_cache_init(void)
253255
{
254256
unsigned long i;
255257

258+
pgtable_cache = kmem_cache_create("pgtable_cache",
259+
PAGE_SIZE, PAGE_SIZE,
260+
0,
261+
_clear_page);
262+
if (!pgtable_cache) {
263+
prom_printf("pgtable_cache_init(): Could not create!\n");
264+
prom_halt();
265+
}
266+
256267
for (i = 0; i < 8; i++) {
257268
unsigned long size = 8192 << i;
258269
const char *name = tsb_cache_names[i];

0 commit comments

Comments
 (0)