LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Bart Van Assche <bart.vanassche@gmail.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
	Christoph Lameter <clameter@sgi.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: quicklists confuse meminfo
Date: Wed, 26 Mar 2008 09:13:49 +0100	[thread overview]
Message-ID: <20080326081349.GA8159@elte.hu> (raw)
In-Reply-To: <e2e108260803260045q37792686l80ddb421f2e67c6f@mail.gmail.com>


* Bart Van Assche <bart.vanassche@gmail.com> wrote:

> On Fri, Mar 21, 2008 at 3:45 PM, Ingo Molnar <mingo@elte.hu> wrote:
> >
> >  * Bart Van Assche <bart.vanassche@gmail.com> wrote:
> >
> >  > Is anyone currently working on this
> >  > (http://bugzilla.kernel.org/show_bug.cgi?id=9991) ? I think this
> >  > should either be fixed or documented as a known issue.
> >
> >  it should be fixed in latest -git (by commit 985a34bd75cc8c9) - can you
> >  still see it?
> 
> This issue is indeed fixed now, thanks (retested with kernel version 
> 2.6.25-rc6-00333-ga4083c9-dirty). Where can I find the patch that 
> fixed this issue ? A Google query for the commit ID returned only one 
> result, and that was an URL that pointed to your e-mail.

thanks a lot Bart for the persistent testing - this was a nasty one to 
track down. Find the standalone fix below.

	Ingo

---------------->
commit 985a34bd75cc8c96e43f00dcdda7c3fdb51a3026
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Sun Mar 9 13:14:37 2008 +0100

    x86: remove quicklists
    
    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>

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f41c953..237fc12 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -66,9 +66,6 @@ config MMU
 config ZONE_DMA
 	def_bool y
 
-config QUICKLIST
-	def_bool X86_32
-
 config SBUS
 	bool
 
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index 73aba71..2f9e9af 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -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;
 	}
 
@@ -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)
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index a842c72..4e6a0fc 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -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);
 
 

  parent reply	other threads:[~2008-03-26  8:14 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-09 10:19 Thomas Gleixner
2008-03-09 10:26 ` Bart Van Assche
2008-03-09 10:29 ` Andi Kleen
2008-03-09 10:42 ` KOSAKI Motohiro
2008-03-09 12:00   ` Thomas Gleixner
2008-03-09 11:14 ` Ingo Molnar
2008-03-09 11:56   ` Thomas Gleixner
2008-03-09 12:01     ` Ingo Molnar
2008-03-09 12:49       ` Andi Kleen
2008-03-10 15:51         ` Christoph Lameter
2008-03-09 12:03   ` Johannes Weiner
2008-03-09 12:03   ` KOSAKI Motohiro
2008-03-09 12:09     ` Ingo Molnar
2008-03-09 12:34       ` Ingo Molnar
2008-03-09 12:51         ` KOSAKI Motohiro
2008-03-09 13:20         ` Thomas Gleixner
2008-03-09 18:46         ` Andrew Morton
2008-03-09 20:21           ` Andi Kleen
2008-03-10 15:54           ` Christoph Lameter
2008-03-10 16:43             ` Andi Kleen
2008-03-10 17:19               ` Hugh Dickins
2008-03-10 17:25                 ` Andi Kleen
2008-03-10 17:31                 ` Jeremy Fitzhardinge
2008-03-10 17:53                   ` Andi Kleen
2008-03-10 18:35                     ` Jeremy Fitzhardinge
2008-03-10 19:06                       ` Andi Kleen
2008-03-10 20:54                       ` H. Peter Anvin
2008-03-10 21:26                         ` Jeremy Fitzhardinge
2008-03-11  4:07             ` Nick Piggin
2008-03-21 12:52               ` Bart Van Assche
2008-03-21 14:45                 ` Ingo Molnar
2008-03-26  7:45                   ` Bart Van Assche
2008-03-26  7:53                     ` Andrew Morton
2008-03-26  8:13                     ` Ingo Molnar [this message]
2008-03-26 10:37                       ` Bart Van Assche
2008-03-26 16:34                         ` Christoph Lameter
2008-03-27  9:48                           ` Bart Van Assche
2008-03-09 19:11         ` Arjan van de Ven
2008-03-09 19:25           ` Ingo Molnar
2008-03-09 19:27             ` Ingo Molnar
2008-03-09 19:31               ` Ingo Molnar
2008-03-10 15:57               ` Christoph Lameter
2008-03-10 15:55             ` Christoph Lameter
2008-03-09 12:47       ` KOSAKI Motohiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080326081349.GA8159@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=bart.vanassche@gmail.com \
    --cc=clameter@sgi.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --subject='Re: quicklists confuse meminfo' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).