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

From: Michal Hocko
Date: Thu Jan 28 2016 - 10:37:49 EST


On Thu 28-01-16 16:31:11, Michal Hocko wrote:
> On Wed 27-01-16 12:26:16, Christoph Lameter wrote:
> > On Wed, 27 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;
> > > +
> > > + /*
> > > + * 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);
> > > +}
> >
> > The problem here is that there will be an additional tick generated on
> > idle. This is an issue for power because now the processor has to
> > needlessly wake up again, do tick processing etc just to effectively do a
> > cancel_delayed_work().
>
> Thinking about it some more, making vmstat_update deferrable should help
> to not interrupt idle no?

With the full changelog