Skip to content

sched,time: reduce nohz_full syscall overhead 40%

[email protected] lkml 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest4 patches 5 repliesIn review
  2. v54 patches 5 repliesSuperseded
  3. v44 patches 2 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v34 patches9 repliesSuperseded
v10 of 2 patches0 repliesSuperseded

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4sched,time: remove non-power-of-two divides from __acct_update_integralskernel/tsacct.c+16 -100 replies
2/4acct,time: change indentation in __acct_update_integralskernel/tsacct.c+26 -251 reply
3/4time,acct: drop irq save & restore from __acct_update_integralskernel/tsacct.c+4 -50 replies
4/4sched,time: switch VIRT_CPU_ACCOUNTING_GEN to jiffy granularitykernel/sched/cputime.c+23 -162 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchFrederic WeisbeckerThomas Gleixner
SeriesR-b
1/4
2/4A-b
3/4
4/4

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

Read the v6 thread

Cover letter [PATCH 0/4 v6] sched,time: reduce nohz_full syscall overhead 40%

(v6: make VIRT_CPU_ACCOUNTING_GEN jiffy granularity)

Running with nohz_full introduces a fair amount of overhead. Specifically, various things that are usually done from the timer interrupt are now done at syscall, irq, and guest entry and exit times.

However, some of the code that is called every single time has only ever worked at jiffy resolution. The code in __acct_update_integrals was also doing some unnecessary calculations.

Getting rid of the unnecessary calculations, without changing any of the functionality in __acct_update_integrals gets us about an 11% win.

Not calling the time statistics updating code more than once per jiffy, like is done on housekeeping CPUs and on all the CPUs of a non-nohz_full system, shaves off a further 30%.

I tested this series with a microbenchmark calling an invalid syscall number ten million times in a row, on a nohz_full cpu.

Run times for the microbenchmark:

4.4                             3.8 seconds
4.5-rc1                         3.7 seconds
4.5-rc1 + first patch           3.3 seconds
4.5-rc1 + first 3 patches       3.1 seconds
4.5-rc1 + all patches           2.3 seconds

Same test on a non-NOHZ_FULL, non-housekeeping CPU:
all kernels 1.86 seconds