Re: [PATCH] mm, vmstat: make quiet_vmstat lighter (was: Re: fast path cycle muncher (vmstat: make vmstat_updater deferrable) again and shut down on idle)

From: Christoph Lameter
Date: Thu Jan 28 2016 - 11:40:21 EST


On Thu, 28 Jan 2016, Michal Hocko wrote:

> +void quiet_vmstat(void)
> +{
> + if (system_state != SYSTEM_RUNNING)
> + return;
> +
> + /*
> + * If we are already in hands of the shepherd then there
> + * is nothing for us to do here.
> + */
> + if (cpumask_test_and_set_cpu(smp_processor_id(), cpu_stat_off))
> + return;
> +
> + if (!need_update(smp_processor_id()))
> + return;
> +

You can drop the need_update check. refresh_cpu_vm_stats() does the same
checks in a more efficient way. If you keep this the checks will
performed twice.

> + /*
> + * Just refresh counters and do not care about the pending delayed
> + * vmstat_update. It doesn't fire that often to matter and canceling
> + * it would be too expensive from this path.
> + * vmstat_shepherd will take care about that for us.
> + */
> + refresh_cpu_vm_stats(false);
> +}
> +
>