All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: Mel Gorman <mel@csn.ul.ie>
Cc: "Chatre, Reinette" <reinette.chatre@intel.com>,
	Frans Pop <elendil@planet.nl>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	"John W. Linville" <linville@tuxdriver.com>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"ipw3945-devel@lists.sourceforge.net"
	<ipw3945-devel@lists.sourceforge.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	"cl@linux-foundation.org" <cl@linux-foundation.org>,
	"Krauss, Assaf" <assaf.krauss@intel.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	"Abbas, Mohamed" <mohamed.abbas@intel.com>,
	netdev@vger.kernel.org
Subject: alloc skb based on a given data buffer
Date: Tue, 15 Sep 2009 16:30:20 +0800	[thread overview]
Message-ID: <1253003420.7549.51.camel@debian> (raw)
In-Reply-To: <20090914130612.GA11778@csn.ul.ie>

[ 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


  reply	other threads:[~2009-09-15  8:30 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-06  7:40 iwlagn: order 2 page allocation failures Frans Pop
2009-09-06  8:14 ` Pekka Enberg
2009-09-06  8:28   ` Frans Pop
2009-09-06  8:35     ` Pekka Enberg
2009-09-08 10:54       ` Mel Gorman
2009-09-08 11:11         ` Pekka Enberg
2009-09-08 14:17           ` John W. Linville
2009-09-08 14:59             ` Larry Finger
2009-09-09 15:04               ` Mel Gorman
2009-09-09 15:59                 ` Frans Pop
2009-09-09 16:55                   ` Mel Gorman
2009-09-09 17:19                     ` Frans Pop
2009-09-16 14:36                       ` Frans Pop
2009-09-16 15:02                         ` Mel Gorman
2009-09-16 15:37                           ` Frans Pop
2009-09-16 16:26                           ` reinette chatre
2009-09-16 16:26                             ` reinette chatre
2009-09-09 20:05                     ` reinette chatre
2009-09-09 20:05                       ` reinette chatre
2009-09-10  1:48                       ` Frans Pop
2009-09-10  1:48                         ` Frans Pop
2009-09-10  9:02                       ` Mel Gorman
2009-09-10  9:02                         ` Mel Gorman
2009-09-10 18:15                         ` reinette chatre
2009-09-10 18:15                           ` reinette chatre
2009-09-10 18:43                           ` Frans Pop
2009-09-10 18:43                             ` Frans Pop
2009-09-10 18:50                             ` reinette chatre
2009-09-10 18:50                               ` reinette chatre
2009-09-11  8:45                           ` Mel Gorman
2009-09-11  8:45                             ` Mel Gorman
2009-09-11 16:14                             ` reinette chatre
2009-09-11 16:14                               ` reinette chatre
2009-09-10 21:14                         ` reinette chatre
2009-09-10 21:14                           ` reinette chatre
2009-09-11  8:47                           ` Mel Gorman
2009-09-11  8:47                             ` Mel Gorman
2009-09-14  3:01                             ` Zhu Yi
2009-09-14  3:01                               ` Zhu Yi
2009-09-14 13:06                               ` Mel Gorman
2009-09-14 13:06                                 ` Mel Gorman
2009-09-15  8:30                                 ` Zhu Yi [this message]
2009-09-15  8:30                                   ` alloc skb based on a given data buffer Zhu Yi
2009-09-15  8:33                                   ` David Miller
2009-09-15  8:33                                     ` David Miller
2009-09-15  8:57                                     ` Zhu Yi
2009-09-15  8:57                                       ` Zhu Yi
2009-09-15  9:09                                       ` David Miller
2009-09-15  9:15                                         ` Zhu Yi
2009-09-15  9:15                                           ` Zhu Yi
2009-09-15 15:30                                           ` Johannes Berg
2009-09-15 15:30                                             ` Johannes Berg
2009-09-15 15:30                                             ` Johannes Berg
2009-09-15 21:16                                             ` David Miller
2009-09-15 21:16                                               ` David Miller
2009-09-19  5:56                                               ` Johannes Berg
2009-09-14 15:42                               ` iwlagn: order 2 page allocation failures Christoph Lameter
2009-09-14 15:42                                 ` Christoph Lameter
2009-09-14 17:59                                 ` Mel Gorman
2009-09-14 17:59                                   ` Mel Gorman
2009-09-14 18:04                                   ` Christoph Lameter
2009-09-14 18:04                                     ` Christoph Lameter
2009-09-10  8:18                     ` Pekka Enberg
2009-09-10 12:34                       ` Mel Gorman
2009-09-10 12:39                         ` Pekka Enberg
2009-09-10 12:58                           ` Mel Gorman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1253003420.7549.51.camel@debian \
    --to=yi.zhu@intel.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=akpm@linux-foundation.org \
    --cc=assaf.krauss@intel.com \
    --cc=cl@linux-foundation.org \
    --cc=elendil@planet.nl \
    --cc=ipw3945-devel@lists.sourceforge.net \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mel@csn.ul.ie \
    --cc=mohamed.abbas@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=reinette.chatre@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.