netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [RFC] avoid unnecessary alignement overhead in skb->data allocation.
Date: Mon, 7 Aug 2006 10:05:57 +0200	[thread overview]
Message-ID: <200608071005.57517.dada1@cosmosbay.com> (raw)
In-Reply-To: <20060807060155.GA6487@2ka.mipt.ru>

On Monday 07 August 2006 08:01, Evgeniy Polyakov wrote:
> Hello.
>
> Attached patch allows to avoid unnecessary alignment overhead
> in skb->data allocation.
> Main idea is to allocate struct skb_shared_info from cache when
> addition of sizeof(struct skb_shared_info) ens up in different order
> allocation than initial size order.
> This allows to solve problem with 4k allocations for 1500 MTU and 32k
> allocations for 9k jumbo frames for some chips.
> Patch was not tested, so if idea worth it I will complete it.
>
> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
>

> +	if ((1UL << order) > size + sizeof(void *) + sizeof(struct
> skb_shared_info)) { +		data = ____kmalloc(size + sizeof(struct
> skb_shared_info), gfp_mask); +		if (!data)
> +			goto nodata;
> +		memset(skb, 0, offsetof(struct sk_buff, truesize));
> +	} else {
> +		unsigned long *ptr;
> +
> +		data = ____kmalloc(size, gfp_mask);

You certainly want to kmalloc(size + sizeof(void *)) here, dont you ?

> +		if (!data)
> +			goto nodata;
> +		sh = kmem_cache_alloc(skbuff_shared_info_cache, gfp_mask);
> +		if (!sh) {
> +			kfree(data);
> +			goto nodata;
> +		}
> +		memset(skb, 0, offsetof(struct sk_buff, truesize));
> +		skb->shinfo_cache = 1;
> +		ptr = data;
> +		ptr[size] = sh;

Eric

  parent reply	other threads:[~2006-08-07  8:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-07  6:01 [RFC] avoid unnecessary alignement overhead in skb->data allocation Evgeniy Polyakov
2006-08-07  6:23 ` David Miller
2006-08-07  6:30   ` Evgeniy Polyakov
2006-08-07  7:17   ` Herbert Xu
2006-08-07  7:24     ` Evgeniy Polyakov
2006-08-07  7:28       ` Herbert Xu
2006-08-07  7:31         ` Evgeniy Polyakov
2006-08-07  7:39           ` Herbert Xu
2006-08-08  0:09             ` Jesse Brandeburg
2006-08-08  0:41               ` David Miller
2006-08-08  5:24               ` Evgeniy Polyakov
2006-08-08  5:41                 ` Herbert Xu
2006-08-08  5:55                   ` Evgeniy Polyakov
2006-08-07  6:29 ` Herbert Xu
2006-08-07  6:36   ` Evgeniy Polyakov
2006-08-07  6:42     ` Herbert Xu
2006-08-07  8:05 ` Eric Dumazet [this message]
2006-08-07  8:14   ` Evgeniy Polyakov

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=200608071005.57517.dada1@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=johnpol@2ka.mipt.ru \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).