WSL2-Linux-Kernel/include/linux/sched
Frederic Weisbecker e7f2be115f sched/cputime: Fix getrusage(RUSAGE_THREAD) with nohz_full
getrusage(RUSAGE_THREAD) with nohz_full may return shorter utime/stime
than the actual time.

task_cputime_adjusted() snapshots utime and stime and then adjust their
sum to match the scheduler maintained cputime.sum_exec_runtime.
Unfortunately in nohz_full, sum_exec_runtime is only updated once per
second in the worst case, causing a discrepancy against utime and stime
that can be updated anytime by the reader using vtime.

To fix this situation, perform an update of cputime.sum_exec_runtime
when the cputime snapshot reports the task as actually running while
the tick is disabled. The related overhead is then contained within the
relevant situations.

Reported-by: Hasegawa Hitomi <hasegawa-hitomi@fujitsu.com>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Hasegawa Hitomi <hasegawa-hitomi@fujitsu.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Acked-by: Phil Auld <pauld@redhat.com>
Link: https://lore.kernel.org/r/20211026141055.57358-3-frederic@kernel.org
2021-12-02 15:08:22 +01:00
..
autogroup.h
clock.h
coredump.h mm: gup: pack has_pinned in MMF_HAS_PINNED 2021-06-29 10:53:48 -07:00
cpufreq.h sched/cpufreq: Consider reduced CPU capacity in energy calculation 2021-06-17 14:11:43 +02:00
cputime.h sched/cputime: Fix getrusage(RUSAGE_THREAD) with nohz_full 2021-12-02 15:08:22 +01:00
deadline.h
debug.h sched: Change task_struct::state 2021-06-18 11:43:09 +02:00
hotplug.h
idle.h sched,livepatch: Use wake_up_if_idle() 2021-10-14 13:09:25 +02:00
init.h
isolation.h
jobctl.h
loadavg.h
mm.h sched: Move mmdrop to RCU on RT 2021-10-05 15:52:09 +02:00
nohz.h
numa_balancing.h
prio.h
rt.h
sd_flags.h sched/core: Introduce SD_ASYM_CPUCAPACITY_FULL sched_domain flag 2021-06-24 09:07:50 +02:00
signal.h signal: Replace force_fatal_sig with force_exit_sig when in doubt 2021-11-19 09:15:58 -06:00
smt.h
stat.h
sysctl.h sched/sysctl: Move extern sysctl declarations to sched.h 2021-06-28 15:42:25 +02:00
task.h shm: extend forced shm destroy to support objects from several IPC nses 2021-11-20 10:35:54 -08:00
task_stack.h task_stack: Fix end_of_stack() for architectures with upwards-growing stack 2021-10-30 23:11:01 +02:00
topology.h sched/fair: Wait before decaying max_newidle_lb_cost 2021-10-31 11:11:38 +01:00
types.h
user.h fs/epoll: use a per-cpu counter for user's watches count 2021-09-08 11:50:27 -07:00
wake_q.h sched/wake_q: Provide WAKE_Q_HEAD_INITIALIZER() 2021-08-17 16:57:55 +02:00
xacct.h