Re: [PATCH 00/10] vtime: Delay cputime accounting to tick

Frederic Weisbecker
2016-12-06T14:34:34Z

On Tue, Dec 06, 2016 at 03:20:55PM +1100, Paul Mackerras wrote:
> On Tue, Dec 06, 2016 at 03:32:13AM +0100, Frederic Weisbecker wrote:
> > This follows up Martin Schwidefsky's patch which propose to delay
> > cputime accounting to the tick in order to minimize the calls to
> > account_system_time() and alikes as these functions can carry quite some
> > overhead:
> >
> > http://lkml.kernel.org/r/20161121111728.13a0a3db@mschwide
> >
> > The set includes Martin's patch, rebased on top of tip:sched/core and
> > latest s390 changes, and extends it to the other implementations of
> > CONFIG_VIRT_CPU_ACCOUNTING_NATIVE (powerpc and ia64) along with a few
> > core changes to adapt the whole.
> >
> > Only built-tested though as I don't have access to any of these archs.
>
> The patches look reasonable at a quick look. I assume that to test
> them, we would want to run a guest in an overcommitted system, so as
> to get some steal time. Do you have any more specific suggestions as
> to what to run as a test? Just run some benchmark and see if the
> user/system/irq times look reasonable? Or do you have something more
> quantitative?

So I guess we want to test both correctness and performance.

To check correctness I use two little programs, one that does a userspace
loop:

int main(int argc, char **argv)
{
while (1);
return 0;
}

And another that does a kernelspace loop. The latter
is not 100% kernel loop but spends most of its time in
kernel mode.

int main(int argc, char **argv)
{
void *addr = sbrk(0);

while (1) {
brk(addr + 4096);
brk(addr);
}
return 0;
}

Testing idle time just consist in checking the difference between two
cat /proc/stat in a given timelapse for an idle CPU.

For irqs it gets harder. There you just need to check if the numbers are
reasonable.

Now in order to measure performance, I think you need a workload that either
does a lot of guest/host switch or does a lot of IRQs. Maybe just something
that involves networking. Then comparing stime, hardirq and softirq should
show some better nummbers. In order to increase the effect, you can set a very
low HZ value (100?).

Thanks.