Commit 65998d2b authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

net: remove osize variable in __alloc_skb()

This is a cleanup patch, to prepare following change.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
Reviewed-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 115f1a5c
...@@ -533,7 +533,6 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, ...@@ -533,7 +533,6 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
{ {
struct kmem_cache *cache; struct kmem_cache *cache;
struct sk_buff *skb; struct sk_buff *skb;
unsigned int osize;
bool pfmemalloc; bool pfmemalloc;
u8 *data; u8 *data;
...@@ -559,16 +558,15 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, ...@@ -559,16 +558,15 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
* Both skb->head and skb_shared_info are cache line aligned. * Both skb->head and skb_shared_info are cache line aligned.
*/ */
size = SKB_HEAD_ALIGN(size); size = SKB_HEAD_ALIGN(size);
osize = kmalloc_size_roundup(size); size = kmalloc_size_roundup(size);
data = kmalloc_reserve(osize, gfp_mask, node, &pfmemalloc); data = kmalloc_reserve(size, gfp_mask, node, &pfmemalloc);
if (unlikely(!data)) if (unlikely(!data))
goto nodata; goto nodata;
/* kmalloc_size_roundup() might give us more room than requested. /* kmalloc_size_roundup() might give us more room than requested.
* Put skb_shared_info exactly at the end of allocated zone, * Put skb_shared_info exactly at the end of allocated zone,
* to allow max possible filling before reallocation. * to allow max possible filling before reallocation.
*/ */
size = SKB_WITH_OVERHEAD(osize); prefetchw(data + SKB_WITH_OVERHEAD(size));
prefetchw(data + size);
/* /*
* Only clear those fields we need to clear, not those that we will * Only clear those fields we need to clear, not those that we will
...@@ -576,7 +574,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, ...@@ -576,7 +574,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
* the tail pointer in struct sk_buff! * the tail pointer in struct sk_buff!
*/ */
memset(skb, 0, offsetof(struct sk_buff, tail)); memset(skb, 0, offsetof(struct sk_buff, tail));
__build_skb_around(skb, data, osize); __build_skb_around(skb, data, size);
skb->pfmemalloc = pfmemalloc; skb->pfmemalloc = pfmemalloc;
if (flags & SKB_ALLOC_FCLONE) { if (flags & SKB_ALLOC_FCLONE) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment