On Fri, 1 Jun 2012, Anton Vorontsov wrote:
This function forcibly flushes per-cpu vmstat diff counters to the global counters.
Why is it necessary to have a function that does not expire the pcps? Is that side effect important? We use refresh_vm_cpu_stats(cpu) in page_alloc.c already to flush the vmstat counters. Is the flushing of the pcps in 2 seconds insteads of 3 once really that important?
Also if we do this
Can we therefore also name the function in a different way like
flush_vmstats()
@@ -456,11 +457,15 @@ void refresh_cpu_vm_stats(int cpu) local_irq_restore(flags); atomic_long_add(v, &zone->vm_stat[i]); global_diff[i] += v;
if (!drain_pcp)
continue;
#ifdef CONFIG_NUMA /* 3 seconds idle till flush */ p->expire = 3; #endif
Erm. This should be
#ifdef CONFIG_NUMA if (drain_pcp) p->expire = 3; #endif
The construct using "continue" is weird.
}
if (!drain_pcp)
cond_resched();continue;
#ifdef CONFIG_NUMA /* @@ -495,6 +500,21 @@ void refresh_cpu_vm_stats(int cpu) atomic_long_add(global_diff[i], &vm_stat[i]); }
+void refresh_cpu_vm_stats(int cpu) +{
- __refresh_cpu_vm_stats(cpu, 1);
+}
Fold __refresh_cpu_vm_stats into this function and modify the caller of refresh_cpu_vm_stats instead.