From: Kuba Piecuch <jpiecuch@google.com>
To: Tejun Heo <tj@kernel.org>, Kuba Piecuch <jpiecuch@google.com>
Cc: Andrea Righi <arighi@nvidia.com>,
Changwoo Min <changwoo@igalia.com>,
David Vernet <void@manifault.com>,
<linux-kernel@vger.kernel.org>, <sched-ext@lists.linux.dev>
Subject: Re: SCX_ENQ_IMMED potentially leaving dispatched tasks lingering on local DSQs
Date: Thu, 23 Apr 2026 09:48:11 +0000 [thread overview]
Message-ID: <DI0FTX13UW17.1IZJ9TMG9EFRA@google.com> (raw)
In-Reply-To: <aej8cmhZVhsqogr4@slm.duckdns.org>
Hi Tejun,
On Wed Apr 22, 2026 at 4:50 PM UTC, Tejun Heo wrote:
> Hello, Kuba.
>
> On Wed, Apr 22, 2026 at 01:21:27PM +0000, Kuba Piecuch wrote:
>> diff --git i/kernel/sched/ext.c w/kernel/sched/ext.c
>> index d66fea57ee69..480627fdc203 100644
>> --- i/kernel/sched/ext.c
>> +++ w/kernel/sched/ext.c
>> @@ -3079,8 +3079,11 @@ do_pick_task_scx(struct rq *rq, struct rq_flags *rf, bool force_scx)
>> * If @force_scx is true, always try to pick a SCHED_EXT task,
>> * regardless of any higher-priority sched classes activity.
>> */
>> - if (!force_scx && rq_modified_above(rq, &ext_sched_class))
>> + if (!force_scx && rq_modified_above(rq, &ext_sched_class)) {
>> + if (rq->scx.nr_immed)
>> + schedule_reenq_local(rq, 0);
>> return RETRY_TASK;
>> + }
>>
>> keep_prev = rq->scx.flags & SCX_RQ_BAL_KEEP;
>> if (unlikely(keep_prev &&
>
> Ah, good catch.
>
>> ...but I think this only fixes the case where the RT task wakes up on the CPU
>> that is doing the dispatch. The other case is one where the RT task wakes up
>> on the remote CPU (the one the second task was dispatched to) after insertion
>> of the second task, assuming the remote CPU is initially idle.
>>
>> To fix both cases, one potential solution that comes to mind is bumping
>> rq->next_class to &ext_sched_class when inserting a task into rq->scx.local_dsq.
>> Perhaps we should call wakeup_preempt() in dispatch_to_local_dsq()?
>
> I think what's missing is wakeup_preempt() call in
> move_remote_task_to_local_dsq(). This is SCX's version of move_queued_task()
> and we're missing wakeup_preempt() call after activate_task().
I'm not sure if we should limit ourselves to just remote tasks.
If we call wakeup_preempt(rq, p, flags) when adding @p to @rq's local DSQ
regardless of whether @p/@rq is remote, then I think that should cover all
cases and the patch above wouldn't be needed.
Perhaps local_dsq_post_enq() would be a good place to invoke wakeup_preempt()?
Thanks,
Kuba
next prev parent reply other threads:[~2026-04-23 9:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-22 13:21 SCX_ENQ_IMMED potentially leaving dispatched tasks lingering on local DSQs Kuba Piecuch
2026-04-22 16:50 ` Tejun Heo
2026-04-23 9:48 ` Kuba Piecuch [this message]
2026-04-23 16:53 ` Tejun Heo
2026-04-23 19:12 ` Kuba Piecuch
2026-04-23 19:29 ` Tejun Heo
2026-04-23 20:03 ` Kuba Piecuch
2026-04-23 21:57 ` Tejun Heo
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=DI0FTX13UW17.1IZJ9TMG9EFRA@google.com \
--to=jpiecuch@google.com \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=void@manifault.com \
/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