|
|
Subscribe / Log in / New account

Better linked-list traversal in BPF

Better linked-list traversal in BPF

Posted Mar 8, 2024 16:52 UTC (Fri) by atnot (subscriber, #124910)
In reply to: Better linked-list traversal in BPF by pj
Parent article: Better linked-list traversal in BPF

If you're creating a dependency between the next address to access and the contents of the previous address, that's going to be bad regardless of whether you use indexes or pointers. BPF wouldn't like that either. You really just want a count and some data; that's trivial to analyze.

Allocating stuff together does make a big difference and you should definitely do it. But at that point you may as well just use the length and capacity values you have to store anyway to do a proper dynamic array. Then just swap elements in place or, if you must, have a separate table of indexes sorted by some other value, like in a hashtable. Or just use a well implemented tree or hash table outright. But really most of the time you don't need any of that.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds