linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* quicklists confuse meminfo
@ 2008-03-09 10:19 Thomas Gleixner
  2008-03-09 10:26 ` Bart Van Assche
                   ` (3 more replies)
  0 siblings, 4 replies; 44+ messages in thread
From: Thomas Gleixner @ 2008-03-09 10:19 UTC (permalink / raw)
  To: LKML
  Cc: Linus Torvalds, Andrew Morton, Ingo Molnar, Christoph Lameter,
	Bart Van Assche

Bart reported http://bugzilla.kernel.org/show_bug.cgi?id=9991. He
assumed a memory leak in 32bit kernels when he analyzed the output of
/proc/meminfo.

The leak is not a leak, it's an accounting bug. quicklists keep a
large amount of pages which are accounted as used memory.

It can be easily observed by watching /proc/meminfo on an idle system
and then run

# while true; do ls >/dev/null; done

for a while. The amount of free memory decreases steadily to the
point, where the quicklist limit kicks in.

To verify this I added quicklists (patch below) to the /proc/meminfo
output and the decrease of free memory is matching the increase of the
memory which is kept in quicklists.

I'm not sure how we should handle the quicklist accounting, but the
current state of silently hiding the free memory in the quicklists is
definitely not acceptable.

Another strange observation about quicklists is the imbalance of the
quicklists across CPUs. Running the above loop on a 2way machine I can
observe that the quicklist pages are acuumulating on one CPU. Stopping
and restarting the loop a couple of times can shift the accumulation
from one to the other CPU.

Thanks,
	tglx

---
 fs/proc/proc_misc.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Index: linux-2.6/fs/proc/proc_misc.c
===================================================================
--- linux-2.6.orig/fs/proc/proc_misc.c
+++ linux-2.6/fs/proc/proc_misc.c
@@ -49,6 +49,8 @@
 #include <linux/crash_dump.h>
 #include <linux/pid_namespace.h>
 #include <linux/bootmem.h>
+#include <linux/quicklist.h>
+
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
@@ -183,8 +185,11 @@ static int meminfo_read_proc(char *page,
 		"Committed_AS: %8lu kB\n"
 		"VmallocTotal: %8lu kB\n"
 		"VmallocUsed:  %8lu kB\n"
-		"VmallocChunk: %8lu kB\n",
-		K(i.totalram),
+		"VmallocChunk: %8lu kB\n"
+#ifdef CONFIG_QUICKLIST
+		"QuickLists:   %8lu kB\n"
+#endif
+		,K(i.totalram),
 		K(i.freeram),
 		K(i.bufferram),
 		K(cached),
@@ -215,6 +220,9 @@ static int meminfo_read_proc(char *page,
 		(unsigned long)VMALLOC_TOTAL >> 10,
 		vmi.used >> 10,
 		vmi.largest_chunk >> 10
+#ifdef CONFIG_QUICKLIST
+		,K(quicklist_total_size())
+#endif
 		);
 
 		len += hugetlb_report_meminfo(page + len);


^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2008-03-27  9:49 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-09 10:19 quicklists confuse meminfo 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
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

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).