Re: [PATCH bpf-next v3] bpf: using rcu_read_lock for bpf_sk_storage_map iterator

2020-09-17 Thread Yonghong Song
On 9/16/20 10:55 AM, Martin KaFai Lau wrote: On Tue, Sep 15, 2020 at 11:16:49PM -0700, Yonghong Song wrote: [ ... ] diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index 4a86ea34f29e..d43c3d6d0693 100644 --- a/net/core/bpf_sk_storage.c +++ b/net/core/bpf_sk_storage.c @@ -6

Re: [PATCH bpf-next v3] bpf: using rcu_read_lock for bpf_sk_storage_map iterator

2020-09-17 Thread Martin KaFai Lau
On Tue, Sep 15, 2020 at 11:16:49PM -0700, Yonghong Song wrote: [ ... ] > diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c > index 4a86ea34f29e..d43c3d6d0693 100644 > --- a/net/core/bpf_sk_storage.c > +++ b/net/core/bpf_sk_storage.c > @@ -678,6 +678,7 @@ struct bpf_iter_seq_sk_sto

[PATCH bpf-next v3] bpf: using rcu_read_lock for bpf_sk_storage_map iterator

2020-09-15 Thread Yonghong Song
If a bucket contains a lot of sockets, during bpf_iter traversing a bucket, concurrent userspace bpf_map_update_elem() and bpf program bpf_sk_storage_{get,delete}() may experience some undesirable delays as they will compete with bpf_iter for bucket lock. Note that the number of buckets for bpf_sk