summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/include/asm/pgalloc.h2
-rw-r--r--arch/arc/include/asm/pgalloc.h1
-rw-r--r--arch/arm/include/asm/pgalloc.h2
-rw-r--r--arch/arm64/include/asm/pgalloc.h2
-rw-r--r--arch/csky/include/asm/pgalloc.h2
-rw-r--r--arch/hexagon/include/asm/pgalloc.h2
-rw-r--r--arch/ia64/Kconfig4
-rw-r--r--arch/ia64/include/asm/pgalloc.h32
-rw-r--r--arch/m68k/include/asm/pgtable_mm.h2
-rw-r--r--arch/m68k/include/asm/pgtable_no.h2
-rw-r--r--arch/microblaze/include/asm/pgalloc.h89
-rw-r--r--arch/microblaze/mm/pgtable.c4
-rw-r--r--arch/mips/include/asm/pgalloc.h2
-rw-r--r--arch/nds32/include/asm/pgalloc.h2
-rw-r--r--arch/nios2/include/asm/pgalloc.h2
-rw-r--r--arch/openrisc/include/asm/pgalloc.h2
-rw-r--r--arch/parisc/include/asm/pgalloc.h2
-rw-r--r--arch/powerpc/include/asm/pgalloc.h2
-rw-r--r--arch/riscv/include/asm/pgalloc.h4
-rw-r--r--arch/s390/include/asm/pgtable.h1
-rw-r--r--arch/sh/include/asm/pgalloc.h22
-rw-r--r--arch/sh/mm/Kconfig3
-rw-r--r--arch/sparc/include/asm/pgalloc_32.h2
-rw-r--r--arch/sparc/include/asm/pgalloc_64.h2
-rw-r--r--arch/sparc/mm/init_32.c1
-rw-r--r--arch/um/include/asm/pgalloc.h2
-rw-r--r--arch/unicore32/include/asm/pgalloc.h2
-rw-r--r--arch/x86/include/asm/pgtable_32.h1
-rw-r--r--arch/x86/include/asm/pgtable_64.h1
-rw-r--r--arch/xtensa/include/asm/tlbflush.h3
-rw-r--r--fs/proc/meminfo.c4
-rw-r--r--include/asm-generic/pgalloc.h5
-rw-r--r--include/linux/quicklist.h94
-rw-r--r--kernel/sched/idle.c1
-rw-r--r--lib/show_mem.c5
-rw-r--r--mm/Kconfig5
-rw-r--r--mm/Makefile1
-rw-r--r--mm/mmu_gather.c2
-rw-r--r--mm/quicklist.c103
39 files changed, 25 insertions, 395 deletions
diff --git a/arch/alpha/include/asm/pgalloc.h b/arch/alpha/include/asm/pgalloc.h
index 71ded3b7d82d..eb91f1e85629 100644
--- a/arch/alpha/include/asm/pgalloc.h
+++ b/arch/alpha/include/asm/pgalloc.h
@@ -53,6 +53,4 @@ pmd_free(struct mm_struct *mm, pmd_t *pmd)
53 free_page((unsigned long)pmd); 53 free_page((unsigned long)pmd);
54} 54}
55 55
56#define check_pgt_cache() do { } while (0)
57
58#endif /* _ALPHA_PGALLOC_H */ 56#endif /* _ALPHA_PGALLOC_H */
diff --git a/arch/arc/include/asm/pgalloc.h b/arch/arc/include/asm/pgalloc.h
index 9bdb8ed5b0db..4751f2251cd9 100644
--- a/arch/arc/include/asm/pgalloc.h
+++ b/arch/arc/include/asm/pgalloc.h
@@ -129,7 +129,6 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t ptep)
129 129
130#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte) 130#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte)
131 131
132#define check_pgt_cache() do { } while (0)
133#define pmd_pgtable(pmd) ((pgtable_t) pmd_page_vaddr(pmd)) 132#define pmd_pgtable(pmd) ((pgtable_t) pmd_page_vaddr(pmd))
134 133
135#endif /* _ASM_ARC_PGALLOC_H */ 134#endif /* _ASM_ARC_PGALLOC_H */
diff --git a/arch/arm/include/asm/pgalloc.h b/arch/arm/include/asm/pgalloc.h
index a2a68b751971..069da393110c 100644
--- a/arch/arm/include/asm/pgalloc.h
+++ b/arch/arm/include/asm/pgalloc.h
@@ -15,8 +15,6 @@
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17 17
18#define check_pgt_cache() do { } while (0)
19
20#ifdef CONFIG_MMU 18#ifdef CONFIG_MMU
21 19
22#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER)) 20#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER))
diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h
index 14d0bc44d451..172d76fa0245 100644
--- a/arch/arm64/include/asm/pgalloc.h
+++ b/arch/arm64/include/asm/pgalloc.h
@@ -15,8 +15,6 @@
15 15
16#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ 16#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */
17 17
18#define check_pgt_cache() do { } while (0)
19
20#define PGD_SIZE (PTRS_PER_PGD * sizeof(pgd_t)) 18#define PGD_SIZE (PTRS_PER_PGD * sizeof(pgd_t))
21 19
22#if CONFIG_PGTABLE_LEVELS > 2 20#if CONFIG_PGTABLE_LEVELS > 2
diff --git a/arch/csky/include/asm/pgalloc.h b/arch/csky/include/asm/pgalloc.h
index 98c5716708d6..d089113fe41f 100644
--- a/arch/csky/include/asm/pgalloc.h
+++ b/arch/csky/include/asm/pgalloc.h
@@ -75,8 +75,6 @@ do { \
75 tlb_remove_page(tlb, pte); \ 75 tlb_remove_page(tlb, pte); \
76} while (0) 76} while (0)
77 77
78#define check_pgt_cache() do {} while (0)
79
80extern void pagetable_init(void); 78extern void pagetable_init(void);
81extern void pre_mmu_init(void); 79extern void pre_mmu_init(void);
82extern void pre_trap_init(void); 80extern void pre_trap_init(void);
diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h
index d6544dc71258..5a6e79e7926d 100644
--- a/arch/hexagon/include/asm/pgalloc.h
+++ b/arch/hexagon/include/asm/pgalloc.h
@@ -13,8 +13,6 @@
13 13
14#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ 14#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */
15 15
16#define check_pgt_cache() do {} while (0)
17
18extern unsigned long long kmap_generation; 16extern unsigned long long kmap_generation;
19 17
20/* 18/*
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 685a3df126ca..16714477eef4 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -72,10 +72,6 @@ config 64BIT
72config ZONE_DMA32 72config ZONE_DMA32
73 def_bool y 73 def_bool y
74 74
75config QUICKLIST
76 bool
77 default y
78
79config MMU 75config MMU
80 bool 76 bool
81 default y 77 default y
diff --git a/arch/ia64/include/asm/pgalloc.h b/arch/ia64/include/asm/pgalloc.h
index c9e481023c25..b03d993f5d7e 100644
--- a/arch/ia64/include/asm/pgalloc.h
+++ b/arch/ia64/include/asm/pgalloc.h
@@ -19,18 +19,17 @@
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/page-flags.h> 20#include <linux/page-flags.h>
21#include <linux/threads.h> 21#include <linux/threads.h>
22#include <linux/quicklist.h>
23 22
24#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
25 24
26static inline pgd_t *pgd_alloc(struct mm_struct *mm) 25static inline pgd_t *pgd_alloc(struct mm_struct *mm)
27{ 26{
28 return quicklist_alloc(0, GFP_KERNEL, NULL); 27 return (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
29} 28}
30 29
31static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) 30static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
32{ 31{
33 quicklist_free(0, NULL, pgd); 32 free_page((unsigned long)pgd);
34} 33}
35 34
36#if CONFIG_PGTABLE_LEVELS == 4 35#if CONFIG_PGTABLE_LEVELS == 4
@@ -42,12 +41,12 @@ pgd_populate(struct mm_struct *mm, pgd_t * pgd_entry, pud_t * pud)
42 41
43static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) 42static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
44{ 43{
45 return quicklist_alloc(0, GFP_KERNEL, NULL); 44 return (pud_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
46} 45}
47 46
48static inline void pud_free(struct mm_struct *mm, pud_t *pud) 47static inline void pud_free(struct mm_struct *mm, pud_t *pud)
49{ 48{
50 quicklist_free(0, NULL, pud); 49 free_page((unsigned long)pud);
51} 50}
52#define __pud_free_tlb(tlb, pud, address) pud_free((tlb)->mm, pud) 51#define __pud_free_tlb(tlb, pud, address) pud_free((tlb)->mm, pud)
53#endif /* CONFIG_PGTABLE_LEVELS == 4 */ 52#endif /* CONFIG_PGTABLE_LEVELS == 4 */
@@ -60,12 +59,12 @@ pud_populate(struct mm_struct *mm, pud_t * pud_entry, pmd_t * pmd)
60 59
61static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) 60static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
62{ 61{
63 return quicklist_alloc(0, GFP_KERNEL, NULL); 62 return (pmd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
64} 63}
65 64
66static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) 65static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
67{ 66{
68 quicklist_free(0, NULL, pmd); 67 free_page((unsigned long)pmd);
69} 68}
70 69
71#define __pmd_free_tlb(tlb, pmd, address) pmd_free((tlb)->mm, pmd) 70#define __pmd_free_tlb(tlb, pmd, address) pmd_free((tlb)->mm, pmd)
@@ -86,14 +85,12 @@ pmd_populate_kernel(struct mm_struct *mm, pmd_t * pmd_entry, pte_t * pte)
86static inline pgtable_t pte_alloc_one(struct mm_struct *mm) 85static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
87{ 86{
88 struct page *page; 87 struct page *page;
89 void *pg;
90 88
91 pg = quicklist_alloc(0, GFP_KERNEL, NULL); 89 page = alloc_page(GFP_KERNEL | __GFP_ZERO);
92 if (!pg) 90 if (!page)
93 return NULL; 91 return NULL;
94 page = virt_to_page(pg);
95 if (!pgtable_page_ctor(page)) { 92 if (!pgtable_page_ctor(page)) {
96 quicklist_free(0, NULL, pg); 93 __free_page(page);
97 return NULL; 94 return NULL;
98 } 95 }
99 return page; 96 return page;
@@ -101,23 +98,18 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
101 98
102static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) 99static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
103{ 100{
104 return quicklist_alloc(0, GFP_KERNEL, NULL); 101 return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
105} 102}
106 103
107static inline void pte_free(struct mm_struct *mm, pgtable_t pte) 104static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
108{ 105{
109 pgtable_page_dtor(pte); 106 pgtable_page_dtor(pte);
110 quicklist_free_page(0, NULL, pte); 107 __free_page(pte);
111} 108}
112 109
113static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) 110static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
114{ 111{
115 quicklist_free(0, NULL, pte); 112 free_page((unsigned long)pte);
116}
117
118static inline void check_pgt_cache(void)
119{
120 quicklist_trim(0, NULL, 25, 16);
121} 113}
122 114
123#define __pte_free_tlb(tlb, pte, address) pte_free((tlb)->mm, pte) 115#define __pte_free_tlb(tlb, pte, address) pte_free((tlb)->mm, pte)
diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h
index fde4534b974f..cc476c1d72e5 100644
--- a/arch/m68k/include/asm/pgtable_mm.h
+++ b/arch/m68k/include/asm/pgtable_mm.h
@@ -181,6 +181,4 @@ pgprot_t pgprot_dmacoherent(pgprot_t prot);
181 */ 181 */
182#define pgtable_cache_init() do { } while (0) 182#define pgtable_cache_init() do { } while (0)
183 183
184#define check_pgt_cache() do { } while (0)
185
186#endif /* _M68K_PGTABLE_H */ 184#endif /* _M68K_PGTABLE_H */
diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h
index fc3a96c77bd8..69e271101223 100644
--- a/arch/m68k/include/asm/pgtable_no.h
+++ b/arch/m68k/include/asm/pgtable_no.h
@@ -60,6 +60,4 @@ extern void paging_init(void);
60 60
61#include <asm-generic/pgtable.h> 61#include <asm-generic/pgtable.h>
62 62
63#define check_pgt_cache() do { } while (0)
64
65#endif /* _M68KNOMMU_PGTABLE_H */ 63#endif /* _M68KNOMMU_PGTABLE_H */
diff --git a/arch/microblaze/include/asm/pgalloc.h b/arch/microblaze/include/asm/pgalloc.h
index f4cc9ffc449e..ac0731881751 100644
--- a/arch/microblaze/include/asm/pgalloc.h
+++ b/arch/microblaze/include/asm/pgalloc.h
@@ -21,83 +21,20 @@
21#include <asm/cache.h> 21#include <asm/cache.h>
22#include <asm/pgtable.h> 22#include <asm/pgtable.h>
23 23
24#define PGDIR_ORDER 0
25
26/*
27 * This is handled very differently on MicroBlaze since out page tables
28 * are all 0's and I want to be able to use these zero'd pages elsewhere
29 * as well - it gives us quite a speedup.
30 * -- Cort
31 */
32extern struct pgtable_cache_struct {
33 unsigned long *pgd_cache;
34 unsigned long *pte_cache;
35 unsigned long pgtable_cache_sz;
36} quicklists;
37
38#define pgd_quicklist (quicklists.pgd_cache)
39#define pmd_quicklist ((unsigned long *)0)
40#define pte_quicklist (quicklists.pte_cache)
41#define pgtable_cache_size (quicklists.pgtable_cache_sz)
42
43extern unsigned long *zero_cache; /* head linked list of pre-zero'd pages */
44extern atomic_t zero_sz; /* # currently pre-zero'd pages */
45extern atomic_t zeropage_hits; /* # zero'd pages request that we've done */
46extern atomic_t zeropage_calls; /* # zero'd pages request that've been made */
47extern atomic_t zerototal; /* # pages zero'd over time */
48
49#define zero_quicklist (zero_cache)
50#define zero_cache_sz (zero_sz)
51#define zero_cache_calls (zeropage_calls)
52#define zero_cache_hits (zeropage_hits)
53#define zero_cache_total (zerototal)
54
55/*
56 * return a pre-zero'd page from the list,
57 * return NULL if none available -- Cort
58 */
59extern unsigned long get_zero_page_fast(void);
60
61extern void __bad_pte(pmd_t *pmd); 24extern void __bad_pte(pmd_t *pmd);
62 25
63static inline pgd_t *get_pgd_slow(void) 26static inline pgd_t *get_pgd(void)
64{ 27{
65 pgd_t *ret; 28 return (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, 0);
66
67 ret = (pgd_t *)__get_free_pages(GFP_KERNEL, PGDIR_ORDER);
68 if (ret != NULL)
69 clear_page(ret);
70 return ret;
71} 29}
72 30
73static inline pgd_t *get_pgd_fast(void) 31static inline void free_pgd(pgd_t *pgd)
74{
75 unsigned long *ret;
76
77 ret = pgd_quicklist;
78 if (ret != NULL) {
79 pgd_quicklist = (unsigned long *)(*ret);
80 ret[0] = 0;
81 pgtable_cache_size--;
82 } else
83 ret = (unsigned long *)get_pgd_slow();
84 return (pgd_t *)ret;
85}
86
87static inline void free_pgd_fast(pgd_t *pgd)
88{
89 *(unsigned long **)pgd = pgd_quicklist;
90 pgd_quicklist = (unsigned long *) pgd;
91 pgtable_cache_size++;
92}
93
94static inline void free_pgd_slow(pgd_t *pgd)
95{ 32{
96 free_page((unsigned long)pgd); 33 free_page((unsigned long)pgd);
97} 34}
98 35
99#define pgd_free(mm, pgd) free_pgd_fast(pgd) 36#define pgd_free(mm, pgd) free_pgd(pgd)
100#define pgd_alloc(mm) get_pgd_fast() 37#define pgd_alloc(mm) get_pgd()
101 38
102#define pmd_pgtable(pmd) pmd_page(pmd) 39#define pmd_pgtable(pmd) pmd_page(pmd)
103 40
@@ -115,15 +52,14 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm)
115 struct page *ptepage; 52 struct page *ptepage;
116 53
117#ifdef CONFIG_HIGHPTE 54#ifdef CONFIG_HIGHPTE
118 int flags = GFP_KERNEL | __GFP_HIGHMEM; 55 int flags = GFP_KERNEL | __GFP_ZERO | __GFP_HIGHMEM;
119#else 56#else
120 int flags = GFP_KERNEL; 57 int flags = GFP_KERNEL | __GFP_ZERO;
121#endif 58#endif
122 59
123 ptepage = alloc_pages(flags, 0); 60 ptepage = alloc_pages(flags, 0);
124 if (!ptepage) 61 if (!ptepage)
125 return NULL; 62 return NULL;
126 clear_highpage(ptepage);
127 if (!pgtable_page_ctor(ptepage)) { 63 if (!pgtable_page_ctor(ptepage)) {
128 __free_page(ptepage); 64 __free_page(ptepage);
129 return NULL; 65 return NULL;
@@ -131,13 +67,6 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm)
131 return ptepage; 67 return ptepage;
132} 68}
133 69
134static inline void pte_free_fast(pte_t *pte)
135{
136 *(unsigned long **)pte = pte_quicklist;
137 pte_quicklist = (unsigned long *) pte;
138 pgtable_cache_size++;
139}
140
141static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) 70static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
142{ 71{
143 free_page((unsigned long)pte); 72 free_page((unsigned long)pte);
@@ -171,10 +100,6 @@ static inline void pte_free(struct mm_struct *mm, struct page *ptepage)
171#define __pmd_free_tlb(tlb, x, addr) pmd_free((tlb)->mm, x) 100#define __pmd_free_tlb(tlb, x, addr) pmd_free((tlb)->mm, x)
172#define pgd_populate(mm, pmd, pte) BUG() 101#define pgd_populate(mm, pmd, pte) BUG()
173 102
174extern int do_check_pgt_cache(int, int);
175
176#endif /* CONFIG_MMU */ 103#endif /* CONFIG_MMU */
177 104
178#define check_pgt_cache() do { } while (0)
179
180#endif /* _ASM_MICROBLAZE_PGALLOC_H */ 105#endif /* _ASM_MICROBLAZE_PGALLOC_H */
diff --git a/arch/microblaze/mm/pgtable.c b/arch/microblaze/mm/pgtable.c
index 8fe54fda31dc..010bb9cee2e4 100644
--- a/arch/microblaze/mm/pgtable.c
+++ b/arch/microblaze/mm/pgtable.c
@@ -44,10 +44,6 @@ unsigned long ioremap_base;
44unsigned long ioremap_bot; 44unsigned long ioremap_bot;
45EXPORT_SYMBOL(ioremap_bot); 45EXPORT_SYMBOL(ioremap_bot);
46 46
47#ifndef CONFIG_SMP
48struct pgtable_cache_struct quicklists;
49#endif
50
51static void __iomem *__ioremap(phys_addr_t addr, unsigned long size, 47static void __iomem *__ioremap(phys_addr_t addr, unsigned long size,
52 unsigned long flags) 48 unsigned long flags)
53{ 49{
diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index aa16b85ddffc..aa73cb187a07 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -105,8 +105,6 @@ static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
105 105
106#endif /* __PAGETABLE_PUD_FOLDED */ 106#endif /* __PAGETABLE_PUD_FOLDED */
107 107
108#define check_pgt_cache() do { } while (0)
109
110extern void pagetable_init(void); 108extern void pagetable_init(void);
111 109
112#endif /* _ASM_PGALLOC_H */ 110#endif /* _ASM_PGALLOC_H */
diff --git a/arch/nds32/include/asm/pgalloc.h b/arch/nds32/include/asm/pgalloc.h
index e78b43d8389f..37125e6884d7 100644
--- a/arch/nds32/include/asm/pgalloc.h
+++ b/arch/nds32/include/asm/pgalloc.h
@@ -23,8 +23,6 @@
23extern pgd_t *pgd_alloc(struct mm_struct *mm); 23extern pgd_t *pgd_alloc(struct mm_struct *mm);
24extern void pgd_free(struct mm_struct *mm, pgd_t * pgd); 24extern void pgd_free(struct mm_struct *mm, pgd_t * pgd);
25 25
26#define check_pgt_cache() do { } while (0)
27
28static inline pgtable_t pte_alloc_one(struct mm_struct *mm) 26static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
29{ 27{
30 pgtable_t pte; 28 pgtable_t pte;
diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h
index 4bc8cf72067e..750d18d5980b 100644
--- a/arch/nios2/include/asm/pgalloc.h
+++ b/arch/nios2/include/asm/pgalloc.h
@@ -45,6 +45,4 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
45 tlb_remove_page((tlb), (pte)); \ 45 tlb_remove_page((tlb), (pte)); \
46 } while (0) 46 } while (0)
47 47
48#define check_pgt_cache() do { } while (0)
49
50#endif /* _ASM_NIOS2_PGALLOC_H */ 48#endif /* _ASM_NIOS2_PGALLOC_H */
diff --git a/arch/openrisc/include/asm/pgalloc.h b/arch/openrisc/include/asm/pgalloc.h
index 3d4b397c2d06..787c1b9d2f6d 100644
--- a/arch/openrisc/include/asm/pgalloc.h
+++ b/arch/openrisc/include/asm/pgalloc.h
@@ -101,6 +101,4 @@ do { \
101 101
102#define pmd_pgtable(pmd) pmd_page(pmd) 102#define pmd_pgtable(pmd) pmd_page(pmd)
103 103
104#define check_pgt_cache() do { } while (0)
105
106#endif 104#endif
diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
index 4f2059a50fae..d98647c29b74 100644
--- a/arch/parisc/include/asm/pgalloc.h
+++ b/arch/parisc/include/asm/pgalloc.h
@@ -124,6 +124,4 @@ pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
124 pmd_populate_kernel(mm, pmd, page_address(pte_page)) 124 pmd_populate_kernel(mm, pmd, page_address(pte_page))
125#define pmd_pgtable(pmd) pmd_page(pmd) 125#define pmd_pgtable(pmd) pmd_page(pmd)
126 126
127#define check_pgt_cache() do { } while (0)
128
129#endif 127#endif
diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h
index 2b2c60a1a66d..6dd78a2dc03a 100644
--- a/arch/powerpc/include/asm/pgalloc.h
+++ b/arch/powerpc/include/asm/pgalloc.h
@@ -64,8 +64,6 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
64extern struct kmem_cache *pgtable_cache[]; 64extern struct kmem_cache *pgtable_cache[];
65#define PGT_CACHE(shift) pgtable_cache[shift] 65#define PGT_CACHE(shift) pgtable_cache[shift]
66 66
67static inline void check_pgt_cache(void) { }
68
69#ifdef CONFIG_PPC_BOOK3S 67#ifdef CONFIG_PPC_BOOK3S
70#include <asm/book3s/pgalloc.h> 68#include <asm/book3s/pgalloc.h>
71#else 69#else
diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h
index 56a67d66f72f..f66a00d8cb19 100644
--- a/arch/riscv/include/asm/pgalloc.h
+++ b/arch/riscv/include/asm/pgalloc.h
@@ -82,8 +82,4 @@ do { \
82 tlb_remove_page((tlb), pte); \ 82 tlb_remove_page((tlb), pte); \
83} while (0) 83} while (0)
84 84
85static inline void check_pgt_cache(void)
86{
87}
88
89#endif /* _ASM_RISCV_PGALLOC_H */ 85#endif /* _ASM_RISCV_PGALLOC_H */
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 0c4600725fc2..8f59454ac407 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -1686,7 +1686,6 @@ extern void s390_reset_cmma(struct mm_struct *mm);
1686 * No page table caches to initialise 1686 * No page table caches to initialise
1687 */ 1687 */
1688static inline void pgtable_cache_init(void) { } 1688static inline void pgtable_cache_init(void) { }
1689static inline void check_pgt_cache(void) { }
1690 1689
1691#include <asm-generic/pgtable.h> 1690#include <asm-generic/pgtable.h>
1692 1691
diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h
index b56f908b1395..9e15054858b4 100644
--- a/arch/sh/include/asm/pgalloc.h
+++ b/arch/sh/include/asm/pgalloc.h
@@ -2,11 +2,8 @@
2#ifndef __ASM_SH_PGALLOC_H 2#ifndef __ASM_SH_PGALLOC_H
3#define __ASM_SH_PGALLOC_H 3#define __ASM_SH_PGALLOC_H
4 4
5#include <linux/quicklist.h>
6#include <asm/page.h> 5#include <asm/page.h>
7 6
8#define QUICK_PT 0 /* Other page table pages that are zero on free */
9
10extern pgd_t *pgd_alloc(struct mm_struct *); 7extern pgd_t *pgd_alloc(struct mm_struct *);
11extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); 8extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
12 9
@@ -34,20 +31,18 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
34 */ 31 */
35static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) 32static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
36{ 33{
37 return quicklist_alloc(QUICK_PT, GFP_KERNEL, NULL); 34 return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
38} 35}
39 36
40static inline pgtable_t pte_alloc_one(struct mm_struct *mm) 37static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
41{ 38{
42 struct page *page; 39 struct page *page;
43 void *pg;
44 40
45 pg = quicklist_alloc(QUICK_PT, GFP_KERNEL, NULL); 41 page = alloc_page(GFP_KERNEL | __GFP_ZERO);
46 if (!pg) 42 if (!page)
47 return NULL; 43 return NULL;
48 page = virt_to_page(pg);
49 if (!pgtable_page_ctor(page)) { 44 if (!pgtable_page_ctor(page)) {
50 quicklist_free(QUICK_PT, NULL, pg); 45 __free_page(page);
51 return NULL; 46 return NULL;
52 } 47 }
53 return page; 48 return page;
@@ -55,13 +50,13 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
55 50
56static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) 51static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
57{ 52{
58 quicklist_free(QUICK_PT, NULL, pte); 53 free_page((unsigned long)pte);
59} 54}
60 55
61static inline void pte_free(struct mm_struct *mm, pgtable_t pte) 56static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
62{ 57{
63 pgtable_page_dtor(pte); 58 pgtable_page_dtor(pte);
64 quicklist_free_page(QUICK_PT, NULL, pte); 59 __free_page(pte);
65} 60}
66 61
67#define __pte_free_tlb(tlb,pte,addr) \ 62#define __pte_free_tlb(tlb,pte,addr) \
@@ -79,9 +74,4 @@ do { \
79} while (0); 74} while (0);
80#endif 75#endif
81 76
82static inline void check_pgt_cache(void)
83{
84 quicklist_trim(QUICK_PT, NULL, 25, 16);
85}
86
87#endif /* __ASM_SH_PGALLOC_H */ 77#endif /* __ASM_SH_PGALLOC_H */
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 02ed2df25a54..5c8a2ebfc720 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -1,9 +1,6 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2menu "Memory management options" 2menu "Memory management options"
3 3
4config QUICKLIST
5 def_bool y
6
7config MMU 4config MMU
8 bool "Support for memory management hardware" 5 bool "Support for memory management hardware"
9 depends on !CPU_SH2 6 depends on !CPU_SH2
diff --git a/arch/sparc/include/asm/pgalloc_32.h b/arch/sparc/include/asm/pgalloc_32.h
index 282be50a4adf..10538a4d1a1e 100644
--- a/arch/sparc/include/asm/pgalloc_32.h
+++ b/arch/sparc/include/asm/pgalloc_32.h
@@ -17,8 +17,6 @@ void srmmu_free_nocache(void *addr, int size);
17 17
18extern struct resource sparc_iomap; 18extern struct resource sparc_iomap;
19 19
20#define check_pgt_cache() do { } while (0)
21
22pgd_t *get_pgd_fast(void); 20pgd_t *get_pgd_fast(void);
23static inline void free_pgd_fast(pgd_t *pgd) 21static inline void free_pgd_fast(pgd_t *pgd)
24{ 22{
diff --git a/arch/sparc/include/asm/pgalloc_64.h b/arch/sparc/include/asm/pgalloc_64.h
index 48abccba4991..9d3e5cc95bbb 100644
--- a/arch/sparc/include/asm/pgalloc_64.h
+++ b/arch/sparc/include/asm/pgalloc_64.h
@@ -69,8 +69,6 @@ void pte_free(struct mm_struct *mm, pgtable_t ptepage);
69#define pmd_populate(MM, PMD, PTE) pmd_set(MM, PMD, PTE) 69#define pmd_populate(MM, PMD, PTE) pmd_set(MM, PMD, PTE)
70#define pmd_pgtable(PMD) ((pte_t *)__pmd_page(PMD)) 70#define pmd_pgtable(PMD) ((pte_t *)__pmd_page(PMD))
71 71
72#define check_pgt_cache() do { } while (0)
73
74void pgtable_free(void *table, bool is_page); 72void pgtable_free(void *table, bool is_page);
75 73
76#ifdef CONFIG_SMP 74#ifdef CONFIG_SMP
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index 046ab116cc8c..906eda1158b4 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -31,7 +31,6 @@
31#include <asm/page.h> 31#include <asm/page.h>
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33#include <asm/vaddrs.h> 33#include <asm/vaddrs.h>
34#include <asm/pgalloc.h> /* bug in asm-generic/tlb.h: check_pgt_cache */
35#include <asm/setup.h> 34#include <asm/setup.h>
36#include <asm/tlb.h> 35#include <asm/tlb.h>
37#include <asm/prom.h> 36#include <asm/prom.h>
diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h
index 023599c3fa51..446e0c0f4018 100644
--- a/arch/um/include/asm/pgalloc.h
+++ b/arch/um/include/asm/pgalloc.h
@@ -43,7 +43,5 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
43#define __pmd_free_tlb(tlb,x, address) tlb_remove_page((tlb),virt_to_page(x)) 43#define __pmd_free_tlb(tlb,x, address) tlb_remove_page((tlb),virt_to_page(x))
44#endif 44#endif
45 45
46#define check_pgt_cache() do { } while (0)
47
48#endif 46#endif
49 47
diff --git a/arch/unicore32/include/asm/pgalloc.h b/arch/unicore32/include/asm/pgalloc.h
index 3f0903bd98e9..ba1c9a79993b 100644
--- a/arch/unicore32/include/asm/pgalloc.h
+++ b/arch/unicore32/include/asm/pgalloc.h
@@ -18,8 +18,6 @@
18#define __HAVE_ARCH_PTE_ALLOC_ONE 18#define __HAVE_ARCH_PTE_ALLOC_ONE
19#include <asm-generic/pgalloc.h> 19#include <asm-generic/pgalloc.h>
20 20
21#define check_pgt_cache() do { } while (0)
22
23#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_PRESENT) 21#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_PRESENT)
24#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_PRESENT) 22#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_PRESENT)
25 23
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
index c78da8eda8f2..b9b9f8aa963e 100644
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -30,7 +30,6 @@ extern pgd_t initial_page_table[1024];
30extern pmd_t initial_pg_pmd[]; 30extern pmd_t initial_pg_pmd[];
31 31
32static inline void pgtable_cache_init(void) { } 32static inline void pgtable_cache_init(void) { }
33static inline void check_pgt_cache(void) { }
34void paging_init(void); 33void paging_init(void);
35void sync_initial_page_table(void); 34void sync_initial_page_table(void);
36 35
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index 4990d26dfc73..a26d2d58b9c9 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -242,7 +242,6 @@ extern void cleanup_highmap(void);
242#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN 242#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
243 243
244#define pgtable_cache_init() do { } while (0) 244#define pgtable_cache_init() do { } while (0)
245#define check_pgt_cache() do { } while (0)
246 245
247#define PAGE_AGP PAGE_KERNEL_NOCACHE 246#define PAGE_AGP PAGE_KERNEL_NOCACHE
248#define HAVE_PAGE_AGP 1 247#define HAVE_PAGE_AGP 1
diff --git a/arch/xtensa/include/asm/tlbflush.h b/arch/xtensa/include/asm/tlbflush.h
index 06875feb27c2..856e2da2e397 100644
--- a/arch/xtensa/include/asm/tlbflush.h
+++ b/arch/xtensa/include/asm/tlbflush.h
@@ -160,9 +160,6 @@ static inline void invalidate_dtlb_mapping (unsigned address)
160 invalidate_dtlb_entry(tlb_entry); 160 invalidate_dtlb_entry(tlb_entry);
161} 161}
162 162
163#define check_pgt_cache() do { } while (0)
164
165
166/* 163/*
167 * DO NOT USE THESE FUNCTIONS. These instructions aren't part of the Xtensa 164 * DO NOT USE THESE FUNCTIONS. These instructions aren't part of the Xtensa
168 * ISA and exist only for test purposes.. 165 * ISA and exist only for test purposes..
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 465ea0153b2a..4bd80e68eb03 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -8,7 +8,6 @@
8#include <linux/mmzone.h> 8#include <linux/mmzone.h>
9#include <linux/proc_fs.h> 9#include <linux/proc_fs.h>
10#include <linux/percpu.h> 10#include <linux/percpu.h>
11#include <linux/quicklist.h>
12#include <linux/seq_file.h> 11#include <linux/seq_file.h>
13#include <linux/swap.h> 12#include <linux/swap.h>
14#include <linux/vmstat.h> 13#include <linux/vmstat.h>
@@ -106,9 +105,6 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
106 global_zone_page_state(NR_KERNEL_STACK_KB)); 105 global_zone_page_state(NR_KERNEL_STACK_KB));
107 show_val_kb(m, "PageTables: ", 106 show_val_kb(m, "PageTables: ",
108 global_zone_page_state(NR_PAGETABLE)); 107 global_zone_page_state(NR_PAGETABLE));
109#ifdef CONFIG_QUICKLIST
110 show_val_kb(m, "Quicklists: ", quicklist_total_size());
111#endif
112 108
113 show_val_kb(m, "NFS_Unstable: ", 109 show_val_kb(m, "NFS_Unstable: ",
114 global_node_page_state(NR_UNSTABLE_NFS)); 110 global_node_page_state(NR_UNSTABLE_NFS));
diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h
index 8476175c07e7..6f8cc06ee44e 100644
--- a/include/asm-generic/pgalloc.h
+++ b/include/asm-generic/pgalloc.h
@@ -102,11 +102,6 @@ static inline void pte_free(struct mm_struct *mm, struct page *pte_page)
102 __free_page(pte_page); 102 __free_page(pte_page);
103} 103}
104 104
105#else /* CONFIG_MMU */
106
107/* This is enough for a nommu architecture */
108#define check_pgt_cache() do { } while (0)
109
110#endif /* CONFIG_MMU */ 105#endif /* CONFIG_MMU */
111 106
112#endif /* __ASM_GENERIC_PGALLOC_H */ 107#endif /* __ASM_GENERIC_PGALLOC_H */
diff --git a/include/linux/quicklist.h b/include/linux/quicklist.h
deleted file mode 100644
index 034982c98c8b..000000000000
--- a/include/linux/quicklist.h
+++ /dev/null
@@ -1,94 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef LINUX_QUICKLIST_H
3#define LINUX_QUICKLIST_H
4/*
5 * Fast allocations and disposal of pages. Pages must be in the condition
6 * as needed after allocation when they are freed. Per cpu lists of pages
7 * are kept that only contain node local pages.
8 *
9 * (C) 2007, SGI. Christoph Lameter <cl@linux.com>
10 */
11#include <linux/kernel.h>
12#include <linux/gfp.h>
13#include <linux/percpu.h>
14
15#ifdef CONFIG_QUICKLIST
16
17struct quicklist {
18 void *page;
19 int nr_pages;
20};
21
22DECLARE_PER_CPU(struct quicklist, quicklist)[CONFIG_NR_QUICK];
23
24/*
25 * The two key functions quicklist_alloc and quicklist_free are inline so
26 * that they may be custom compiled for the platform.
27 * Specifying a NULL ctor can remove constructor support. Specifying
28 * a constant quicklist allows the determination of the exact address
29 * in the per cpu area.
30 *
31 * The fast patch in quicklist_alloc touched only a per cpu cacheline and
32 * the first cacheline of the page itself. There is minmal overhead involved.
33 */
34static inline void *quicklist_alloc(int nr, gfp_t flags, void (*ctor)(void *))
35{
36 struct quicklist *q;
37 void **p = NULL;
38
39 q =&get_cpu_var(quicklist)[nr];
40 p = q->page;
41 if (likely(p)) {
42 q->page = p[0];
43 p[0] = NULL;
44 q->nr_pages--;
45 }
46 put_cpu_var(quicklist);
47 if (likely(p))
48 return p;
49
50 p = (void *)__get_free_page(flags | __GFP_ZERO);
51 if (ctor && p)
52 ctor(p);
53 return p;
54}
55
56static inline void __quicklist_free(int nr, void (*dtor)(void *), void *p,
57 struct page *page)
58{
59 struct quicklist *q;
60
61 q = &get_cpu_var(quicklist)[nr];
62 *(void **)p = q->page;
63 q->page = p;
64 q->nr_pages++;
65 put_cpu_var(quicklist);
66}
67
68static inline void quicklist_free(int nr, void (*dtor)(void *), void *pp)
69{
70 __quicklist_free(nr, dtor, pp, virt_to_page(pp));
71}
72
73static inline void quicklist_free_page(int nr, void (*dtor)(void *),
74 struct page *page)
75{
76 __quicklist_free(nr, dtor, page_address(page), page);
77}
78
79void quicklist_trim(int nr, void (*dtor)(void *),
80 unsigned long min_pages, unsigned long max_free);
81
82unsigned long quicklist_total_size(void);
83
84#else
85
86static inline unsigned long quicklist_total_size(void)
87{
88 return 0;
89}
90
91#endif
92
93#endif /* LINUX_QUICKLIST_H */
94
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index c892c6280c9f..8dad5aa600ea 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -238,7 +238,6 @@ static void do_idle(void)
238 tick_nohz_idle_enter(); 238 tick_nohz_idle_enter();
239 239
240 while (!need_resched()) { 240 while (!need_resched()) {
241 check_pgt_cache();
242 rmb(); 241 rmb();
243 242
244 local_irq_disable(); 243 local_irq_disable();
diff --git a/lib/show_mem.c b/lib/show_mem.c
index 5c86ef4c899f..1c26c14ffbb9 100644
--- a/lib/show_mem.c
+++ b/lib/show_mem.c
@@ -6,7 +6,6 @@
6 */ 6 */
7 7
8#include <linux/mm.h> 8#include <linux/mm.h>
9#include <linux/quicklist.h>
10#include <linux/cma.h> 9#include <linux/cma.h>
11 10
12void show_mem(unsigned int filter, nodemask_t *nodemask) 11void show_mem(unsigned int filter, nodemask_t *nodemask)
@@ -39,10 +38,6 @@ void show_mem(unsigned int filter, nodemask_t *nodemask)
39#ifdef CONFIG_CMA 38#ifdef CONFIG_CMA
40 printk("%lu pages cma reserved\n", totalcma_pages); 39 printk("%lu pages cma reserved\n", totalcma_pages);
41#endif 40#endif
42#ifdef CONFIG_QUICKLIST
43 printk("%lu pages in pagetable cache\n",
44 quicklist_total_size());
45#endif
46#ifdef CONFIG_MEMORY_FAILURE 41#ifdef CONFIG_MEMORY_FAILURE
47 printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages)); 42 printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
48#endif 43#endif
diff --git a/mm/Kconfig b/mm/Kconfig
index 2fe4902ad755..f88be1cbcfb2 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -273,11 +273,6 @@ config BOUNCE
273 by default when ZONE_DMA or HIGHMEM is selected, but you 273 by default when ZONE_DMA or HIGHMEM is selected, but you
274 may say n to override this. 274 may say n to override this.
275 275
276config NR_QUICK
277 int
278 depends on QUICKLIST
279 default "1"
280
281config VIRT_TO_BUS 276config VIRT_TO_BUS
282 bool 277 bool
283 help 278 help
diff --git a/mm/Makefile b/mm/Makefile
index d0b295c3b764..d11de59e9c3c 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -72,7 +72,6 @@ obj-$(CONFIG_FAILSLAB) += failslab.o
72obj-$(CONFIG_MEMORY_HOTPLUG) += memory_hotplug.o 72obj-$(CONFIG_MEMORY_HOTPLUG) += memory_hotplug.o
73obj-$(CONFIG_MEMTEST) += memtest.o 73obj-$(CONFIG_MEMTEST) += memtest.o
74obj-$(CONFIG_MIGRATION) += migrate.o 74obj-$(CONFIG_MIGRATION) += migrate.o
75obj-$(CONFIG_QUICKLIST) += quicklist.o
76obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += huge_memory.o khugepaged.o 75obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += huge_memory.o khugepaged.o
77obj-$(CONFIG_PAGE_COUNTER) += page_counter.o 76obj-$(CONFIG_PAGE_COUNTER) += page_counter.o
78obj-$(CONFIG_MEMCG) += memcontrol.o vmpressure.o 77obj-$(CONFIG_MEMCG) += memcontrol.o vmpressure.o
diff --git a/mm/mmu_gather.c b/mm/mmu_gather.c
index 8c943a6e1696..7d70e5c78f97 100644
--- a/mm/mmu_gather.c
+++ b/mm/mmu_gather.c
@@ -271,8 +271,6 @@ void tlb_finish_mmu(struct mmu_gather *tlb,
271 271
272 tlb_flush_mmu(tlb); 272 tlb_flush_mmu(tlb);
273 273
274 /* keep the page table cache within bounds */
275 check_pgt_cache();
276#ifndef CONFIG_HAVE_MMU_GATHER_NO_GATHER 274#ifndef CONFIG_HAVE_MMU_GATHER_NO_GATHER
277 tlb_batch_list_free(tlb); 275 tlb_batch_list_free(tlb);
278#endif 276#endif
diff --git a/mm/quicklist.c b/mm/quicklist.c
deleted file mode 100644
index 5e98ac78e410..000000000000
--- a/mm/quicklist.c
+++ /dev/null
@@ -1,103 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Quicklist support.
4 *
5 * Quicklists are light weight lists of pages that have a defined state
6 * on alloc and free. Pages must be in the quicklist specific defined state
7 * (zero by default) when the page is freed. It seems that the initial idea
8 * for such lists first came from Dave Miller and then various other people
9 * improved on it.
10 *
11 * Copyright (C) 2007 SGI,
12 * Christoph Lameter <cl@linux.com>
13 * Generalized, added support for multiple lists and
14 * constructors / destructors.
15 */
16#include <linux/kernel.h>
17
18#include <linux/gfp.h>
19#include <linux/mm.h>
20#include <linux/mmzone.h>
21#include <linux/quicklist.h>
22
23DEFINE_PER_CPU(struct quicklist [CONFIG_NR_QUICK], quicklist);
24
25#define FRACTION_OF_NODE_MEM 16
26
27static unsigned long max_pages(unsigned long min_pages)
28{
29 unsigned long node_free_pages, max;
30 int node = numa_node_id();
31 struct zone *zones = NODE_DATA(node)->node_zones;
32 int num_cpus_on_node;
33
34 node_free_pages =
35#ifdef CONFIG_ZONE_DMA
36 zone_page_state(&zones[ZONE_DMA], NR_FREE_PAGES) +
37#endif
38#ifdef CONFIG_ZONE_DMA32
39 zone_page_state(&zones[ZONE_DMA32], NR_FREE_PAGES) +
40#endif
41 zone_page_state(&zones[ZONE_NORMAL], NR_FREE_PAGES);
42
43 max = node_free_pages / FRACTION_OF_NODE_MEM;
44
45 num_cpus_on_node = cpumask_weight(cpumask_of_node(node));
46 max /= num_cpus_on_node;
47
48 return max(max, min_pages);
49}
50
51static long min_pages_to_free(struct quicklist *q,
52 unsigned long min_pages, long max_free)
53{
54 long pages_to_free;
55
56 pages_to_free = q->nr_pages - max_pages(min_pages);
57
58 return min(pages_to_free, max_free);
59}
60
61/*
62 * Trim down the number of pages in the quicklist
63 */
64void quicklist_trim(int nr, void (*dtor)(void *),
65 unsigned long min_pages, unsigned long max_free)
66{
67 long pages_to_free;
68 struct quicklist *q;
69
70 q = &get_cpu_var(quicklist)[nr];
71 if (q->nr_pages > min_pages) {
72 pages_to_free = min_pages_to_free(q, min_pages, max_free);
73
74 while (pages_to_free > 0) {
75 /*
76 * We pass a gfp_t of 0 to quicklist_alloc here
77 * because we will never call into the page allocator.
78 */
79 void *p = quicklist_alloc(nr, 0, NULL);
80
81 if (dtor)
82 dtor(p);
83 free_page((unsigned long)p);
84 pages_to_free--;
85 }
86 }
87 put_cpu_var(quicklist);
88}
89
90unsigned long quicklist_total_size(void)
91{
92 unsigned long count = 0;
93 int cpu;
94 struct quicklist *ql, *q;
95
96 for_each_online_cpu(cpu) {
97 ql = per_cpu(quicklist, cpu);
98 for (q = ql; q < ql + CONFIG_NR_QUICK; q++)
99 count += q->nr_pages;
100 }
101 return count;
102}
103