Skip to content

RFC true vs. system idle cputime

Martin Schwidefsky linux-arch 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4fix scaled & unscaled cputime accountingarch/ia64/kernel/time.c arch/powerpc/kernel/time.c arch/s390/kernel/vtime.c +4 more+37 -561 reply
2/4idle cputime accountingarch/ia64/kernel/time.c arch/powerpc/kernel/time.c arch/s390/kernel/vtime.c +6 more+111 -543 replies
3/4improve precision of idle accounting.arch/s390/include/asm/cpu.h arch/s390/kernel/process.c arch/s390/kernel/smp.c+59 -360 replies
4/4improve idle cputime accountingarch/s390/include/asm/cpu.h arch/s390/kernel/process.c arch/s390/kernel/s390_ext.c +2 more+16 -200 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchPaul Mackerras
1/4A-b
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch 0/4] [RFC] true vs. system idle cputime

Greetings,
while working on the analysis of a mismatch between the cputime accounting numbers of z/VM as the host and Linux as the guest I started to wonder about the accounting of idle time. z/VM showed more cpu time for the guest as the guest itself. With the current code everything that the idle process does is accounted as idle time. If idle is sleeping that is fine, but if idle is actually using cpu cycles this is wrong.

The question is how wrong? To find out I've implemented really precise accounting of true idle vs. system idle cputime for s390. A really simple test that wakes up 100 times per second to do some minimal work before going back to sleep showed 0.35% of system idle time. If you are dealing with lots of virtual penguins this quickly becomes significant.

There are four patches in this series:
Patch #1: Cleanup scaled / unscaled cputime accounting
Patch #2: Change the accounting interface to allow the architectures to do
precise idle time accounting
Patch #3: s390 patch to improve the precision of the idle_time_us value Patch #4: s390 patch to implement improved idle time accounting

There is one change in patch #2 that might require a change on powerpc and/or ia64. The generic TICK_ONESHOT/NO_HZ code calculates the number of ticks spent with a disabled HZ timer and accounts this as idle time. For a configuration for VIRT_CPU_ACCOUNTING=y this is horribly wrong. Either you have precise accounting or you don't. Patch #2 just removes the calculation for VIRT_CPU_ACCOUNTING=y. The architectures which support precise accounting have to deal with it on their own. This is where the powerpc and ia64 maintainer come into play. Would you look at patch #2 please ?

To make it clearer what happens in tick_nohz_restart_sched_tick I've added a new function account_idle_ticks(). And for good measure another one named account_steal_ticks() for xen where "interesting" things have been done with the account_steal_time interface.

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.