From: Tejun Heo <tj@kernel.org>
To: Changwoo Min <changwoo@igalia.com>, Gavin Guo <gavinguo@igalia.com>
Cc: David Vernet <void@manifault.com>,
Andrea Righi <arighi@nvidia.com>,
kernel-dev@igalia.com, sched-ext@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] compat.bpf.h: Gate scx_bpf_dsq_peek kfunc behind kernel version 7.1.0
Date: Mon, 17 Aug 2026 07:41:18 -1000 [thread overview]
Message-ID: <ea4d0262ca08706b2c3b0cb4eaaf3ad5@kernel.org> (raw)
In-Reply-To: <20260817143126.562923-2-changwoo@igalia.com>
Hello,
On Mon, Aug 17, 2026 at 11:31:25PM +0900, Changwoo Min wrote:
> __COMPAT_scx_bpf_dsq_peek() selects the lockless kfunc whenever the
> symbol resolves in the kernel BTF. However, its lockless implementation
> could return a stale task_struct pointer. The stale pointer issues are
> resolved only after v7.1 kernel with the following patches:
>
> commit 2f2ea7709266 ("sched_ext: Use dsq->first_task instead of list_empty() in dispatch_enqueue() FIFO-tail")
> commit 71d7847cad44 ("sched_ext: Fix scx_bpf_dsq_peek() with FIFO DSQs")
71d7847cad44 shipped in v6.19 together with the peek API itself, so every
mainline release that has the kfunc already has it. Only 2f2ea7709266 is
new in v7.1, and what it fixes on v6.19/v7.0 is scx_bpf_dsq_peek()
spuriously returning NULL on a non-empty FIFO DSQ, not stale pointers.
The gate itself looks fine but can you update the description and the
comment so that they describe what the gate is actually avoiding?
> + * The kfunc exists on earlier kernels but its lockless implementation could
> + * return stale task pointers. Require kernel version >= 7.1.0 before calling
> + * it; otherwise fall through to the bpf_iter_scx_dsq fallback below.
> + *
> */
Also, the edit leaves a dangling " *" line before the closing "*/".
Thanks.
--
tejun
next prev parent reply other threads:[~2026-08-17 17:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 14:31 [PATCH 0/2] sched_ext: sync compat.bpf.h peek/reenqueue fixes from sched-ext/scx Changwoo Min
2026-08-17 14:31 ` [PATCH 1/2] compat.bpf.h: Gate scx_bpf_dsq_peek kfunc behind kernel version 7.1.0 Changwoo Min
2026-08-17 17:41 ` Tejun Heo [this message]
2026-08-17 14:31 ` [PATCH 2/2] compat.bpf.h: add scx_bpf_reenqueue_local_from_anywhere() compat helper Changwoo Min
2026-08-17 17:41 ` 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=ea4d0262ca08706b2c3b0cb4eaaf3ad5@kernel.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=gavinguo@igalia.com \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.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