summaryrefslogtreecommitdiffstats
path: root/kernel/sched/stats.c
diff options
context:
space:
mode:
authorYafang Shao <laoar.shao@gmail.com>2021-09-05 16:35:43 +0200
committerPeter Zijlstra <peterz@infradead.org>2021-10-05 15:51:48 +0200
commit847fc0cd0664fcb2a08ac66df6b85935361ec454 (patch)
treedb448af511226f6a3643bb37e0062244ca42aa48 /kernel/sched/stats.c
parentsched: Make schedstats helpers independent of fair sched class (diff)
downloadlinux-847fc0cd0664fcb2a08ac66df6b85935361ec454.tar.xz
linux-847fc0cd0664fcb2a08ac66df6b85935361ec454.zip
sched: Introduce task block time in schedstats
Currently in schedstats we have sum_sleep_runtime and iowait_sum, but there's no metric to show how long the task is in D state. Once a task in D state, it means the task is blocked in the kernel, for example the task may be waiting for a mutex. The D state is more frequent than iowait, and it is more critital than S state. So it is worth to add a metric to measure it. Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20210905143547.4668-5-laoar.shao@gmail.com
Diffstat (limited to 'kernel/sched/stats.c')
-rw-r--r--kernel/sched/stats.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c
index fad781ca7791..07dde2928c79 100644
--- a/kernel/sched/stats.c
+++ b/kernel/sched/stats.c
@@ -82,6 +82,7 @@ void __update_stats_enqueue_sleeper(struct rq *rq, struct task_struct *p,
__schedstat_set(stats->block_start, 0);
__schedstat_add(stats->sum_sleep_runtime, delta);
+ __schedstat_add(stats->sum_block_runtime, delta);
if (p) {
if (p->in_iowait) {