... and remove switched_to_scx(), since all methods are now optional.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
kernel/sched/core.c | 8 ++++----
kernel/sched/deadline.c | 4 ++--
kernel/sched/ext.c | 6 ++----
kernel/sched/fair.c | 4 ++--
kernel/sched/idle.c | 2 +-
kernel/sched/rt.c | 4 ++--
kernel/sched/sched.h | 8 ++++----
kernel/sched/stop_task.c | 2 +-
8 files changed, 18 insertions(+), 20 deletions(-)
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10531,7 +10531,7 @@ struct sched_change_ctx sched_change_beg
lockdep_assert_rq_held(rq);
if ((flags & DEQUEUE_CLASS) && p->sched_class->switching_from)
- p->sched_class->switching_from(rq, p);
+ p->sched_class->switching_from(rq, p, flags);
struct sched_change_ctx ctx = {
.p = p,
@@ -10546,7 +10546,7 @@ struct sched_change_ctx sched_change_beg
put_prev_task(rq, p);
if ((flags & DEQUEUE_CLASS) && p->sched_class->switched_from)
- p->sched_class->switched_from(rq, p);
+ p->sched_class->switched_from(rq, p, flags);
return ctx;
}
@@ -10559,7 +10559,7 @@ void sched_change_end(struct sched_chang
lockdep_assert_rq_held(rq);
if ((ctx.flags & ENQUEUE_CLASS) && p->sched_class->switching_to)
- p->sched_class->switching_to(rq, p);
+ p->sched_class->switching_to(rq, p, ctx.flags);
if (ctx.queued)
enqueue_task(rq, p, ctx.flags | ENQUEUE_NOCLOCK);
@@ -10567,5 +10567,5 @@ void sched_change_end(struct sched_chang
set_next_task(rq, p);
if ((ctx.flags & ENQUEUE_CLASS) && p->sched_class->switched_to)
- p->sched_class->switched_to(rq, p);
+ p->sched_class->switched_to(rq, p, ctx.flags);
}
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2968,7 +2968,7 @@ void dl_clear_root_domain(struct root_do
#endif /* CONFIG_SMP */
-static void switched_from_dl(struct rq *rq, struct task_struct *p)
+static void switched_from_dl(struct rq *rq, struct task_struct *p, int flags)
{
/*
* task_non_contending() can start the "inactive timer" (if the 0-lag
@@ -3022,7 +3022,7 @@ static void switched_from_dl(struct rq *
* When switching to -deadline, we may overload the rq, then
* we try to push someone off, if possible.
*/
-static void switched_to_dl(struct rq *rq, struct task_struct *p)
+static void switched_to_dl(struct rq *rq, struct task_struct *p, int flags)
{
if (hrtimer_try_to_cancel(&p->dl.inactive_timer) == 1)
put_task_struct(p);
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -3663,7 +3663,7 @@ static void prio_changed_scx(struct rq *
{
}
-static void switching_to_scx(struct rq *rq, struct task_struct *p)
+static void switching_to_scx(struct rq *rq, struct task_struct *p, int flags)
{
scx_ops_enable_task(p);
@@ -3676,13 +3676,12 @@ static void switching_to_scx(struct rq *
(struct cpumask *)p->cpus_ptr);
}
-static void switched_from_scx(struct rq *rq, struct task_struct *p)
+static void switched_from_scx(struct rq *rq, struct task_struct *p, int flags)
{
scx_ops_disable_task(p);
}
static void wakeup_preempt_scx(struct rq *rq, struct task_struct *p,int wake_flags) {}
-static void switched_to_scx(struct rq *rq, struct task_struct *p) {}
int scx_check_setscheduler(struct task_struct *p, int policy)
{
@@ -3971,7 +3970,6 @@ DEFINE_SCHED_CLASS(ext) = {
.switching_to = switching_to_scx,
.switched_from = switched_from_scx,
- .switched_to = switched_to_scx,
.reweight_task = reweight_task_scx,
.prio_changed = prio_changed_scx,
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -13175,12 +13175,12 @@ static void attach_task_cfs_rq(struct ta
attach_entity_cfs_rq(se);
}
-static void switched_from_fair(struct rq *rq, struct task_struct *p)
+static void switched_from_fair(struct rq *rq, struct task_struct *p, int flags)
{
detach_task_cfs_rq(p);
}
-static void switched_to_fair(struct rq *rq, struct task_struct *p)
+static void switched_to_fair(struct rq *rq, struct task_struct *p, int flags)
{
SCHED_WARN_ON(p->se.sched_delayed);
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -494,7 +494,7 @@ static void task_tick_idle(struct rq *rq
{
}
-static void switching_to_idle(struct rq *rq, struct task_struct *p)
+static void switching_to_idle(struct rq *rq, struct task_struct *p, int flags)
{
BUG();
}
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2420,7 +2420,7 @@ static void rq_offline_rt(struct rq *rq)
* When switch from the rt queue, we bring ourselves to a position
* that we might want to pull RT tasks from other runqueues.
*/
-static void switched_from_rt(struct rq *rq, struct task_struct *p)
+static void switched_from_rt(struct rq *rq, struct task_struct *p, int flags)
{
/*
* If there are other RT tasks then we will reschedule
@@ -2451,7 +2451,7 @@ void __init init_sched_rt_class(void)
* with RT tasks. In this case we try to push them off to
* other runqueues.
*/
-static void switched_to_rt(struct rq *rq, struct task_struct *p)
+static void switched_to_rt(struct rq *rq, struct task_struct *p, int flags)
{
/*
* If we are running, update the avg_rt tracking, as the running time
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2417,10 +2417,10 @@ struct sched_class {
void (*task_fork)(struct task_struct *p);
void (*task_dead)(struct task_struct *p);
- void (*switching_from)(struct rq *this_rq, struct task_struct *task);
- void (*switched_from) (struct rq *this_rq, struct task_struct *task);
- void (*switching_to) (struct rq *this_rq, struct task_struct *task);
- void (*switched_to) (struct rq *this_rq, struct task_struct *task);
+ void (*switching_from)(struct rq *this_rq, struct task_struct *task, int flags);
+ void (*switched_from) (struct rq *this_rq, struct task_struct *task, int flags);
+ void (*switching_to) (struct rq *this_rq, struct task_struct *task, int flags);
+ void (*switched_to) (struct rq *this_rq, struct task_struct *task, int flags);
void (*reweight_task)(struct rq *this_rq, struct task_struct *task,
const struct load_weight *lw);
--- a/kernel/sched/stop_task.c
+++ b/kernel/sched/stop_task.c
@@ -76,7 +76,7 @@ static void task_tick_stop(struct rq *rq
{
}
-static void switching_to_stop(struct rq *rq, struct task_struct *p)
+static void switching_to_stop(struct rq *rq, struct task_struct *p, int flags)
{
BUG(); /* its impossible to change to this class */
}
© 2016 - 2024 Red Hat, Inc.