tree 98c85314a6c8d753e27163e729a0dbc493018ce1
parent 76c3073a888ae7f4790a146784bb5c34fc24b9d2
author Martin Hicks <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:24:08 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:24:08 -0700
[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/proc_misc.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletion(-)
Index: fs/proc/proc_misc.c
===================================================================
--- 553ce5e651b26fae65a2a35e95570c88e2eab46d/fs/proc/proc_misc.c (mode:100644
sha1:1d75d6ab6897df73168ecdf4baab53bedbef6709)
+++ 98c85314a6c8d753e27163e729a0dbc493018ce1/fs/proc/proc_misc.c (mode:100644
sha1:a60a3b3d8a7b1c31870dee3d947fe119a5787a5d)
@@ -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