Skip to content

Fix softirq time accounting issues on 4.9

Ivan Delalande stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 1 replyIn review
  2. v14 patches 4 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4sched/cputime: Convert kcpustat to nsecsarch/s390/appldata/appldata_os.c drivers/cpufreq/cpufreq.c drivers/cpufreq/cpufreq_governor.c +6 more+61 -650 replies
2/4macintosh/rack-meter: Convert cputime64_t use to u64drivers/macintosh/rack-meter.c+15 -150 replies
3/4sched/cputime: Increment kcpustat directly on irqtime accountkernel/sched/cputime.c kernel/sched/sched.h+21 -360 replies
4/4sched/cputime: Fix ksoftirqd cputime accounting regressionkernel/sched/cputime.c kernel/sched/sched.h+23 -130 replies

Reviews trailers per patch

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

PatchJesper Dangaard BrouerRik van Riel
1/4
2/4
3/4
4/4Reported-and-tested-by A-b R-b

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

Read the v2 thread

Cover letter [PATCH 4.9 v2 0/4] Fix softirq time accounting issues on 4.9

Hi Greg,

This series fixes issues we've seen with softirq time accounting in 4.9:
- when ksoftirqd is running at 100% on a CPU, none of the values reported by /proc/stat for that CPU will change, sometimes for dozens of seconds,
- large deviations in the total number of ticks accumulated over a fixed time for a CPU, probably because of the first issue hitting for shorter periods.

We found out that something pretty similar had been reported 9 months ago, see the reference link below. In that discussion, Rabin Vincent had made a 4.9 specific patch which fixes our first issue, but we were still seeing some deviation from the total number of ticks (up to 1.7% from expected, where we had only 0.2% on older kernels), and you had also asked for a direct backport from the mainline series, if possible.

As mentioned in that thread, a lot of changes (probably 50+) went into 4.11 to remove cputime, but we could get something working with only the 4 attached patches to fix these two issues. Three of these patches apply without change, and the second one in the series ("sched/cputime:
Convert kcpustat to nsecs") needed a minor change as a cast had been added in 527b0a76f41d ("sched/cpuacct: Avoid %lld seq_printf warning") to fix a build warning on s390. I guess we could also include that patch in this series, let me know if this is the preferred way to handle this.

We ran our tests on 3.18, 4.4 and 4.9 and confirmed that only 4.9 would need this series, and that this series indeed restores the behavior we were seeing on those older kernels.

Thanks!

Reference: http://lkml.kernel.org/r/%[email protected]

v2: - drop "time: Introduce jiffies64_to_nsecs()" as it has already been
merged into v4.9.132,
- include backport of commit 564b733c899f ("macintosh/rack-meter:
Convert cputime64_t use to u64") to avoid introducing a build failure on powerpc.

Frederic Weisbecker (4):
sched/cputime: Convert kcpustat to nsecs macintosh/rack-meter: Convert cputime64_t use to u64 sched/cputime: Increment kcpustat directly on irqtime account sched/cputime: Fix ksoftirqd cputime accounting regression

 arch/s390/appldata/appldata_os.c   | 16 +++----
 drivers/cpufreq/cpufreq.c          |  6 +--
 drivers/cpufreq/cpufreq_governor.c |  2 +-
 drivers/cpufreq/cpufreq_stats.c    |  1 -
 drivers/macintosh/rack-meter.c     | 28 +++++------
 fs/proc/stat.c                     | 68 +++++++++++++--------------
 fs/proc/uptime.c                   |  7 +--
 kernel/sched/cpuacct.c             |  2 +-
 kernel/sched/cputime.c             | 75 +++++++++++++-----------------
 kernel/sched/sched.h               | 12 +++--
 10 files changed, 104 insertions(+), 113 deletions(-)
Signature · 1 line
2.19.1