Skip to content

Commit

Permalink
x86: remove quicklists
Browse files Browse the repository at this point in the history
quicklists cause a serious memory leak on 32-bit x86,
as documented at:

  http://bugzilla.kernel.org/show_bug.cgi?id=9991

the reason is that the quicklist pool is a special-purpose
cache that grows out of proportion. It is not accounted for
anywhere and users have no way to even realize that it's
the quicklists that are causing RAM usage spikes. It was
supposed to be a relatively small pool, but as demonstrated
by KOSAKI Motohiro, they can grow as large as:

  Quicklists:    1194304 kB

given how much trouble this code has caused historically,
and given that Andrew objected to its introduction on x86
(years ago), the best option at this point is to remove them.

[ any performance benefits of caching constructed pgds should
  be implemented in a more generic way (possibly within the page
  allocator), while still allowing constructed pages to be
  allocated by other workloads. ]

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Mar 11, 2008
1 parent 40f0933 commit 985a34b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
3 changes: 0 additions & 3 deletions arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ config MMU
config ZONE_DMA
def_bool y

config QUICKLIST
def_bool X86_32

config SBUS
bool

Expand Down
18 changes: 9 additions & 9 deletions arch/x86/mm/pgtable_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,16 @@ static void pgd_mop_up_pmds(struct mm_struct *mm, pgd_t *pgdp)

pgd_t *pgd_alloc(struct mm_struct *mm)
{
pgd_t *pgd = quicklist_alloc(0, GFP_KERNEL, pgd_ctor);
pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);

mm->pgd = pgd; /* so that alloc_pd can use it */
/* so that alloc_pd can use it */
mm->pgd = pgd;
if (pgd)
pgd_ctor(pgd);

if (pgd && !pgd_prepopulate_pmd(mm, pgd)) {
quicklist_free(0, pgd_dtor, pgd);
pgd_dtor(pgd);
free_page((unsigned long)pgd);
pgd = NULL;
}

Expand All @@ -357,12 +361,8 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
void pgd_free(struct mm_struct *mm, pgd_t *pgd)
{
pgd_mop_up_pmds(mm, pgd);
quicklist_free(0, pgd_dtor, pgd);
}

void check_pgt_cache(void)
{
quicklist_trim(0, pgd_dtor, 25, 16);
pgd_dtor(pgd);
free_page((unsigned long)pgd);
}

void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte)
Expand Down
5 changes: 2 additions & 3 deletions include/asm-x86/pgtable_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ struct mm_struct;
struct vm_area_struct;

extern pgd_t swapper_pg_dir[1024];
extern struct kmem_cache *pmd_cache;
void check_pgt_cache(void);

static inline void pgtable_cache_init(void) {}
static inline void pgtable_cache_init(void) { }
static inline void check_pgt_cache(void) { }
void paging_init(void);


Expand Down

0 comments on commit 985a34b

Please sign in to comment.