From: Christoph Lameter Make it configurable. Code in mm makes the vm statistics intervals independent from the cache reaper use that opportunity to make it configurable. Signed-off-by: Christoph Lameter Signed-off-by: Andrew Morton --- Documentation/sysctl/vm.txt | 19 +++++++++++++++++++ include/linux/sysctl.h | 1 + kernel/sysctl.c | 12 ++++++++++++ mm/vmstat.c | 4 +++- 4 files changed, 35 insertions(+), 1 deletion(-) diff -puN Documentation/sysctl/vm.txt~make-vm-statistics-update-interval-configurable Documentation/sysctl/vm.txt --- a/Documentation/sysctl/vm.txt~make-vm-statistics-update-interval-configurable +++ a/Documentation/sysctl/vm.txt @@ -32,6 +32,7 @@ Currently, these files are in /proc/sys/ - min_slab_ratio - panic_on_oom - swap_prefetch +- stat_interval ============================================================== @@ -229,3 +230,21 @@ copying back pages from swap into the sw practice it can take many minutes before the vm is idle enough. The default value is 1. + +================================================================ + +stat_interval + +The period (seconds) in which the vm statistics are consolidated if the +kernel supports SMP. Differentials to VM statistics are kept in per cpu +fields and are only consolidated with per zone and global counters if the +differentials cross certain limits. This limits the frequency of global +updates and results in good scaling of the VM counters. However, if those +counters are below the limits then the global and per zone counters are +off by that value. So we should consolidate the counters at some point. +So the kernel runs a statistics update at regular intervals to consolidate +the per cpu differentials that are below the update limits. The interval +determines the frequency of these consolidations. + +The default value is 1 second. + diff -puN include/linux/sysctl.h~make-vm-statistics-update-interval-configurable include/linux/sysctl.h --- a/include/linux/sysctl.h~make-vm-statistics-update-interval-configurable +++ a/include/linux/sysctl.h @@ -208,6 +208,7 @@ enum VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */ VM_HUGETLB_TREAT_MOVABLE=36, /* Allocate hugepages from ZONE_MOVABLE */ + VM_STAT_INTERVAL=37, /* Statistics timer */ /* s390 vm cmm sysctls */ VM_CMM_PAGES=1111, diff -puN kernel/sysctl.c~make-vm-statistics-update-interval-configurable kernel/sysctl.c --- a/kernel/sysctl.c~make-vm-statistics-update-interval-configurable +++ a/kernel/sysctl.c @@ -78,6 +78,7 @@ extern int sysctl_drop_caches; extern int percpu_pagelist_fraction; extern int compat_log; extern int maps_protect; +extern int sysctl_stat_interval; /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ static int maxolduid = 65535; @@ -866,6 +867,17 @@ static ctl_table vm_table[] = { .extra2 = &one_hundred, }, #endif +#ifdef CONFIG_SMP + { + .ctl_name = VM_STAT_INTERVAL, + .procname = "stat_interval", + .data = &sysctl_stat_interval, + .maxlen = sizeof(sysctl_stat_interval), + .mode = 0644, + .proc_handler = &proc_dointvec_jiffies, + .strategy = &sysctl_jiffies, + }, +#endif #if defined(CONFIG_X86_32) || \ (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) { diff -puN mm/vmstat.c~make-vm-statistics-update-interval-configurable mm/vmstat.c --- a/mm/vmstat.c~make-vm-statistics-update-interval-configurable +++ a/mm/vmstat.c @@ -641,11 +641,13 @@ const struct seq_operations vmstat_op = #ifdef CONFIG_SMP static DEFINE_PER_CPU(struct delayed_work, vmstat_work); +int sysctl_stat_interval __read_mostly = HZ; static void vmstat_update(struct work_struct *w) { refresh_cpu_vm_stats(smp_processor_id()); - schedule_delayed_work(&__get_cpu_var(vmstat_work), HZ); + schedule_delayed_work(&__get_cpu_var(vmstat_work), + sysctl_stat_interval); } static void __devinit start_cpu_timer(int cpu) _