bpf: sockmap, hash table is RCU so readers do not need locks
authorJohn Fastabend <john.fastabend@gmail.com>
Thu, 5 Jul 2018 15:06:01 +0000 (08:06 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 7 Jul 2018 22:16:58 +0000 (15:16 -0700)
This removes locking from readers of RCU hash table. Its not
necessary.

Fixes: 81110384441a ("bpf: sockmap, add hash map support")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/sockmap.c

index 3847a7ce7daeb9046c0a87db2adeb3472096d7b0..00fb2e328d1b0c56c2d79e8ab50f4d8aae84b491 100644 (file)
@@ -2467,10 +2467,8 @@ struct sock  *__sock_hash_lookup_elem(struct bpf_map *map, void *key)
        b = __select_bucket(htab, hash);
        head = &b->head;
 
-       raw_spin_lock_bh(&b->lock);
        l = lookup_elem_raw(head, hash, key, key_size);
        sk = l ? l->sk : NULL;
-       raw_spin_unlock_bh(&b->lock);
        return sk;
 }