Skip to contentSkip to conversation

scheduler fixes

GIT PULL Merged Ingo Molnar 2 participants 2 messages Feb 8, 2025 Scheduler

lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest sched/urgent Git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-urgent-2025-02-08

# HEAD: 9065ce69754dece78606c8bbb3821449272e56bf sched/debug: Provide slice length for fair tasks

Fix a cfs_rq->h_nr_runnable accounting bug that trips up a defensive SCHED_WARN_ON() on certain workloads. The bug is believed to be (accidentally) self-correcting, hence no behavioral side effects are expected.

Also print se.slice in debug output, since this value can now be set via the syscall ABI and can be useful to track.

Thanks,

Ingo

------------------>
Christian Loehle (1):
sched/debug: Provide slice length for fair tasks

K Prateek Nayak (1):
sched/fair: Fix inaccurate h_nr_runnable accounting with delayed dequeue

 kernel/sched/debug.c |  2 ++
 kernel/sched/fair.c  | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)
kernel/sched/debug.c +2 -0
index a1be00a988bf..5b32d3cc393b 100644
@@ -1265,6 +1265,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
 	if (task_has_dl_policy(p)) {
 		P(dl.runtime);
 		P(dl.deadline);
+	} else if (fair_policy(p->policy)) {
+		P(se.slice);
 	}
 #ifdef CONFIG_SCHED_CLASS_EXT
 	__PS("ext.enabled", task_on_scx(p));
kernel/sched/fair.c +19 -0
index 26958431deb7..f4e4d3ed943c 100644
@@ -5372,6 +5372,15 @@ static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq);
 static void set_delayed(struct sched_entity *se)
 {
 	se->sched_delayed = 1;
+
+	/*
+	 * Delayed se of cfs_rq have no tasks queued on them.
+	 * Do not adjust h_nr_runnable since dequeue_entities()
+	 * will account it for blocked tasks.
+	 */
+	if (!entity_is_task(se))
+		return;
+
 	for_each_sched_entity(se) {
 		struct cfs_rq *cfs_rq = cfs_rq_of(se);
 
@@ -5384,6 +5393,16 @@ static void set_delayed(struct sched_entity *se)
 static void clear_delayed(struct sched_entity *se)
 {
 	se->sched_delayed = 0;
+
+	/*
+	 * Delayed se of cfs_rq have no tasks queued on them.
+	 * Do not adjust h_nr_runnable since a dequeue has
+	 * already accounted for it or an enqueue of a task
+	 * below it will account for it in enqueue_task_fair().
+	 */
+	if (!entity_is_task(se))
+		return;
+
 	for_each_sched_entity(se) {
 		struct cfs_rq *cfs_rq = cfs_rq_of(se);
 
merge bot Merged
#1 lore raw
The pull request you sent on Sat, 8 Feb 2025 10:21:17 +0100:

The pull request you sent on Sat, 8 Feb 2025 10:21:17 +0100:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-urgent-2025-02-08

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/c7b92e8969cd60a585629cef8d19b7ef330bc171

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html