Re: [PATCH 1/5] vmstat: Implement refresh_vm_stats()

From: Christoph Lameter
Date: Tue Jun 05 2012 - 11:06:20 EST


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)
> + continue;
> cond_resched();
> #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.

--
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/