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 <[EMAIL PROTECTED]> >
> + 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 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html