mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Mel Gorman <mgorman@techsingularity.net>
Cc: Ingo Molnar <mingo@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Seiji Nishikawa <snishika@redhat.com>,
	Mian Yousaf Kaukab <ykaukab@suse.de>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] sched/rt: Do not account migrate-disabled tasks as pushable
Date: Tue, 17 Nov 2026 16:24:14 +0100	[thread overview]
Message-ID: <20261117152414.GG1922751@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20261117152026.GI1813469@noisy.programming.kicks-ass.net>

On Tue, Nov 17, 2026 at 04:20:26PM +0100, Peter Zijlstra wrote:
> On Fri, Nov 13, 2026 at 04:06:55PM +0000, Mel Gorman wrote:
> 
> > As above, the runqueue is still marked overloaded by enqueue_task_rt()
> > and put_prev_task_rt() even if the task is migrate-disabled. A
> > migrate-disabled task reaches the pushable list through enqueue_task_rt()
> > or put_prev_task_rt() when it is preempted, or when it wakes while
> > still migrate-disabled. Either path calls enqueue_pushable_task() to set
> > rq->rt.overloaded and rto_mask if unset. Once set, every pull from another
> > CPU that fires an IPI may only find migrate-disabled tasks rendering the IPI
> > useless for a condition that was detectable when placed on the pushable list.
> > 
> > Stop adding migrate-disabled tasks to the pushable list if RT_PUSH_IPI is
> > enabled. This is not a heuristic as migrate-disabled tasks cannot move. Even
> > when migration is enabled, the rq still has no pushable candidates until the
> > task schedules. The !RT_PUSH_IPI behaviour is preserved and migrate-disabled
> > tasks are added to the pushable list. Without IPI, the alternative path in
> > pull_rt_task() must find runqueues with off-CPU migrate-disabled tasks. It
> > can then push the running task away allowing the migrate-disabled task
> > to run.
> 
> Last time I either didn't notice, or I've gone dumb from staring at perf
> issues all day, but I'm not entirely sure I understand how we get here.
> 
> Suppose:
> 
>   migrate_disable();
>   ...
>   schedule()
>     migrate_disable_switch()
>       // switches p->cpus_ptr and p->nr_cpus_allowed
>     pick_next_task()
>       p = class->pick_task();
>       put_prev_set_next_task(rq, rq->donor, p);
>       return p;
> 
> So any task that ends up in put_prev_task_rt() wlll have passed through
> migrate_disable_switch(), which have updated nr_cpus_allowed.
> 
> Or so my current thinking goes. You seeing this patch make a difference,
> seems to suggest I'm missing something, but I couldn't spot it in that
> wall of text.

Ah, is the sched_change pattern the clue? I'm thinking that RT might hit
that more than usual due to the PI path.

In that case we do indeed end up in put_prev_task() / set_next_task()
without going through schedule(). In that case the task would be on the
pushable list during the change, HOWEVER we should hold rq->lock (which
implies have IRQs disabled) over the entire thing, so again, I'm not
sure how this is then observable.

> Anyway, I'm still not sure why we can't just write:
> 
> > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> > index 1535046a23ff..bb640278d30e 100644
> > --- a/kernel/sched/rt.c
> > +++ b/kernel/sched/rt.c
> > @@ -396,6 +396,13 @@ static inline void rt_queue_pull_task(struct rq *rq)
> >  
> >  static void enqueue_pushable_task(struct rq *rq, struct task_struct *p)
> >  {
> > +	if (p->nr_cpus_allowed <= 1)
> > +		return;
> > +#ifdef HAVE_RT_PUSH_IPI
> > +	if (sched_feat(RT_PUSH_IPI) && is_migration_disabled(p))
> > +		return;
> > +#endif
> > + 
> 
> 	if (p->nr_cpus_allowed <= 1 || is_migration_disabled(p))
> 		return;
> 
> for both RT and DL. Sure, we might get an extra load, but is that really
> going to be noticable? Lots of scheduler code already looks at the
> migrate disable thing anyway.
> 
> I don't see why it should depend on RT_PUSH_IPI, it never is actually
> migratable, and so it never makes sense to have on the pushable list.
> 
> But perhaps I'm missing something; the above seems to suggest that is a
> theme today.

  reply	other threads:[~2026-11-17 15:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 16:06 Mel Gorman
2026-11-17 14:27 ` Mel Gorman
2026-11-17 15:10   ` Peter Zijlstra
2026-11-17 15:20 ` Peter Zijlstra
2026-11-17 15:24   ` Peter Zijlstra [this message]
2026-11-17 15:25   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261117152414.GG1922751@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@techsingularity.net \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=snishika@redhat.com \
    --cc=vincent.guittot@linaro.org \
    --cc=ykaukab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®