summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2023-03-11 03:49:24 +0300
committerJakub Kicinski <kuba@kernel.org>2023-03-11 03:49:24 +0300
commitc568a8de6bb1cdf86badf01a1645e2efb433db21 (patch)
tree9e4b1e05c3b934c6e03039df96df3f163cad750b
parentf758bfec377ad2f15d7683473b1db1cfbf8e1bb0 (diff)
parent3c6401266f91c69771176d3b289abfeaec731611 (diff)
downloadlinux-c568a8de6bb1cdf86badf01a1645e2efb433db21.tar.xz
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.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--net/core/skbuff.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1a31815104d6..050a875d09c5 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -420,10 +420,9 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
{
struct sk_buff *skb = __build_skb(data, frag_size);
- if (skb && frag_size) {
+ if (likely(skb && frag_size)) {
skb->head_frag = 1;
- if (page_is_pfmemalloc(virt_to_head_page(data)))
- skb->pfmemalloc = 1;
+ skb_propagate_pfmemalloc(virt_to_head_page(data), skb);
}
return skb;
}
@@ -445,8 +444,7 @@ struct sk_buff *build_skb_around(struct sk_buff *skb,
if (frag_size) {
skb->head_frag = 1;
- if (page_is_pfmemalloc(virt_to_head_page(data)))
- skb->pfmemalloc = 1;
+ skb_propagate_pfmemalloc(virt_to_head_page(data), skb);
}
return skb;
}