linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.4.14-pre8: 'free' still reports bogus 'cached' value.
@ 2001-11-04 12:22 Patrick Mau
  2001-11-04 18:27 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Mau @ 2001-11-04 12:22 UTC (permalink / raw)
  To: Linux Kernel

Hi all,

I just compiled 2.4.14-pre8, did some bonnie++ runs
and compiled a few kernels to stress test this release.

Here's the output of 'free':

[root@tony] free
             total       used       free     shared    buffers     cached
Mem:        513336      82124     431212          0      30696 4294958092
-/+ buffers/cache:      60632     452704
Swap:       786416       4936     781480

cheers,
Patrick

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

* Re: 2.4.14-pre8: 'free' still reports bogus 'cached' value.
  2001-11-04 12:22 2.4.14-pre8: 'free' still reports bogus 'cached' value Patrick Mau
@ 2001-11-04 18:27 ` Andrew Morton
  2001-11-04 18:59   ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2001-11-04 18:27 UTC (permalink / raw)
  To: Patrick Mau; +Cc: Linux Kernel, Linus Torvalds

Patrick Mau wrote:
> 
> Hi all,
> 
> I just compiled 2.4.14-pre8, did some bonnie++ runs
> and compiled a few kernels to stress test this release.
> 
> Here's the output of 'free':
> 
> [root@tony] free
>              total       used       free     shared    buffers     cached
> Mem:        513336      82124     431212          0      30696 4294958092
> -/+ buffers/cache:      60632     452704
> Swap:       786416       4936     781480
> 

It's a bug in the /proc code.  If buffercache pages exceed
pagecache pages, `pg_size' flips negative.

There doesn't seem to be any reason to subtract buffermem_pages
from page_cache_size - they're independent.



--- linux-2.4.14-pre8/fs/proc/proc_misc.c	Tue Oct 23 23:09:42 2001
+++ linux-akpm/fs/proc/proc_misc.c	Sun Nov  4 10:10:18 2001
@@ -140,7 +140,7 @@ static int meminfo_read_proc(char *page,
 {
 	struct sysinfo i;
 	int len;
-	int pg_size ;
+	unsigned int cached;
 
 /*
  * display in kilobytes.
@@ -149,14 +149,14 @@ static int meminfo_read_proc(char *page,
 #define B(x) ((unsigned long long)(x) << PAGE_SHIFT)
 	si_meminfo(&i);
 	si_swapinfo(&i);
-	pg_size = atomic_read(&page_cache_size) - i.bufferram ;
+	cached = atomic_read(&page_cache_size);
 
 	len = sprintf(page, "        total:    used:    free:  shared: buffers:  cached:\n"
 		"Mem:  %8Lu %8Lu %8Lu %8Lu %8Lu %8Lu\n"
 		"Swap: %8Lu %8Lu %8Lu\n",
 		B(i.totalram), B(i.totalram-i.freeram), B(i.freeram),
 		B(i.sharedram), B(i.bufferram),
-		B(pg_size), B(i.totalswap),
+		B(cached), B(i.totalswap),
 		B(i.totalswap-i.freeswap), B(i.freeswap));
 	/*
 	 * Tagged format, for easy grepping and expansion.
@@ -182,7 +182,7 @@ static int meminfo_read_proc(char *page,
 		K(i.freeram),
 		K(i.sharedram),
 		K(i.bufferram),
-		K(pg_size - swapper_space.nrpages),
+		K(cached - swapper_space.nrpages),
 		K(swapper_space.nrpages),
 		K(nr_active_pages),
 		K(nr_inactive_pages),

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

* Re: 2.4.14-pre8: 'free' still reports bogus 'cached' value.
  2001-11-04 18:27 ` Andrew Morton
@ 2001-11-04 18:59   ` Andrew Morton
  2001-11-04 20:30     ` Patrick Mau
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2001-11-04 18:59 UTC (permalink / raw)
  To: Patrick Mau, Linux Kernel, Linus Torvalds

Andrew Morton wrote:
> 
> It's a bug in the /proc code.  If buffercache pages exceed
> pagecache pages, `pg_size' flips negative.
> 
> There doesn't seem to be any reason to subtract buffermem_pages
> from page_cache_size - they're independent.
> 

Well that was crap, wasn't it?  Wrong kernel.

I wonder if it's due to the fact that grow_dev_page()
calls find_or_create_page(), but we increment the
buffermem_pages count unconditionally, whether or
not the page was newly created?

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

* Re: 2.4.14-pre8: 'free' still reports bogus 'cached' value.
  2001-11-04 18:59   ` Andrew Morton
@ 2001-11-04 20:30     ` Patrick Mau
  0 siblings, 0 replies; 4+ messages in thread
From: Patrick Mau @ 2001-11-04 20:30 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

On Sun, Nov 04, 2001 at 10:59:21AM -0800, Andrew Morton wrote:
> Andrew Morton wrote:
> > 
> > It's a bug in the /proc code.  If buffercache pages exceed
> > pagecache pages, `pg_size' flips negative.
> > 
> > There doesn't seem to be any reason to subtract buffermem_pages
> > from page_cache_size - they're independent.
> > 
> 
> Well that was crap, wasn't it?  Wrong kernel.

Hallo Andrew,

I didn't even noticed, because I had no time to test ;o)

But thnks anyway. Maybe - for testing only - one could insert
a BUG() if the cached amount gets negative to get a call trace ?

My expirience in kernel hacking is rather limited.
I just wanted to report it anyway, because I thought it got fixed.

Have a nice Monday,
(at least I hope I will),

Patrick

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

end of thread, other threads:[~2001-11-04 20:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-04 12:22 2.4.14-pre8: 'free' still reports bogus 'cached' value Patrick Mau
2001-11-04 18:27 ` Andrew Morton
2001-11-04 18:59   ` Andrew Morton
2001-11-04 20:30     ` Patrick Mau

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