On Thu, Feb 7, 2019 at 8:31 AM Иван Иванов <[email protected]> wrote:
>
> I use simple prog to get stat from my map type BPF_MAP_TYPE_HASH.
> An got too slow speed to delete elems from it, lookup elem 100-1000x faster.
> My code is just
>
> while(bpf_map_get_next_key(fd, &key,&nextkey)==0)
> bpf_map_lookup_elem(&nextkey,&value);
> bpf_map_delete_elem(fd, &nextkey);

It is not recommended to do delete() during get_next_key() loop.
The delete() may change kernel internal hash table structure
and get_next_key() may not function as expected.

You can do one loop with get_next_key() to get all the keys
and another loop to do deletions.

>
> whitout deleting code is very fast.
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#1565): https://lists.iovisor.org/g/iovisor-dev/message/1565
Mute This Topic: https://lists.iovisor.org/mt/29691280/21656
Group Owner: [email protected]
Unsubscribe: https://lists.iovisor.org/g/iovisor-dev/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to