The /proc/{PID}/sched interface currently prints the util_est field
regardless of whether the UTIL_EST scheduling feature is enabled or not.
This can lead to confusion, as the value may not be meaningful when
UTIL_EST is disabled.
This patch makes the util_est field only appear when the UTIL_EST feature
is enabled via sched_feat. This avoids printing misleading or unused data.
Signed-off-by: Zihuan Zhang <zhangzihuan@kylinos.cn>
---
kernel/sched/debug.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 9d71baf08075..a71ccb851e49 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -861,8 +861,9 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
cfs_rq->avg.runnable_avg);
SEQ_printf(m, " .%-30s: %lu\n", "util_avg",
cfs_rq->avg.util_avg);
- SEQ_printf(m, " .%-30s: %u\n", "util_est",
- cfs_rq->avg.util_est);
+ if (sched_feat(UTIL_EST))
+ SEQ_printf(m, " .%-30s: %u\n", "util_est",
+ cfs_rq->avg.util_est);
SEQ_printf(m, " .%-30s: %ld\n", "removed.load_avg",
cfs_rq->removed.load_avg);
SEQ_printf(m, " .%-30s: %ld\n", "removed.util_avg",
@@ -1259,7 +1260,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
P(se.avg.runnable_avg);
P(se.avg.util_avg);
P(se.avg.last_update_time);
- PM(se.avg.util_est, ~UTIL_AVG_UNCHANGED);
+ if (sched_feat(UTIL_EST))
+ PM(se.avg.util_est, ~UTIL_AVG_UNCHANGED);
#endif
#ifdef CONFIG_UCLAMP_TASK
__PS("uclamp.min", p->uclamp_req[UCLAMP_MIN].value);
--
2.25.1