From 9b5776352f8d46e3ada80f91f9d978870105630f Mon Sep 17 00:00:00 2001 From: KOSAKI Motohiro Date: Fri, 20 Aug 2010 15:28:22 +0900 Subject: [PATCH 3/4] debug: reset_reclaim_stat Signed-off-by: KOSAKI Motohiro --- kernel/sysctl.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index e1b22ed..3b72836 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -973,6 +973,30 @@ static int shrink_all_memory_handler(ctl_table *table, int write, return 0; } +#include +#include + +static int reset_reclaim_stat_handler(ctl_table *table, int write, + void __user *buffer, size_t *length, + loff_t *ppos) +{ + struct zone *zone; + struct zone_reclaim_stat *rstat; + + if (write) { + for_each_populated_zone(zone) { + spin_lock_irq(&zone->lru_lock); + rstat = &zone->reclaim_stat; + rstat->recent_scanned[0] = 0; + rstat->recent_rotated[0] = 0; + rstat->recent_scanned[1] = 0; + rstat->recent_rotated[1] = 0; + spin_unlock_irq(&zone->lru_lock); + } + + } + return 0; +} static struct ctl_table vm_table[] = { { @@ -1338,6 +1362,13 @@ static struct ctl_table vm_table[] = { .mode = 0644, .proc_handler = shrink_all_memory_handler, }, + { + .procname = "reset_reclaim_stat", + .data = &sysctl_shrink_all_memory, + .maxlen = sizeof(sysctl_shrink_all_memory), + .mode = 0644, + .proc_handler = reset_reclaim_stat_handler, + }, /* * NOTE: do not add new entries to this table unless you have read -- 1.6.5.2