On Mon, Sep 14, 2020 at 11:47 AM Yonghong Song <y...@fb.com> wrote: > > Currently, we use bucket_lock when traversing bpf_sk_storage_map > elements. Since bpf_iter programs cannot use bpf_sk_storage_get() > and bpf_sk_storage_delete() helpers which may also grab bucket lock, > we do not have a deadlock issue which exists for hashmap when > using bucket_lock ([1]).
The paragraph above describes why we can use bucket_lock, which is more or less irrelevant to this change. Also, I am not sure why we refer to [1] here. > > If a bucket contains a lot of sockets, during bpf_iter traversing > a bucket, concurrent bpf_sk_storage_{get,delete}() may experience > some undesirable delays. Using rcu_read_lock() is a reasonable It will be great to include some performance comparison. > compromise here. Although it may lose some precision, e.g., > access stale sockets, but it will not hurt performance of other > bpf programs. > > [1] https://lore.kernel.org/bpf/20200902235341.2001534-1-...@fb.com > > Cc: Martin KaFai Lau <ka...@fb.com> > Signed-off-by: Yonghong Song <y...@fb.com> Other than these, Acked-by: Song Liu <songliubrav...@fb.com> [...]