summaryrefslogtreecommitdiff
path: root/kernel/sched/core_sched.c
diff options
context:
space:
mode:
authorJosh Don <joshdon@google.com>2022-06-30 00:14:26 +0300
committerPeter Zijlstra <peterz@infradead.org>2022-07-04 10:23:07 +0300
commit1fcf54deb767d474181ad7cf33c92bb2a33607fb (patch)
tree5f7d7572e4750a90f8c2a97deb74f159d65373b7 /kernel/sched/core_sched.c
parentb812fc9768e0048582c8e18d7b66559c1758dde1 (diff)
downloadlinux-1fcf54deb767d474181ad7cf33c92bb2a33607fb.tar.xz
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/core_sched.c')
-rw-r--r--kernel/sched/core_sched.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/sched/core_sched.c b/kernel/sched/core_sched.c
index 38a2cec21014..5103502da7ba 100644
--- a/kernel/sched/core_sched.c
+++ b/kernel/sched/core_sched.c
@@ -277,7 +277,11 @@ void __sched_core_account_forceidle(struct rq *rq)
if (p == rq_i->idle)
continue;
- __schedstat_add(p->stats.core_forceidle_sum, delta);
+ /*
+ * Note: this will account forceidle to the current cpu, even
+ * if it comes from our SMT sibling.
+ */
+ __account_forceidle_time(p, delta);
}
}