Subject: Re: [RFC] avoid unnecessary alignement overhead in skb->data allocation.

From: Evgeniy Polyakov <[email-masked]>
Date: Mon, 7 Aug 2006 12:14:47 +0400

On Mon, Aug 07, 2006 at 10:05:57AM +0200, Eric Dumazet ([email-masked]) wrote:
> > +	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 ?

Yep.
I think in next iteration of this patch I will add additional argument
which will present order of aligned size (to eliminate get_order() loop
for those who know it in advance like e1000). In case there are no
place even for sizeof(void *) (what happens with e1000) and allocation 
order is quite high (more than half of the page), then additional field 
in skb can be used (or we can reuse it unconditionally to store pointer
to shared info if skb is being allocated through alloc_skb_aligned()
function).

> Eric

-- 
	Evgeniy Polyakov