From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Emil Tsalapatis" <emil@etsalapatis.com>, <bpf@vger.kernel.org>
Cc: <ast@kernel.org>, <andrii@kernel.org>, <memxor@gmail.com>,
<daniel@iogearbox.net>, <eddyz87@gmail.com>, <song@kernel.org>,
<mattbobrowski@google.com>
Subject: Re: [RESEND PATCH bpf-next 1/2] selftests/bpf: libarena: Add rbtree data structure
Date: Thu, 14 May 2026 17:08:49 -0700 [thread overview]
Message-ID: <DIITAO4S7XCK.2EUA3QLTEFGKM@gmail.com> (raw)
In-Reply-To: <20260511214100.9487-2-emil@etsalapatis.com>
On Mon May 11, 2026 at 2:40 PM PDT, Emil Tsalapatis wrote:
> Add a native red-black tree data structure to libarena.
> The data structure supports multiple APIs (key-value based,
> node based) with which users can query and modify it. The
> tree uses the libarena memory allocator to manage its data.
>
> Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>
> ---
> .../bpf/libarena/include/libarena/rbtree.h | 89 ++
> .../bpf/libarena/selftests/st_rbtree.bpf.c | 974 ++++++++++++++++
st_ is too obscure. Use test_ ?
> +SEC("syscall")
> +__weak int test_rbtree_insert_one(void)
None of these tests check parallel operations, right?
Let's add them and add the lock.
Not sure what's the point of lockless rbtree->freelist
when the whole thing still needs to be locked?
imo there is no point in single threaded primitives.
Only syscall prog can be single threaded. The rest run in parallel.
> + arena_stderr("WARNING: Attempting to allocate a node "
> + "for a NULL rbtree\n");
Don't split strings, since it's harder to grep for them.
It's ok that they're long and go over 80 or ever 100 chars.
> +__weak
> +int rb_print_pop_up(rbnode_t **rbnode, u8 *depthp, enum rb_print_state (*stack)[RB_MAXLVL_PRINT], enum rb_print_state *state)
> +{
> + volatile u8 depth;
> + int j;
> +
> + if (unlikely(!rbnode || !depthp || !stack || !state))
> + return -EINVAL;
> +
> + WRITE_ONCE(depth, *depthp);
WRITE_ONCE? what for?
next prev parent reply other threads:[~2026-05-15 0:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 21:40 [RESEND PATCH bpf-next 0/2] selftests/bpf: libarena: Add initial data structures Emil Tsalapatis
2026-05-11 21:40 ` [RESEND PATCH bpf-next 1/2] selftests/bpf: libarena: Add rbtree data structure Emil Tsalapatis
2026-05-11 22:24 ` bot+bpf-ci
2026-05-12 20:18 ` Emil Tsalapatis
2026-05-13 0:42 ` sashiko-bot
2026-05-15 0:08 ` Alexei Starovoitov [this message]
2026-05-11 21:41 ` [RESEND PATCH bpf-next 2/2] selftests/bpf: libarena: Add Lev-Chase queue " Emil Tsalapatis
2026-05-11 22:12 ` bot+bpf-ci
2026-05-12 20:20 ` Emil Tsalapatis
2026-05-13 2:23 ` sashiko-bot
2026-05-15 0:11 ` Alexei Starovoitov
2026-05-15 0:13 ` Alexei Starovoitov
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=DIITAO4S7XCK.2EUA3QLTEFGKM@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=mattbobrowski@google.com \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.