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 2/2] selftests/bpf: libarena: Add Lev-Chase queue data structure
Date: Thu, 14 May 2026 17:13:29 -0700 [thread overview]
Message-ID: <DIITE8M75CDS.2BU9SNYAPDV8A@gmail.com> (raw)
In-Reply-To: <20260511214100.9487-3-emil@etsalapatis.com>
On Mon May 11, 2026 at 2:41 PM PDT, Emil Tsalapatis wrote:
> Expand libarena with a Lev-Chase deque data structure. This is a single
> producer, multiple consumer lockless queue that permits efficient
> work stealing. The structure is lock-free and wait-free to minimize
> overhead.
>
> The data structure exposes three main calls. two of them are available to
> the thread owning the queue and one available to all threads in the program:
>
> lvqueue_owner_push(): Push an item to the top of the lvqueue.
> lvqueue_owner_pop(): Pop an item from the top of the lvqueue.
> lvqueue_steal(): Steal a thread from the bottom of the lvqueue from
> any thread.
>
> Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>
> ---
> .../bpf/libarena/include/libarena/lvqueue.h | 33 +++
> .../bpf/libarena/selftests/st_lvqueue.bpf.c | 194 ++++++++++++++
> .../selftests/bpf/libarena/src/lvqueue.bpf.c | 241 ++++++++++++++++++
> 3 files changed, 468 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/libarena/include/libarena/lvqueue.h
> create mode 100644 tools/testing/selftests/bpf/libarena/selftests/st_lvqueue.bpf.c
> create mode 100644 tools/testing/selftests/bpf/libarena/src/lvqueue.bpf.c
>
> diff --git a/tools/testing/selftests/bpf/libarena/include/libarena/lvqueue.h b/tools/testing/selftests/bpf/libarena/include/libarena/lvqueue.h
> new file mode 100644
> index 000000000000..c4091387c7a1
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/libarena/include/libarena/lvqueue.h
> @@ -0,0 +1,33 @@
> +/* SPDX-License-Identifier: LGPL-2.1 OR BSD-2-Clause */
> +
> +#pragma once
> +
> +struct lv_arr;
> +
> +#define LV_ARR_BASESZ 128
> +#define LV_ARR_ORDERS 10
> +
> +struct lv_arr {
> + u64 __arena *data;
> + u64 order;
> +};
> +
> +typedef volatile struct lv_arr __arena lv_arr_t;
> +
> +struct lv_queue {
> + lv_arr_t *cur;
> + volatile u64 top;
> + volatile u64 bottom;
> + struct lv_arr arr[LV_ARR_ORDERS];
> +};
> +
> +typedef struct lv_queue __arena lv_queue_t;
> +
> +int lvq_owner_push(lv_queue_t *lvq, u64 val);
> +int lvq_owner_pop(lv_queue_t *lvq, u64 *val);
> +int lvq_steal(lv_queue_t *lvq, u64 *val);
One more thing.
I feel the actual alogrithm name doesn't need to be in the name.
Maybe
spmc_queue_push()
spmc_queue_pop()
?
prev parent reply other threads:[~2026-05-15 0:13 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
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 [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=DIITE8M75CDS.2BU9SNYAPDV8A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox