Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-20 Thread Michael S. Tsirkin
On Wed, Nov 20, 2013 at 08:14:21AM -0800, Eric Dumazet wrote: > On Wed, 2013-11-20 at 18:06 +0200, Michael S. Tsirkin wrote: > > > Hmm some kind of disconnect here. > > I got you rmanagement about bufferbloat. > > > > What I am saying is that maybe we should drop packets more > > aggressively: wh

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-20 Thread Eric Dumazet
On Wed, 2013-11-20 at 18:06 +0200, Michael S. Tsirkin wrote: > Hmm some kind of disconnect here. > I got you rmanagement about bufferbloat. > > What I am saying is that maybe we should drop packets more > aggressively: when we drop one packet of a flow, why not > drop everything that's queued and

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-20 Thread Michael S. Tsirkin
On Wed, Nov 20, 2013 at 07:16:33AM -0800, Eric Dumazet wrote: > On Wed, 2013-11-20 at 10:58 +0200, Michael S. Tsirkin wrote: > > On Tue, Nov 19, 2013 at 02:00:11PM -0800, Eric Dumazet wrote: > > > On Tue, 2013-11-19 at 23:53 +0200, Michael S. Tsirkin wrote: > > > > > > > Which NIC? Virtio? Prior t

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-20 Thread Eric Dumazet
On Wed, 2013-11-20 at 10:58 +0200, Michael S. Tsirkin wrote: > On Tue, Nov 19, 2013 at 02:00:11PM -0800, Eric Dumazet wrote: > > On Tue, 2013-11-19 at 23:53 +0200, Michael S. Tsirkin wrote: > > > > > Which NIC? Virtio? Prior to 2613af0ed18a11d5c566a81f9a6510b73180660a > > > it didn't drop packets

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-20 Thread Michael S. Tsirkin
On Tue, Nov 19, 2013 at 01:38:16PM -0800, Michael Dalton wrote: > Great catch Jason. I agree this now raises the larger issue of how to > handle a memory alloc failure in the middle of receive. As Eric mentioned, > we can drop the packet and free the remaining (num_buf) frags. > > Michael, perhaps

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-20 Thread Michael S. Tsirkin
On Tue, Nov 19, 2013 at 05:34:16PM -0800, Michael Dalton wrote: > Hi, > > After further reflection I think we're looking at two related issues: > (a) a memory leak that Jason has identified that occurs when a memory > allocation fails in receive_mergeable. Jasons commit solves this issue. > (b) vi

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-20 Thread Michael S. Tsirkin
On Tue, Nov 19, 2013 at 02:00:11PM -0800, Eric Dumazet wrote: > On Tue, 2013-11-19 at 23:53 +0200, Michael S. Tsirkin wrote: > > > Which NIC? Virtio? Prior to 2613af0ed18a11d5c566a81f9a6510b73180660a > > it didn't drop packets received from host as far as I can tell. > > virtio is more like a pipe

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Jason Wang
On 11/20/2013 09:34 AM, Michael Dalton wrote: > Hi, > > After further reflection I think we're looking at two related issues: > (a) a memory leak that Jason has identified that occurs when a memory > allocation fails in receive_mergeable. Jasons commit solves this issue. > (b) virtio-net does not d

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Jason Wang
On 11/20/2013 04:49 AM, Michael S. Tsirkin wrote: > On Tue, Nov 19, 2013 at 06:03:48AM -0800, Eric Dumazet wrote: >> On Tue, 2013-11-19 at 16:05 +0800, Jason Wang wrote: >>> We need to drop the refcnt of page when we fail to allocate an skb for frag >>> list, otherwise it will be leaked. The bug wa

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Jason Wang
On 11/19/2013 10:03 PM, Eric Dumazet wrote: > On Tue, 2013-11-19 at 16:05 +0800, Jason Wang wrote: >> > We need to drop the refcnt of page when we fail to allocate an skb for frag >> > list, otherwise it will be leaked. The bug was introduced by commit >> > 2613af0ed18a11d5c566a81f9a6510b73180660a

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Michael Dalton
Hi, After further reflection I think we're looking at two related issues: (a) a memory leak that Jason has identified that occurs when a memory allocation fails in receive_mergeable. Jasons commit solves this issue. (b) virtio-net does not dequeue all buffers for a packet in the case that an error

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Eric Dumazet
On Tue, 2013-11-19 at 23:53 +0200, Michael S. Tsirkin wrote: > Which NIC? Virtio? Prior to 2613af0ed18a11d5c566a81f9a6510b73180660a > it didn't drop packets received from host as far as I can tell. > virtio is more like a pipe than a real NIC in this respect. Prior/after to this patch, you were n

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Michael S. Tsirkin
On Tue, Nov 19, 2013 at 01:36:36PM -0800, Eric Dumazet wrote: > On Tue, 2013-11-19 at 22:49 +0200, Michael S. Tsirkin wrote: > > On Tue, Nov 19, 2013 at 06:03:48AM -0800, Eric Dumazet wrote: > > > On Tue, 2013-11-19 at 16:05 +0800, Jason Wang wrote: > > > > We need to drop the refcnt of page when w

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Michael Dalton
Great catch Jason. I agree this now raises the larger issue of how to handle a memory alloc failure in the middle of receive. As Eric mentioned, we can drop the packet and free the remaining (num_buf) frags. Michael, perhaps I'm missing something, but why would you prefer pre-allocating buffers in

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Eric Dumazet
On Tue, 2013-11-19 at 22:49 +0200, Michael S. Tsirkin wrote: > On Tue, Nov 19, 2013 at 06:03:48AM -0800, Eric Dumazet wrote: > > On Tue, 2013-11-19 at 16:05 +0800, Jason Wang wrote: > > > We need to drop the refcnt of page when we fail to allocate an skb for > > > frag > > > list, otherwise it wil

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Michael S. Tsirkin
On Tue, Nov 19, 2013 at 06:03:48AM -0800, Eric Dumazet wrote: > On Tue, 2013-11-19 at 16:05 +0800, Jason Wang wrote: > > We need to drop the refcnt of page when we fail to allocate an skb for frag > > list, otherwise it will be leaked. The bug was introduced by commit > > 2613af0ed18a11d5c566a81f9a

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Michael S. Tsirkin
On Tue, Nov 19, 2013 at 06:03:48AM -0800, Eric Dumazet wrote: > On Tue, 2013-11-19 at 16:05 +0800, Jason Wang wrote: > > We need to drop the refcnt of page when we fail to allocate an skb for frag > > list, otherwise it will be leaked. The bug was introduced by commit > > 2613af0ed18a11d5c566a81f9a

Re: [PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Eric Dumazet
On Tue, 2013-11-19 at 16:05 +0800, Jason Wang wrote: > We need to drop the refcnt of page when we fail to allocate an skb for frag > list, otherwise it will be leaked. The bug was introduced by commit > 2613af0ed18a11d5c566a81f9a6510b73180660a ("virtio_net: migrate mergeable rx > buffers to page fr

[PATCH net] virtio-net: fix page refcnt leaking when fail to allocate frag skb

2013-11-19 Thread Jason Wang
We need to drop the refcnt of page when we fail to allocate an skb for frag list, otherwise it will be leaked. The bug was introduced by commit 2613af0ed18a11d5c566a81f9a6510b73180660a ("virtio_net: migrate mergeable rx buffers to page frag allocators"). Cc: Michael Dalton Cc: Eric Dumazet Cc: R