diff options
author | Josh Don <joshdon@google.com> | 2022-06-29 14:14:26 -0700 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2022-07-04 09:23:07 +0200 |
commit | 1fcf54deb767d474181ad7cf33c92bb2a33607fb (patch) | |
tree | 5f7d7572e4750a90f8c2a97deb74f159d65373b7 /kernel/sched/cputime.c | |
parent | b812fc9768e0048582c8e18d7b66559c1758dde1 (diff) | |
download | linux-1fcf54deb767d474181ad7cf33c92bb2a33607fb.tar.bz2 |
sched/core: add forced idle accounting for cgroups
4feee7d1260 previously added per-task forced idle accounting. This patch
extends this to also include cgroups.
rstat is used for cgroup accounting, except for the root, which uses
kcpustat in order to bypass the need for doing an rstat flush when
reading root stats.
Only cgroup v2 is supported. Similar to the task accounting, the cgroup
accounting requires that schedstats is enabled.
Signed-off-by: Josh Don <joshdon@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lkml.kernel.org/r/20220629211426.3329954-1-joshdon@google.com
Diffstat (limited to 'kernel/sched/cputime.c')
-rw-r--r-- | kernel/sched/cputime.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 78a233d43757..95fc77853743 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -226,6 +226,21 @@ void account_idle_time(u64 cputime) cpustat[CPUTIME_IDLE] += cputime; } + +#ifdef CONFIG_SCHED_CORE +/* + * Account for forceidle time due to core scheduling. + * + * REQUIRES: schedstat is enabled. + */ +void __account_forceidle_time(struct task_struct *p, u64 delta) +{ + __schedstat_add(p->stats.core_forceidle_sum, delta); + + task_group_account_field(p, CPUTIME_FORCEIDLE, delta); +} +#endif + /* * When a guest is interrupted for a longer amount of time, missed clock * ticks are not redelivered later. Due to that, this function may on |