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

2016-09-23 Thread Paolo Abeni
On Thu, 2016-09-22 at 13:34 -0700, Eric Dumazet wrote: > On Thu, 2016-09-22 at 22:27 +0200, Paolo Abeni wrote: > > On Thu, 2016-09-22 at 09:30 -0700, Eric Dumazet wrote: > > > On Thu, 2016-09-22 at 18:14 +0200, Paolo Abeni wrote: > > > > > > > I think that the idea behind using atomic ops directly

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

2016-09-22 Thread Eric Dumazet
On Thu, 2016-09-22 at 13:34 -0700, Eric Dumazet wrote: > On Thu, 2016-09-22 at 22:27 +0200, Paolo Abeni wrote: > > On Thu, 2016-09-22 at 09:30 -0700, Eric Dumazet wrote: > > > On Thu, 2016-09-22 at 18:14 +0200, Paolo Abeni wrote: > > > > > > > I think that the idea behind using atomic ops directly

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

2016-09-22 Thread Eric Dumazet
On Thu, 2016-09-22 at 22:27 +0200, Paolo Abeni wrote: > On Thu, 2016-09-22 at 09:30 -0700, Eric Dumazet wrote: > > On Thu, 2016-09-22 at 18:14 +0200, Paolo Abeni wrote: > > > > > I think that the idea behind using atomic ops directly on > > > sk_forward_alloc is to avoid adding other fields to the

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

2016-09-22 Thread Paolo Abeni
On Thu, 2016-09-22 at 09:30 -0700, Eric Dumazet wrote: > On Thu, 2016-09-22 at 18:14 +0200, Paolo Abeni wrote: > > > I think that the idea behind using atomic ops directly on > > sk_forward_alloc is to avoid adding other fields to the udp_socket. > > > > If we can add some fields to the udp_sock

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

2016-09-22 Thread Eric Dumazet
On Thu, 2016-09-22 at 18:14 +0200, Paolo Abeni wrote: > I think that the idea behind using atomic ops directly on > sk_forward_alloc is to avoid adding other fields to the udp_socket. > > If we can add some fields to the udp_sock structure, the schema proposed > in this patch should fit better (

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

2016-09-22 Thread Paolo Abeni
On Thu, 2016-09-22 at 16:21 +0100, Edward Cree wrote: > On 22/09/16 11:33, Paolo Abeni wrote: > > Hi Eric, > > > > On Wed, 2016-09-21 at 16:31 -0700, Eric Dumazet wrote: > >> Also does inet_diag properly give the forward_alloc to user ? > >> > >> $ ss -mua > >> State Recv-Q Send-Q Local Addres

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

2016-09-22 Thread Edward Cree
On 22/09/16 11:33, Paolo Abeni wrote: > Hi Eric, > > On Wed, 2016-09-21 at 16:31 -0700, Eric Dumazet wrote: >> Also does inet_diag properly give the forward_alloc to user ? >> >> $ ss -mua >> State Recv-Q Send-Q Local Address:Port Peer Addres >> s:Port >> UNCONN 51584 0

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

2016-09-22 Thread Paolo Abeni
Hi Eric, On Wed, 2016-09-21 at 16:31 -0700, Eric Dumazet wrote: > Also does inet_diag properly give the forward_alloc to user ? > > $ ss -mua > State Recv-Q Send-Q Local Address:Port Peer Addres > s:Port > UNCONN 51584 0 *:52460 *:* >

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

2016-09-21 Thread Eric Dumazet
On Wed, 2016-09-21 at 19:23 +0200, Paolo Abeni wrote: > Avoid usage of common memory accounting functions, since > the logic is pretty much different. > > To account for forward allocation, a couple of new atomic_t > members are added to udp_sock: 'mem_alloced' and 'mem_freed'. > The current forwa

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

2016-09-21 Thread Paolo Abeni
Avoid usage of common memory accounting functions, since the logic is pretty much different. To account for forward allocation, a couple of new atomic_t members are added to udp_sock: 'mem_alloced' and 'mem_freed'. The current forward allocation is estimated as 'mem_alloced' minus 'mem_freed' min