From: Kuba Piecuch <jpiecuch@google.com>
To: Andrea Righi <arighi@nvidia.com>, Kuba Piecuch <jpiecuch@google.com>
Cc: Tejun Heo <tj@kernel.org>, Changwoo Min <changwoo@igalia.com>,
David Vernet <void@manifault.com>,
<linux-kernel@vger.kernel.org>, <sched-ext@lists.linux.dev>
Subject: Re: [PATCH sched_ext/for-7.2] sched_ext: check remote rq eligibility under task's rq lock
Date: Fri, 19 Jun 2026 13:12:23 +0000 [thread overview]
Message-ID: <DJD1VLM0CHEK.3NG5X8N6D4AMT@google.com> (raw)
In-Reply-To: <ajTwP6tQxR_6UGsQ@gpd4>
Hi Andrea,
Thank you for the review!
On Fri Jun 19, 2026 at 7:31 AM UTC, Andrea Righi wrote:
> Looks good to me, but we should also update the "Cross-CPU Task Migration" doc
> in kernel/sched/ext_internal.h to be consistent with this change (see below if
> it makes sense to you).
>
> With that:
>
> Reviewed-by: Andrea Righi <arighi@nvidia.com>
>
> Thanks,
> -Andrea
>
> kernel/sched/ext_internal.h | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/sched/ext_internal.h b/kernel/sched/ext_internal.h
> index b76633c52c96a..b63d80ae21157 100644
> --- a/kernel/sched/ext_internal.h
> +++ b/kernel/sched/ext_internal.h
> @@ -1471,18 +1471,20 @@ static const char *scx_enable_state_str[] = {
> * The sched_ext core uses a "lock dancing" protocol coordinated by
> * p->scx.holding_cpu. When moving a task to a different rq:
> *
> - * 1. Verify task can be moved (CPU affinity, migration_disabled, etc.)
> - * 2. Set p->scx.holding_cpu to the current CPU
> - * 3. Set task state to %SCX_OPSS_NONE; dequeue waits while DISPATCHING
> + * 1. Set p->scx.holding_cpu to the current CPU
> + * 2. Set task state to %SCX_OPSS_NONE; dequeue waits while DISPATCHING
> * is set, so clearing DISPATCHING first prevents the circular wait
> * (safe to lock the rq we need)
> - * 4. Unlock the current CPU's rq
> - * 5. Lock src_rq (where the task currently lives)
> - * 6. Verify p->scx.holding_cpu == current CPU, if not, dequeue won the
> + * 3. Unlock the current CPU's rq
> + * 4. Lock src_rq (where the task currently lives)
> + * 5. Verify p->scx.holding_cpu == current CPU, if not, dequeue won the
> * race (dequeue clears holding_cpu to -1 when it takes the task), in
> * this case migration is aborted
> - * 7. If src_rq == dst_rq: clear holding_cpu and enqueue directly
> + * 6. If src_rq == dst_rq: clear holding_cpu and enqueue directly
> * into dst_rq's local DSQ (no lock swap needed)
> + * 7. Otherwise, verify under src_rq that the task can be moved to dst_rq
> + * (CPU affinity, migration_disabled, etc.). If not, clear holding_cpu
> + * and enqueue the task on the fallback DSQ on src_rq.
> * 8. Otherwise: call move_remote_task_to_local_dsq(), which releases
> * src_rq, locks dst_rq, and performs the deactivate/activate
> * migration cycle (dst_rq is held on return)
>
Absolutely, will send a v2 shortly that includes the documentation change.
Thanks,
Kuba
prev parent reply other threads:[~2026-06-19 13:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 17:00 [PATCH sched_ext/for-7.2] sched_ext: check remote rq eligibility under task's rq lock Kuba Piecuch
2026-06-19 7:31 ` Andrea Righi
2026-06-19 13:12 ` Kuba Piecuch [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=DJD1VLM0CHEK.3NG5X8N6D4AMT@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