[PATCH/RFT 5/5] CLOCK-Pro page replacement

From: Rik van Riel
Date: Wed Aug 10 2005 - 15:11:10 EST


Export the active limit statistic through /proc. We may want to
export some more CLOCK-Pro statistics in the future, but I'm not
sure yet which ones.

Signed-off-by: Rik van Riel

Index: linux-2.6.12-vm/fs/proc/proc_misc.c
===================================================================
--- linux-2.6.12-vm.orig/fs/proc/proc_misc.c
+++ linux-2.6.12-vm/fs/proc/proc_misc.c
@@ -125,11 +125,13 @@ static int meminfo_read_proc(char *page,
unsigned long free;
unsigned long committed;
unsigned long allowed;
+ unsigned long active_limit;
struct vmalloc_info vmi;
long cached;

get_page_state(&ps);
get_zone_counts(&active, &inactive, &free);
+ active_limit = get_active_limit();

/*
* display in kilobytes.
@@ -158,6 +160,7 @@ static int meminfo_read_proc(char *page,
"SwapCached: %8lu kB\n"
"Active: %8lu kB\n"
"Inactive: %8lu kB\n"
+ "ActiveLimit: %8lu kB\n"
"HighTotal: %8lu kB\n"
"HighFree: %8lu kB\n"
"LowTotal: %8lu kB\n"
@@ -181,6 +184,7 @@ static int meminfo_read_proc(char *page,
K(total_swapcache_pages),
K(active),
K(inactive),
+ K(active_limit),
K(i.totalhigh),
K(i.freehigh),
K(i.totalram-i.totalhigh),
Index: linux-2.6.12-vm/include/linux/swap.h
===================================================================
--- linux-2.6.12-vm.orig/include/linux/swap.h
+++ linux-2.6.12-vm/include/linux/swap.h
@@ -161,6 +161,7 @@ extern void init_nonresident(void);
/* linux/mm/clockpro.c */
extern void remember_page(struct page *, struct address_space *, unsigned long);
extern int page_is_hot(struct page *, struct address_space *, unsigned long);
+extern unsigned long get_active_limit(void);
DECLARE_PER_CPU(unsigned long, evicted_pages);

/* linux/mm/page_alloc.c */
Index: linux-2.6.12-vm/mm/clockpro.c
===================================================================
--- linux-2.6.12-vm.orig/mm/clockpro.c
+++ linux-2.6.12-vm/mm/clockpro.c
@@ -100,3 +100,14 @@ void remember_page(struct page * page, s
zone->active_limit < zone->present_pages * 7 / 8)
zone->active_limit++;
}
+
+unsigned long get_active_limit(void)
+{
+ unsigned long total = 0;
+ struct zone * zone;
+
+ for_each_zone(zone)
+ total += zone->active_limit;
+
+ return total;
+}

--
--
All Rights Reversed
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/