From: Kuba Piecuch <jpiecuch@google.com>
To: Tejun Heo <tj@kernel.org>, Kuba Piecuch <jpiecuch@google.com>
Cc: Cheng-Yang Chou <yphbchou0911@gmail.com>,
Andrea Righi <arighi@nvidia.com>,
David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
Emil Tsalapatis <emil@etsalapatis.com>,
Christian Loehle <christian.loehle@arm.com>,
Daniel Hodges <hodgesd@meta.com>, <sched-ext@lists.linux.dev>,
<linux-kernel@vger.kernel.org>,
Ching-Chun Huang <jserv@ccns.ncku.edu.tw>,
Chia-Ping Tsai <chia7712@gmail.com>
Subject: Re: [PATCH v2 sched_ext/for-7.1] sched_ext: Invalidate dispatch decisions on CPU affinity changes
Date: Tue, 05 May 2026 09:13:57 +0000 [thread overview]
Message-ID: <DIAMMLYHMK8R.2B472NGCJEKP5@google.com> (raw)
In-Reply-To: <afmq4DtGZcf4Zh5D@slm.duckdns.org>
On Tue May 5, 2026 at 8:31 AM UTC, Tejun Heo wrote:
> Hello, Kuba.
>
> On Tue, May 05, 2026 at 08:01:58AM +0000, Kuba Piecuch wrote:
>> Could you elaborate a bit on what you mean by "properly synchronized" here?
>
> If ops.dequeue() synchronizes with the dispatch path so that the task being
> dequeued is either dequeued or dispatched, there's nothing else to protect.
> If ops.dequeue() wins, the task won't be dispatched. If ops.dequeue() loses,
> the task should already be in either the dispatch buffer or local DSQ and
> the kernel dequeue code will shoot them down. In the former case, at the
> dispatch buffer flush time, the task would either be already dequeued or
> re-enqueued with a different qseq and ignored. In the latter,
> dispatch_dequeue() would remove it from the local DSQ.
I see, makes sense. Thanks!
>> On another, slightly related note: I'm considering making scx_bpf_dsq_insert()
>> and other dispatch-related kfuncs that manipulate only CPU-local state
>> callable while holding BPF spinlocks. This is something that the comment above
>> scx_bpf_dsq_insert() explicitly mentions:
>>
>> This function doesn't have any locking restrictions and may be called under
>> BPF locks (in the future when BPF introduces more flexible locking).
>>
>> I'm not sure what "more flexible locking" means here, but this can be
>> accomplished by simply adding the kfuncs to the list of kfuncs callable under
>> spinlocks in the BPF verifier.
>>
>> Are you aware of any previous work on this? Any pushback from BPF folks?
>
> That comment was written before bpf_spinlock was introduced. Please feel
> free to allow thoes functions under bpf spinlocks. BTW, there's also arena
> spinlock that is implemented in BPF proper, which is already used by
> multiple schedulers and likely to be the default option in the future:
>
> https://github.com/sched-ext/scx/blob/main/scheds/include/bpf_arena_spin_lock.h
Ah, interesting, I didn't know there's a pure-BPF implementation of spinlocks!
I haven't really had the chance to play around with arenas yet, looks like I'm
missing out ;-)
Thanks,
Kuba
next prev parent reply other threads:[~2026-05-05 9:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 8:35 [PATCH v2 sched_ext/for-7.1] sched_ext: Invalidate dispatch decisions on CPU affinity changes Andrea Righi
2026-03-19 10:31 ` Kuba Piecuch
2026-03-19 13:54 ` Kuba Piecuch
2026-03-19 21:09 ` Andrea Righi
2026-03-20 9:18 ` Kuba Piecuch
2026-03-23 23:13 ` Tejun Heo
2026-04-22 6:33 ` Cheng-Yang Chou
2026-04-22 11:02 ` Andrea Righi
2026-04-23 13:32 ` Kuba Piecuch
2026-04-26 1:47 ` Cheng-Yang Chou
2026-04-27 9:06 ` Kuba Piecuch
2026-05-01 16:19 ` Cheng-Yang Chou
2026-05-04 8:00 ` Kuba Piecuch
2026-05-04 21:24 ` Tejun Heo
2026-05-04 21:58 ` Andrea Righi
2026-05-05 8:35 ` Cheng-Yang Chou
2026-05-05 8:01 ` Kuba Piecuch
2026-05-05 8:31 ` Tejun Heo
2026-05-05 9:13 ` Kuba Piecuch [this message]
2026-05-05 15:14 ` Tejun Heo
2026-03-19 15:18 ` Kuba Piecuch
2026-03-19 19:01 ` 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=DIAMMLYHMK8R.2B472NGCJEKP5@google.com \
--to=jpiecuch@google.com \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=chia7712@gmail.com \
--cc=christian.loehle@arm.com \
--cc=emil@etsalapatis.com \
--cc=hodgesd@meta.com \
--cc=jserv@ccns.ncku.edu.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=void@manifault.com \
--cc=yphbchou0911@gmail.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