From: Tejun Heo <tj@kernel.org>
To: Kuba Piecuch <jpiecuch@google.com>
Cc: David Vernet <void@manifault.com>,
Andrea Righi <arighi@nvidia.com>,
Changwoo Min <changwoo@igalia.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] sched/core: Preserve WF_RQ_SELECTED across queued wakeups
Date: Mon, 30 Nov 2026 06:55:34 -1000 [thread overview]
Message-ID: <aw2qhkq7hgv6fsP6@slm.duckdns.org> (raw)
In-Reply-To: <20261130130447.2225810-2-jpiecuch@google.com>
On Mon, Nov 30, 2026 at 01:05:57PM +0000, Kuba Piecuch wrote:
> ENQUEUE_RQ_SELECTED tells a sched_class that ->select_task_rq() was
> called for a task wakeup. sched_ext exposes this flag to BPF schedulers
> as SCX_ENQ_CPU_SELECTED.
>
> When a BPF scheduler sets SCX_OPS_ALLOW_QUEUED_WAKEUP, a wakeup can be
> delivered through the ttwu wakelist in two ways:
>
> 1) from the p->on_cpu path, before ->select_task_rq() is called. In this
> case WF_RQ_SELECTED is not set and SCX_ENQ_CPU_SELECTED is correctly
> clear;
>
> 2) from ttwu_queue(), after ->select_task_rq() has been called. In this
> case WF_RQ_SELECTED is set in wake_flags, but sched_ttwu_pending()
> only carries WF_MIGRATED across the wakelist, so the flag is dropped
> and ops.enqueue() is wrongly told that ops.select_cpu() was skipped.
> This also results in undercounting SCX_EV_SELECT_CPU_FALLBACK events.
>
> Fix case 2 by preserving WF_RQ_SELECTED across the wakelist in the same
> way WF_MIGRATED is, so that ttwu_do_activate() passes
> ENQUEUE_RQ_SELECTED to activate_task(). Case 1 is unaffected.
>
> Fixes: 3539c6411a7c ("sched_ext: Implement SCX_OPS_ALLOW_QUEUED_WAKEUP")
> Cc: stable@vger.kernel.org # v6.15+
> Acked-by: Tejun Heo <tj@kernel.org>
> Reviewed-by: Andrea Righi <arighi@nvidia.com>
> Signed-off-by: Kuba Piecuch <jpiecuch@google.com>
Peter, would it be okay to route this through sched_ext?
Thanks.
--
tejun
next prev parent reply other threads:[~2026-11-30 16:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 13:05 [PATCHSET v3 sched_ext/for-7.4-fixes] sched: Fix SCX_ENQ_CPU_SELECTED for " Kuba Piecuch
2026-11-30 13:05 ` [PATCH v3 1/2] sched/core: Preserve WF_RQ_SELECTED across " Kuba Piecuch
2026-11-30 16:55 ` Tejun Heo [this message]
2026-11-30 13:05 ` [PATCH v3 2/2] selftests/sched_ext: Test SCX_ENQ_CPU_SELECTED with " Kuba Piecuch
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=aw2qhkq7hgv6fsP6@slm.duckdns.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=jpiecuch@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sched-ext@lists.linux.dev \
--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
all inboxes | Powered by JetHome®