On Wed, 2016-03-23 at 15:36 -0700, Tom Herbert wrote: > This patches adds udp6_lib_lookup_skb_noref, udp4_lib_lookup_skb_noref > and related support to allow a caller to lookup a UDP socket > without automatically taking a reference. The lookup and caller > use of the socket must be done under rcu_read_lock. > > This feature will be used in a fast receive encapsulation path and > also when performing GRO through callout in the UDP socket. > > Signed-off-by: Tom Herbert <t...@herbertland.com> > ---
As already mentioned in the past, you can not do a UDP lookup without taking a reference, because we use SLAB_DESTROY_BY_RCU rules which are strict. Only taking a reference and re-doing the keys check can make sure the lookup result makes sense (as we check multiple words and there is no way it can be done atomically) This is explained in include/linux/slab.h and Documentation/RCU/rculist_nulls.txt If you want that to happen, we need first to not use SLAB_DESTROY_BY_RCU. Then, we do not need to take a reference at all, even for the regular UDP stack unicast receive path.