From: Eric Dumazet > Sent: 31 March 2017 14:25 > On Fri, 2017-03-31 at 11:47 +0200, Paolo Abeni wrote: > > In the udp_sock struct, the 'forward_deficit' and 'pcflag' fields > > share the same cacheline. While the first is dirtied by > > udp_recvmsg, the latter is read, possibly several times, by the > > bottom half processing to discriminate between udp and udplite > > sockets. > > > > With this patch, sk->sk_protocol is used to check is the socket is > > really an udplite one, avoiding some cache misses per > > packet and improving the performance under udp_flood with > > small packet up to 10%. ... > I am pretty sure we agreed in the past that forward_deficit would need > to be placed on a cache line of its own. Somehow we manage to not > implement this properly. > > What about other fields like encap_rcv, encap_destroy, gro_receive, > gro_complete. They really should have the same false sharing issue. > > Proper fix is : ... > - /* This field is dirtied by udp_recvmsg() */ > - int forward_deficit; > + /* This field is dirtied by udp_recvmsg(). > + * Make sure it wont share a cache line with prior fields. > + */ > + int forward_deficit ____cacheline_aligned_in_smp;
Is that really sensible on systems with large cache lines? David