linux-stable/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
cpufreq.h
cputime.h sched/cputime: Fix getrusage(RUSAGE_THREAD) with nohz_full 2021-12-02 15:08:22 +01:00
deadline.h
debug.h
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
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
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