From: Tejun Heo <tj@kernel.org>
To: David Vernet <void@manifault.com>,
Andrea Righi <arighi@nvidia.com>,
Changwoo Min <changwoo@igalia.com>
Cc: linux-kernel@vger.kernel.org, sched-ext@meta.com
Subject: Re: [PATCH sched_ext/for-6.14-fixes 2/2] sched_ext: Fix migration disabled handling in targeted dispatches
Date: Sat, 8 Feb 2025 20:33:48 -1000 [thread overview]
Message-ID: <Z6hMTDhikIpxTSzY@slm.duckdns.org> (raw)
In-Reply-To: <Z6Z0GgXetBRy1-X1@slm.duckdns.org>
On Fri, Feb 07, 2025 at 10:59:06AM -1000, Tejun Heo wrote:
> A dispatch operation that can target a specific local DSQ -
> scx_bpf_dsq_move_to_local() or scx_bpf_dsq_move() - checks whether the task
> can be migrated to the target CPU using task_can_run_on_remote_rq(). If the
> task can't be migrated to the targeted CPU, it is bounced through a global
> DSQ.
>
> task_can_run_on_remote_rq() assumes that the task is on a CPU that's
> different from the targeted CPU but the callers doesn't uphold the
> assumption and may call the function when the task is already on the target
> CPU. When such task has migration disabled, task_can_run_on_remote_rq() ends
> up returning %false incorrectly unnecessarily bouncing the task to a global
> DSQ.
>
> Fix it by updating the callers to only call task_can_run_on_remote_rq() when
> the task is on a different CPU than the target CPU. As this is a bit subtle,
> for clarity and documentation:
>
> - Make task_can_run_on_remote_rq() trigger SCHED_WARN_ON() if the task is on
> the same CPU as the target CPU.
>
> - is_migration_disabled() test in task_can_run_on_remote_rq() cannot trigger
> if the task is on a different CPU than the target CPU as the preceding
> task_allowed_on_cpu() test should fail beforehand. Convert the test into
> SCHED_WARN_ON().
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Fixes: 4c30f5ce4f7a ("sched_ext: Implement scx_bpf_dispatch[_vtime]_from_dsq()")
> Fixes: 0366017e0973 ("sched_ext: Use task_can_run_on_remote_rq() test in dispatch_to_local_dsq()")
> Cc: stable@vger.kernel.org # v6.12+
Applied 1-2 to sched_ext/for-6.14-fixes.
Thanks.
--
tejun
next prev parent reply other threads:[~2025-02-09 6:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 20:58 [PATCH sched_ext/for-6.14-fixes 1/2] sched_ext: Implement auto local dispatching of migration disabled tasks Tejun Heo
2025-02-07 20:59 ` [PATCH sched_ext/for-6.14-fixes 2/2] sched_ext: Fix migration disabled handling in targeted dispatches Tejun Heo
2025-02-09 6:33 ` Tejun Heo [this message]
2025-02-07 22:36 ` [PATCH sched_ext/for-6.14-fixes 1/2] sched_ext: Implement auto local dispatching of migration disabled tasks Andrea Righi
2025-02-07 22:44 ` Tejun Heo
2025-02-07 22:59 ` Andrea Righi
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=Z6hMTDhikIpxTSzY@slm.duckdns.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sched-ext@meta.com \
--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