Skip to content

Commit f422316

Browse files
committed
sched_ext: Remove switch_class_scx()
Now that put_prev_task_scx() is called with @next on task switches, there's no reason to use sched_class.switch_class(). Rename switch_class_scx() to switch_class() and call it from put_prev_task_scx(). Signed-off-by: Tejun Heo <[email protected]>
1 parent 65aaf90 commit f422316

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

kernel/sched/ext.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2723,12 +2723,10 @@ preempt_reason_from_class(const struct sched_class *class)
27232723
return SCX_CPU_PREEMPT_UNKNOWN;
27242724
}
27252725

2726-
static void switch_class_scx(struct rq *rq, struct task_struct *next)
2726+
static void switch_class(struct rq *rq, struct task_struct *next)
27272727
{
27282728
const struct sched_class *next_class = next->sched_class;
27292729

2730-
if (!scx_enabled())
2731-
return;
27322730
#ifdef CONFIG_SMP
27332731
/*
27342732
* Pairs with the smp_load_acquire() issued by a CPU in
@@ -2808,6 +2806,9 @@ static void put_prev_task_scx(struct rq *rq, struct task_struct *p,
28082806
do_enqueue_task(rq, p, 0, -1);
28092807
}
28102808
}
2809+
2810+
if (next && next->sched_class != &ext_sched_class)
2811+
switch_class(rq, next);
28112812
}
28122813

28132814
static struct task_struct *first_local_task(struct rq *rq)
@@ -3591,8 +3592,6 @@ DEFINE_SCHED_CLASS(ext) = {
35913592
.put_prev_task = put_prev_task_scx,
35923593
.set_next_task = set_next_task_scx,
35933594

3594-
.switch_class = switch_class_scx,
3595-
35963595
#ifdef CONFIG_SMP
35973596
.select_task_rq = select_task_rq_scx,
35983597
.task_woken = task_woken_scx,

0 commit comments

Comments
 (0)