From: Mel Gorman <mgorman@techsingularity.net>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Seiji Nishikawa <snishika@redhat.com>,
Mian Yousaf Kaukab <ykaukab@suse.de>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] sched/rt: Do not account migrate-disabled tasks as pushable
Date: Thu, 12 Nov 2026 22:35:21 +0000 [thread overview]
Message-ID: <avYpbK0s8vdbocyt@techsingularity.net> (raw)
In-Reply-To: <20261112153120.GU1779021@noisy.programming.kicks-ass.net>
On Thu, Nov 12, 2026 at 04:31:20PM +0100, Peter Zijlstra wrote:
> On Thu, Nov 12, 2026 at 02:17:29PM +0000, Mel Gorman wrote:
>
> > 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
>
> Is there any down-side from unconditionally having that
> is_migration_disabled() test there?
>
It's a simple check of p->migration_disabled so compute-wise it's simple. It
might incur a cache miss that may not be already fetched if nothing else
prior contended on a spin lock. On !PREEMPT_RT, the static branch should
hide it by default so it's a PREEMPT_RT-specific hazard.
> > plist_del(&p->pushable_tasks, &rq->rt.pushable_tasks);
> > plist_node_init(&p->pushable_tasks, p->prio);
> > plist_add(&p->pushable_tasks, &rq->rt.pushable_tasks);
> > @@ -1448,7 +1455,7 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int flags)
> > if (task_is_blocked(p))
> > return;
> >
> > - if (!task_current(rq, p) && p->nr_cpus_allowed > 1)
> > + if (!task_current(rq, p))
> > enqueue_pushable_task(rq, p);
> > }
> >
> > @@ -1746,7 +1753,7 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p, struct task_s
> > * The previous task needs to be made eligible for pushing
> > * if it is still active
> > */
> > - if (on_rt_rq(&p->rt) && p->nr_cpus_allowed > 1)
> > + if (on_rt_rq(&p->rt))
> > enqueue_pushable_task(rq, p);
> > }
>
> And can I ask you to do the same to DL ? Where possible we try and keep
> them in-sync.
I can move the "p->nr_cpus_allowed > 1" check and I think that's what you
are referring to.
I cannot add the is_migration_disabled() to match as deadline does not
have a mechanism equivalent to RT_PUSH_IPI. Adding migration_disabled
check anyway damages pull_dl_task in a way that is difficult to detect
e.g. if a runqueue has multiple runnable tasks with earlier deadlines and 1
migrate-disabled then the 2 tasks can be left competing (side-effect benefit
but still). Worse, sometimes adding it would work better -- a running task
with an earlier deadline but sufficient time to complete is left alone if
the rq is shared with a migrate-disabled task and hidden as a push candidate.
V3 will follow shortly.
--
Mel Gorman
SUSE Labs
prev parent reply other threads:[~2026-11-12 22:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 14:17 [PATCH v2] sched/rt: Do not account migrate-disabled tasks as pushable Mel Gorman
2026-11-12 15:31 ` Peter Zijlstra
2026-11-12 22:35 ` Mel Gorman [this message]
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=avYpbK0s8vdbocyt@techsingularity.net \
--to=mgorman@techsingularity.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.