[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1253003420.7549.51.camel@debian>
Date: Tue, 15 Sep 2009 16:30:20 +0800
From: Zhu Yi <yi.zhu@...el.com>
To: Mel Gorman <mel@....ul.ie>
Cc: "Chatre, Reinette" <reinette.chatre@...el.com>,
Frans Pop <elendil@...net.nl>,
Larry Finger <Larry.Finger@...inger.net>,
"John W. Linville" <linville@...driver.com>,
Pekka Enberg <penberg@...helsinki.fi>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
"ipw3945-devel@...ts.sourceforge.net"
<ipw3945-devel@...ts.sourceforge.net>,
Andrew Morton <akpm@...ux-foundation.org>,
"cl@...ux-foundation.org" <cl@...ux-foundation.org>,
"Krauss, Assaf" <assaf.krauss@...el.com>,
Johannes Berg <johannes@...solutions.net>,
"Abbas, Mohamed" <mohamed.abbas@...el.com>, netdev@...r.kernel.org
Subject: alloc skb based on a given data buffer
[ Cc netdev and change the subject ]
On Mon, 2009-09-14 at 21:06 +0800, Mel Gorman wrote:
> > Essentially, the hardware only requires an order-1 allocation aligned on
> > 256 bytes boundary. But as it is used as an SKB, a trailing struct
> > skb_shared_info is added. This forces us to both increase the order and
> > do alignment ourselves. I believe some improvement could be done here.
> > But it should not be an easy one.
> >
>
> Probably not. I can only assume that moving the location of
> skb_shared_info such that it is sometimes located after the buffer and
> sometimes allocated via a separate kmalloc() would be a significant
> undertaking.
Shall I propose below function as a variant to alloc_skb()?
struct sk_buff *alloc_skb_attach_buff(void *data_buff,
unsigned int real_size,
unsigned int size, gfp_t mask);
If real_size >= size + sizeof(struct skb_shared_info), we can still put
the shinfo at the end of the buffer. Otherwise we can allocate from a
new slab that put sk_buff and shinfo together. Of course, kfree_skbmem()
needs to recognize it.
This way, device drivers can allocate the Rx buffers with their own size
and alignment requirement. i.e. do an order-1 page allocation directly
with free_pages() in the iwlagn driver for a 256 bytes aligned 8K Rx
buffer. After DMA is finished, drivers can use the above function to
assemble an skb based on the Rx buffer. It should resolve the problem
for requiring an order-2 allocation by alloc_skb() in the first place.
Comments are welcome.
Thanks,
-yi
--
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