lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 23 Dec 2013 09:27:07 -0800
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Jason Wang <jasowang@...hat.com>
Cc:	Michael Dalton <mwdalton@...gle.com>,
	"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
	Eric Dumazet <edumazet@...gle.com>,
	Rusty Russell <rusty@...tcorp.com.au>,
	"Michael S. Tsirkin" <mst@...hat.com>,
	virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH net-next 2/3] virtio-net: use per-receive queue page
 frag alloc for mergeable bufs

On Mon, 2013-12-23 at 16:12 +0800, Jason Wang wrote:
> On 12/17/2013 08:16 AM, Michael Dalton wrote:
> > The virtio-net driver currently uses netdev_alloc_frag() for GFP_ATOMIC
> > mergeable rx buffer allocations. This commit migrates virtio-net to use
> > per-receive queue page frags for GFP_ATOMIC allocation. This change unifies
> > mergeable rx buffer memory allocation, which now will use skb_refill_frag()
> > for both atomic and GFP-WAIT buffer allocations.
> >
> > To address fragmentation concerns, if after buffer allocation there
> > is too little space left in the page frag to allocate a subsequent
> > buffer, the remaining space is added to the current allocated buffer
> > so that the remaining space can be used to store packet data.
> >
> > Signed-off-by: Michael Dalton <mwdalton@...gle.com>
> > ---
> >  drivers/net/virtio_net.c | 69 ++++++++++++++++++++++++++----------------------
> >  1 file changed, 38 insertions(+), 31 deletions(-)
> >
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index c51a988..d38d130 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -78,6 +78,9 @@ struct receive_queue {
> >  	/* Chain pages by the private ptr. */
> >  	struct page *pages;
> >  
> > +	/* Page frag for GFP_ATOMIC packet buffer allocation. */
> > +	struct page_frag atomic_frag;
> > +
> >  	/* RX: fragments + linear part + virtio header */
> >  	struct scatterlist sg[MAX_SKB_FRAGS + 2];
> >  
> > @@ -127,9 +130,9 @@ struct virtnet_info {
> >  	struct mutex config_lock;
> >  
> >  	/* Page_frag for GFP_KERNEL packet buffer allocation when we run
> > -	 * low on memory.
> > +	 * low on memory. May sleep.
> >  	 */
> > -	struct page_frag alloc_frag;
> > +	struct page_frag sleep_frag;
> 
> Any reason to use two different page_frag consider only
> skb_page_frag_refill() is used?

One is used under process context, where preemption and GFP_KERNEL are
allowed.

One is used from softirq context and GFP_ATOMIC. You cant share a common
page_frag.

Acked-by: Eric Dumazet <edumazet@...gle.com>



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ