BPF List
 help / color / mirror / Atom feed
* bpf: adding BPF linked list iteration support
@ 2024-11-19 12:22 Matt Bobrowski
  2024-11-21  0:51 ` Alexei Starovoitov
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Bobrowski @ 2024-11-19 12:22 UTC (permalink / raw)
  To: bpf; +Cc: ast, daniel, andrii, martin.lau, song, kpsingh, jolsa, memxor

Hi,

Currently, we have BPF kfuncs which allow BPF programs to add and
remove elements from a BPF linked list. However, we're currently
missing other simple capabilities, like being able to iterate over the
elements within the BPF linked lists. What is our current appetite
with regards to adding new BPF kfuncs that support this kind of
capability to BPF linked lists?

I know that we're now somewhat advocating for using BPF arenas
whenever and wherever possible, especially when it comes to building
out and supporting more complicated data structures in BPF. However,
IMO BPF linked lists still have their place. Specifically, and as of
now, I'd argue that the BPF linked list implementation could be
considered more memory efficient when compared to a BPF arena backed
linked list implementation. This is purely due to the fact that the
BPF linked list implementation can perform more constrained memory
allocations for elements via bpf_obj_new_impl() based on the demand,
whereas for a BPF arena based implementation a BPF program needs to
allocate memory upfront in terms of the number of pages (modulo the
fact that not all pages for the BPF arena will necessarily be reserved
upfront). The fact that allocations are performed in terms of
multiples of PAGE_SIZE can lead to unnecessary memory wastage.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-25 15:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-19 12:22 bpf: adding BPF linked list iteration support Matt Bobrowski
2024-11-21  0:51 ` Alexei Starovoitov
2024-11-22  9:12   ` Matt Bobrowski
2024-11-22 21:54     ` Alexei Starovoitov
2024-11-25 15:52       ` Matt Bobrowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox