[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250708185710.GD477119@noisy.programming.kicks-ass.net>
Date: Tue, 8 Jul 2025 20:57:10 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Dietmar Eggemann <dietmar.eggemann@....com>
Cc: mingo@...hat.com, juri.lelli@...hat.com, vincent.guittot@...aro.org,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
vschneid@...hat.com, clm@...a.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 12/12] sched: Add ttwu_queue support for delayed tasks
On Tue, Jul 08, 2025 at 02:44:56PM +0200, Dietmar Eggemann wrote:
> On 02/07/2025 13:49, Peter Zijlstra wrote:
>
> [...]
>
> > @@ -3801,6 +3839,52 @@ static inline bool ttwu_do_migrate(struc
> > return true;
> > }
> >
> > +static int ttwu_delayed(struct rq *rq, struct task_struct *p, int wake_flags,
> > + struct rq_flags *rf)
> > +{
> > + struct rq *p_rq = task_rq(p);
> > + int cpu;
> > +
> > + /*
> > + * Notably it is possible for on-rq entities to get migrated -- even
> > + * sched_delayed ones. This should be rare though, so flip the locks
> > + * rather than IPI chase after it.
> > + */
> > + if (unlikely(rq != p_rq)) {
> > + rq_unlock(rq, rf);
> > + p_rq = __task_rq_lock(p, rf);
> > + update_rq_clock(p_rq);
> > + }
> > +
> > + if (task_on_rq_queued(p))
> > + dequeue_task(p_rq, p, DEQUEUE_NOCLOCK | DEQUEUE_SLEEP | DEQUEUE_DELAYED);
> > +
> > + /*
> > + * NOTE: unlike the regular try_to_wake_up() path, this runs both
> > + * select_task_rq() and ttwu_do_migrate() while holding rq->lock
> > + * rather than p->pi_lock.
> > + */
> > + cpu = select_task_rq(p, p->wake_cpu, &wake_flags);
>
> There are 'lockdep_assert_held(&p->pi_lock)'s in select_task_rq() and
> select_task_rq_fair() which should trigger IMHO? Can they be changed the
> same way like __task_rq_lock()?
And not a single robot has yet reported this :-(.. Yeah, let me go look.
Seeing how this was performance stuff, I clearly did not run enough
lockdep builds :/
> > + if (ttwu_do_migrate(rq, p, cpu))
> > + wake_flags |= WF_MIGRATED;
>
> [...]
>
> > /*
> > --- a/kernel/sched/sched.h
> > +++ b/kernel/sched/sched.h
> > @@ -2280,6 +2280,7 @@ static inline int task_on_rq_migrating(s
> > #define WF_RQ_SELECTED 0x80 /* ->select_task_rq() was called */
> >
> > #define WF_ON_CPU 0x0100
>
> Looks like this is still not used. Not sure whether it can be removed or
> you wanted to add a condition for this as well?
Bah, I'm sure I deleted that at some point. Let me try killing it again
:-)
Powered by blists - more mailing lists