tree 3efe584e1e31a8fe232bd5d305f2c64c9634ad91
parent 64e3abaf18ff17081e1c145df812f0204034146c
author Martin Hicks <[EMAIL PROTECTED]> Tue Apr 12 08:24:43 2005
committer Linus Torvalds <[EMAIL PROTECTED]> Tue Apr 12 08:24:43 2005
[PATCH] meminfo: add Cached underflow check
Working on some code lately I've been getting huge values for "Cached".
The cause is that get_page_cache_size() is an approximate value, and for a
sufficiently small returned value of get_page_cache_size() the value
underflows.
Signed-off-by: Martin Hicks <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
proc_misc.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletion(-)
Index: fs/proc/proc_misc.c
===================================================================
--- cae79a4e50228ee21be8c0443c751ffbbbc7991c/fs/proc/proc_misc.c (mode:100644
sha1:96b0d147e954207f4f79970a7867b5cfe7429397)
+++ 3efe584e1e31a8fe232bd5d305f2c64c9634ad91/fs/proc/proc_misc.c (mode:100644
sha1:89c0556c6077e13791acf96f722be53557464c2f)
@@ -126,6 +126,7 @@
unsigned long committed;
unsigned long allowed;
struct vmalloc_info vmi;
+ long cached;
get_page_state(&ps);
get_zone_counts(&active, &inactive, &free);
@@ -140,6 +141,10 @@
allowed = ((totalram_pages - hugetlb_total_pages())
* sysctl_overcommit_ratio / 100) + total_swap_pages;
+ cached = get_page_cache_size() - total_swapcache_pages - i.bufferram;
+ if (cached < 0)
+ cached = 0;
+
get_vmalloc_info(&vmi);
/*
@@ -172,7 +177,7 @@
K(i.totalram),
K(i.freeram),
K(i.bufferram),
- K(get_page_cache_size()-total_swapcache_pages-i.bufferram),
+ K(cached),
K(total_swapcache_pages),
K(active),
K(inactive),
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html