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: Michal Hocko
Date: Thu Jan 28 2016 - 11:54:11 EST


On Thu 28-01-16 10:40:10, Christoph Lameter wrote:
> 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.

refresh_cpu_vm_stats does this_cpu_xchg for each counter. Is it really
more effective than memchr_inv?

--
Michal Hocko
SUSE Labs