[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250107014605.52403-1-jameshongleiwang@126.com>
Date: Tue, 7 Jan 2025 09:46:05 +0800
From: Honglei Wang <jameshongleiwang@....com>
To: tj@...nel.org,
void@...ifault.com,
arighi@...dia.com,
changwoo@...lia.com
Cc: mingo@...hat.com,
peterz@...radead.org,
juri.lelli@...hat.com,
vincent.guittot@...aro.org,
dietmar.eggemann@....com,
rostedt@...dmis.org,
bsegall@...gle.com,
mgorman@...e.de,
vschneid@...hat.com,
linux-kernel@...r.kernel.org
Subject: [PATCH] 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.
Signed-off-by: Honglei Wang <jameshongleiwang@....com>
---
kernel/sched/ext.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 19d2699cf638..ef0e3f2c1e6f 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -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);
}
--
2.45.2
Powered by blists - more mailing lists