From: "Emil Tsalapatis" <emil@etsalapatis.com>
To: "Changwoo Min" <changwoo@igalia.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Shuah Khan" <shuah@kernel.org>,
"Emil Tsalapatis" <emil@etsalapatis.com>
Cc: "Martin KaFai Lau" <martin.lau@linux.dev>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Jiri Olsa" <jolsa@kernel.org>,
"Ihor Solodrai" <ihor.solodrai@linux.dev>, <david.dai@linux.dev>,
"Gavin Guo" <gavinguo@igalia.com>, <bpf@vger.kernel.org>,
<sched-ext@lists.linux.dev>, <linux-kselftest@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <kernel-dev@igalia.com>
Subject: Re: [PATCH bpf-next v3 0/3] selftests/bpf: libarena: Add ordered-walk and lockless-peek support to the rbtree
Date: Thu, 12 Nov 2026 07:05:07 +0000 [thread overview]
Message-ID: <DMT1I0RRNARI.1LTPB6JPWY4E9@etsalapatis.com> (raw)
In-Reply-To: <20261111100951.230730-1-changwoo@igalia.com>
On Wed Nov 11, 2026 at 10:09 AM UTC, Changwoo Min wrote:
> A sched_ext scheduler can build a task queue on libarena's rbtree, keyed
> by vtime, in place of a vtime-ordered DSQ. Such a queue needs three things
> the tree lacks. This series adds them:
>
> - Serve equal keys in insertion order, as vtime-ordered DSQs do (1/3).
> - Add rb_next(), so that a consumer can walk past tasks it cannot run
> in key order (2/3).
> - Cache the leftmost node and the node count, so that other CPUs can
> peek at the head and the length without the writer's lock, like
> scx_bpf_dsq_peek() and scx_bpf_dsq_nr_queued(). Add rb_init() and
> rb_fini() for a tree embedded in another object (3/3).
>
> Each patch adds selftests, which run with:
>
> $> ./test_progs -t 'libarena/test_rbtree*'
Hi Changwoo,
feel free to keep my:
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
(though I didn't add them myself to v1's patches 2 and 3,
I assume transcription error?)
>
> Changes in v3:
> - Make the lockless readers static inline. A plain static function in
> a header fails -Wunused-function under -Werror in a file that does
> not call it (bot+bpf-ci, 3/3).
>
> Changes in v2:
> - Drop the comment on the insert helper and keep the name
> rbnode_least_upper_bound() (Emil, 1/3).
> - Move rb_next() before the caching patch and into rbtree.bpf.c with the
> other traversal functions (Alexei, Emil, 2/3).
> - Hand the head to its successor at the top of rb_node_remove(), before
> an RB_ALLOC tree frees the node, so that a lockless reader never sees a
> freed head. This drops the wrapper, was_first and the rename to
> rbnode_remove() (Alexei, 3/3).
> - Drop the cache line alignment of the lockless fields, which showed no
> measurable benefit (Alexei, 3/3).
> - Rename the lockless readers to rb_first_lockless(),
> rb_first_key_lockless() and rb_nr_nodes_lockless(), and document that
> a caller that dereferences the head must keep the node valid itself
> (Emil, 3/3).
> - Drop __always_inline from static functions (Emil, 3/3).
> - Add Reviewed-by tags from Alexei and Emil.
> - Rebase on bpf-next.
>
> v2: https://lore.kernel.org/bpf/20261111073416.203153-1-changwoo@igalia.com/
> v1: https://lore.kernel.org/bpf/20261028060046.549097-1-changwoo@igalia.com/
>
> Changwoo Min (3):
> selftests/bpf: libarena: Order equal rbtree keys FIFO
> selftests/bpf: libarena: Add rb_next()
> selftests/bpf: libarena: Cache the rbtree's leftmost node and count
>
> .../bpf/libarena/include/libarena/rbtree.h | 57 +++-
> .../bpf/libarena/selftests/test_rbtree.bpf.c | 303 ++++++++++++++++++
> .../selftests/bpf/libarena/src/rbtree.bpf.c | 120 +++++--
> 3 files changed, 457 insertions(+), 23 deletions(-)
>
>
> base-commit: 0fb18ce8a2e9de830433923cf65838933d615359
prev parent reply other threads:[~2026-11-12 7:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 10:09 Changwoo Min
2026-11-11 10:09 ` [PATCH bpf-next v3 1/3] selftests/bpf: libarena: Order equal rbtree keys FIFO Changwoo Min
2026-11-11 10:09 ` [PATCH bpf-next v3 2/3] selftests/bpf: libarena: Add rb_next() Changwoo Min
2026-11-11 10:09 ` [PATCH bpf-next v3 3/3] selftests/bpf: libarena: Cache the rbtree's leftmost node and count Changwoo Min
2026-11-12 7:05 ` Emil Tsalapatis [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=DMT1I0RRNARI.1LTPB6JPWY4E9@etsalapatis.com \
--to=emil@etsalapatis.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=changwoo@igalia.com \
--cc=daniel@iogearbox.net \
--cc=david.dai@linux.dev \
--cc=eddyz87@gmail.com \
--cc=gavinguo@igalia.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=sched-ext@lists.linux.dev \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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®