Thread (3 messages) 3 messages, 2 authors, 2021-11-29

Re: can add a new bpf helper function bpf_map_compare_and_update_elem?

From: Cong Wang <hidden>
Date: 2021-11-26 20:30:41

On Thu, Nov 25, 2021 at 04:34:48PM +0800, Yahui Chen wrote:
Suppose we have a map, MAP_A, and the user program does the following:

1. bpf_map_lookup_elem(MAP_A, key, value)
2. change the value
3. bpf_map_update_elem(MAP_A, key, value, FLAG)

At the same time, the kernel's BPF program may also be modifying the value.

Then we have concurrency problems.
This is why we have bpf spinlock. ;)

Therefore, can we add a helper function like compare and swap?
I don't think you can atomically compare and swap values larger than
CPU word size.


Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help