sched: minor cleanups
cover sched: minor cleanups
A few no-functional-change cleanups in the scheduler noticed while reading the RT/fair code:
1. Remove sched_fair_runnable(), dead since its last caller went away in 50653216e4ff; as a static inline it never warned.
2. Drop the unused rq argument from the internal requeue_task_rt() helper.
3. Fix an inverted #endif comment on the RT_GROUP_SCHED block.
No functional change in any of them.
Zhan Xusheng (3):
sched/fair: Remove unused sched_fair_runnable() sched/rt: Remove unused rq argument from requeue_task_rt() sched/rt: Fix inverted #endif comment for the RT_GROUP_SCHED block
kernel/sched/rt.c | 10 +++++----- kernel/sched/sched.h | 5 ----- 2 files changed, 5 insertions(+), 10 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/3 sched/fair: Remove unused sched_fair_runnable()
The last caller of sched_fair_runnable() was removed by commit 50653216e4ff ("sched: Add support to pick functions to take rf"). Its siblings sched_dl_runnable() and sched_rt_runnable() are still used, but the fair variant is now dead.
As a static inline it does not trigger -Wunused-function, so it has gone unnoticed. Remove it. No functional change.
--- kernel/sched/sched.h | 5 ----- 1 file changed, 5 deletions(-)
kernel/sched/sched.h +0 -5
@@ -2851,11 +2851,6 @@ static inline bool sched_rt_runnable(struct rq *rq)return rq->rt.rt_queued >0 ; } -static inline bool sched_fair_runnable (struct rq *rq) -{ -return rq->cfs.nr_queued >0 ; -} -extern struct task_struct *pick_task_fair (struct rq *rq,struct rq_flags *rf);extern struct task_struct *pick_task_idle (struct rq *rq,struct rq_flags *rf);
Signature · 1 line
2.43.0
PATCH 2/3 sched/rt: Remove unused rq argument from requeue_task_rt()
In reply to Zhan Xushengrequeue_task_rt() takes a struct rq *rq argument but never uses it. It requeues the RT scheduling entities via the rt_rq obtained from the task's RT scheduling entity (&p->rt) with rt_rq_of_se(), not from @rq. The argument has been redundant ever since RT group scheduling reworked the requeue path to iterate the sched_rt_entity hierarchy.
Drop the unused argument and update the three callers. No functional change.
--- kernel/sched/rt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/sched/rt.c +4 -4
@@ -1482,7 +1482,7 @@ requeue_rt_entity(struct rt_rq *rt_rq, struct sched_rt_entity *rt_se, int head) } } -static void requeue_task_rt (struct rq *rq,struct task_struct *p,int head) +static void requeue_task_rt (struct task_struct *p,int head) {struct sched_rt_entity *rt_se = &p->rt;struct rt_rq *rt_rq;
@@ -1495,7 +1495,7 @@ static void requeue_task_rt(struct rq *rq, struct task_struct *p, int head)static void yield_task_rt (struct rq *rq) { -requeue_task_rt (rq, rq->donor,0 ); +requeue_task_rt (rq->donor,0 ); }static int find_lowest_rq (struct task_struct *task);
@@ -1592,7 +1592,7 @@ static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)* the current task but none can run 'p', so lets reschedule * to try and push the current task away: */ -requeue_task_rt (rq, p,1 ); +requeue_task_rt (p,1 );resched_curr (rq); }
@@ -2564,7 +2564,7 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p, int queued)*/ for_each_sched_rt_entity (rt_se) {if (rt_se->run_list.prev != rt_se->run_list.next) { -requeue_task_rt (rq, p,0 ); +requeue_task_rt (p,0 );resched_curr (rq);return ; }
Signature · 1 line
2.43.0
PATCH 3/3 sched/rt: Fix inverted #endif comment for the RT_GROUP_SCHED block
In reply to Zhan XushengThe #endif that closes the "Ensure that the real time constraints are schedulable" block is annotated "/* !CONFIG_RT_GROUP_SCHED */", but it closes the positive "#ifdef CONFIG_RT_GROUP_SCHED" -- there is no #else in the block -- so the comment is inverted. Drop the negation to match the block it closes and the positive-block convention used elsewhere in the file. Comment only, no functional change.
--- kernel/sched/rt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/rt.c +1 -1
@@ -2844,7 +2844,7 @@ int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk) return 1; } -#endif /* !CONFIG_RT_GROUP_SCHED */ +#endif /* CONFIG_RT_GROUP_SCHED */ #ifdef CONFIG_SYSCTL static int sched_rt_global_validate (void )
Signature · 1 line
2.43.0