Re: [PATCH v10 4/7] sched: Add move_queued_task_locked helper
From: John Stultz
Date: Tue Jun 04 2024 - 11:55:36 EST
On Tue, Jun 4, 2024 at 6:12 AM Qais Yousef <qyousef@xxxxxxxxxxx> wrote:
> On 05/06/24 21:54, John Stultz wrote:
> > From: Connor O'Brien <connoro@xxxxxxxxxx>
> >
> > Switch logic that deactivates, sets the task cpu,
> > and reactivates a task on a different rq to use a
> > helper that will be later extended to push entire
> > blocked task chains.
> >
> > This patch was broken out from a larger chain migration
> > patch originally by Connor O'Brien.
...
> > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> > index ae50f212775e..2d41ebe200c7 100644
> > --- a/kernel/sched/sched.h
> > +++ b/kernel/sched/sched.h
> > @@ -3480,5 +3480,16 @@ static inline void init_sched_mm_cid(struct task_struct *t) { }
> >
> > extern u64 avg_vruntime(struct cfs_rq *cfs_rq);
> > extern int entity_eligible(struct cfs_rq *cfs_rq, struct sched_entity *se);
> > +#ifdef CONFIG_SMP
> > +static inline
> > +void move_queued_task_locked(struct rq *rq, struct rq *dst_rq, struct task_struct *task)
> > +{
> > + lockdep_assert_rq_held(rq);
> > + lockdep_assert_rq_held(dst_rq);
> > + deactivate_task(rq, task, 0);
> > + set_task_cpu(task, dst_rq->cpu);
> > + activate_task(dst_rq, task, 0);
> > +}
> > +#endif
>
> I see this pattern in __migrate_swap_task() and try_steal_cookie(), should they
> be converted to?
Ah! Thanks for pointing it out. I'll include that in the next iteration.
> Beside this
>
> Reviewed-by: Qais Yousef <qyousef@xxxxxxxxxxx>
Thank you so much for the review and feedback!
-john