Commit c568a8de authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'couple-of-minor-improvements-to-build_skb-variants'

Gal Pressman says:

====================
Couple of minor improvements to build_skb variants

First patch replaces open-coded occurrences of
skb_propagate_pfmemalloc() in build_skb() and build_skb_around().
The secnod patch adds a likely() to the skb allocation in build_skb().
====================

Link: https://lore.kernel.org/r/20230308131720.2103611-1-gal@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents f758bfec 3c640126
...@@ -420,10 +420,9 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size) ...@@ -420,10 +420,9 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
{ {
struct sk_buff *skb = __build_skb(data, frag_size); struct sk_buff *skb = __build_skb(data, frag_size);
if (skb && frag_size) { if (likely(skb && frag_size)) {
skb->head_frag = 1; skb->head_frag = 1;
if (page_is_pfmemalloc(virt_to_head_page(data))) skb_propagate_pfmemalloc(virt_to_head_page(data), skb);
skb->pfmemalloc = 1;
} }
return skb; return skb;
} }
...@@ -445,8 +444,7 @@ struct sk_buff *build_skb_around(struct sk_buff *skb, ...@@ -445,8 +444,7 @@ struct sk_buff *build_skb_around(struct sk_buff *skb,
if (frag_size) { if (frag_size) {
skb->head_frag = 1; skb->head_frag = 1;
if (page_is_pfmemalloc(virt_to_head_page(data))) skb_propagate_pfmemalloc(virt_to_head_page(data), skb);
skb->pfmemalloc = 1;
} }
return skb; return skb;
} }
......
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