diff options
author | 2023-03-10 16:49:24 -0800 | |
---|---|---|
committer | 2023-03-10 16:49:24 -0800 | |
commit | c568a8de6bb1cdf86badf01a1645e2efb433db21 (patch) | |
tree | 9e4b1e05c3b934c6e03039df96df3f163cad750b | |
parent | tap: add support for IOCB_NOWAIT (diff) | |
parent | skbuff: Add likely to skb pointer in build_skb() (diff) | |
download | wireguard-linux-c568a8de6bb1cdf86badf01a1645e2efb433db21.tar.xz wireguard-linux-c568a8de6bb1cdf86badf01a1645e2efb433db21.zip |
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.c | 8 |
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; } |