Skip to contentSkip to conversation

sched_ext: switch class when preempted by higher priority scheduler

PATCH Superseded Honglei Wang 2 participants 3 messages Jan 7, 2025 – Jan 8, 2025 Scheduler

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched_ext: switch class when preempted by higher priority scheduler

It might be helpful to give BPF Scheduler a chance to invoke cpu_release() function, if defined, when preempted by a higher priority scheduler class task.

---
 kernel/sched/ext.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/ext.c +2 -1
index 19d2699cf638..ef0e3f2c1e6f 100644
@@ -3034,7 +3034,7 @@ static void put_prev_task_scx(struct rq *rq, struct task_struct *p,
 		 */
 		if (p->scx.slice && !scx_rq_bypassing(rq)) {
 			dispatch_enqueue(&rq->scx.local_dsq, p, SCX_ENQ_HEAD);
-			return;
+			goto switch_class;
 		}
 
 		/*
@@ -3051,6 +3051,7 @@ static void put_prev_task_scx(struct rq *rq, struct task_struct *p,
 		}
 	}
 
+switch_class:
 	if (next && next->sched_class != &ext_sched_class)
 		switch_class(rq, next);
 }
Signature · 1 line
2.45.2
#1 lore raw

Hello, Honglei.

Quoted 5 lines · Honglei Wang

It might be helpful to give BPF Scheduler a chance to invoke cpu_release() function, if defined, when preempted by a higher priority scheduler class task.

Can you update the patch description indicating that this is a bug fix? ops.cpu_release() must be invoked in this case but is being skipped.

Thanks.

Signature · 1 line
tejun
#2 lore raw
Quoted 7 lines · Tejun Heo

Hello, Honglei.

Quoted 4 lines · Honglei Wang

It might be helpful to give BPF Scheduler a chance to invoke cpu_release() function, if defined, when preempted by a higher priority scheduler class task.

Quoted 7 lines
Quoted 1 line

Can you update the patch description indicating that this is a bug fix? ops.cpu_release() must be invoked in this case but is being skipped.

Thanks.

OK, will send a update later.

Thanks,
Honglei