On Wed, Dec 7, 2016, at 18:32, Eric Dumazet wrote: > On Wed, 2016-12-07 at 17:09 +0000, David Laight wrote: > > From: Paolo Abeni > > > Sent: 06 December 2016 17:08 > > ... > > > @@ -79,6 +82,9 @@ struct udp_sock { > > > int (*gro_complete)(struct sock *sk, > > > struct sk_buff *skb, > > > int nhoff); > > > + > > > + /* since we are prone to drops, avoid dirtying any sk cacheline */ > > > + atomic_t drops ____cacheline_aligned_in_smp; > > > }; > > > > Isn't that likely to create a large hole on systems with large cache lines. > > (Same as any other use of ____cacheline_aligned_in_smp.) > > Yes, I would like to avoid that, unless we come to the conclusion it is > absolutely needed. > > I feel that we could simply use a pointer, and allocate memory on > demand, since many sockets do not ever experience a drop. > > The pointer could stay in a read mostly section. > > We even could use per cpu or node counter for some heavy drop cases.
I had the same idea while discussing that with Paolo, merely using an *atomic_t = kmalloc(sizeof(atomic_t)) out of band of the socket. My fear was that those could be aggregated by the slab cache into one cache line, causing even more heating on cachelines. Bye, Hannes