Re: fast path cycle muncher (vmstat: make vmstat_updater deferrable again and shut down on idle)

From: Michal Hocko
Date: Mon Jan 25 2016 - 12:42:33 EST


On Sat 23-01-16 17:21:55, Mike Galbraith wrote:
> Hi Christoph,
>
> While you're fixing that commit up, can you perhaps find a better home
> for quiet_vmstat()? It not only munches cycles when switching cross
> -core mightily, for -rt it injects a sleeping lock into the idle task.
>
> 12.89% [kernel] [k] refresh_cpu_vm_stats.isra.12
> 4.75% [kernel] [k] __schedule
> 4.70% [kernel] [k] mutex_unlock
> 3.14% [kernel] [k] __switch_to

Hmm, I wouldn't have expected that refresh_cpu_vm_stats could have
such a large footprint. I guess this would be just an expensive noop
because we have to check all the zones*counters and do an expensive
this_cpu_xchg. Is the whole deferred thing worth this overhead?

0eb77e988032 ("vmstat: make vmstat_updater deferrable again and
shut down on idle") doesn't talk about any numbers and neither does
39bf6270f524 ("VM statistics: Make timer deferrable").

But even when refresh_cpu_vm_stats is made more effective there would
still be the problem for RT and the work canceling, though. We would
need much more changes to make this RT ready (both timer and WQ code
would need some changes AFAIU).

Unless there is a clear and huge win from doing the vmstat update
deferrable then I think a revert is more appropriate IMHO.
--
Michal Hocko
SUSE Labs