Re: [PATCH net-next v5 2/3] udp: implement memory accounting helpers

2016-10-21 Thread Paolo Abeni
On Thu, 2016-10-20 at 14:10 -0700, Eric Dumazet wrote: > On Thu, 2016-10-20 at 22:31 +0200, Paolo Abeni wrote: > > > + > > +int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb) > > +{ > > + struct sk_buff_head *list = &sk->sk_receive_queue; > > + int rmem, delta, amt, err = -EN

Re: [PATCH net-next v5 2/3] udp: implement memory accounting helpers

2016-10-20 Thread Eric Dumazet
On Thu, 2016-10-20 at 22:31 +0200, Paolo Abeni wrote: > + > +int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb) > +{ > + struct sk_buff_head *list = &sk->sk_receive_queue; > + int rmem, delta, amt, err = -ENOMEM; > + int size = skb->truesize; > + > + /* try to avo

[PATCH net-next v5 2/3] udp: implement memory accounting helpers

2016-10-20 Thread Paolo Abeni
Avoid using the generic helpers. Use the receive queue spin lock to protect the memory accounting operation, both on enqueue and on dequeue. On dequeue perform partial memory reclaiming, trying to leave a quantum of forward allocated memory. On enqueue use a custom helper, to allow some optimizat