Skip to content

Commit c568a8d

Browse files
committed
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>
2 parents f758bfe + 3c64012 commit c568a8d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

net/core/skbuff.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,9 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
420420
{
421421
struct sk_buff *skb = __build_skb(data, frag_size);
422422

423-
if (skb && frag_size) {
423+
if (likely(skb && frag_size)) {
424424
skb->head_frag = 1;
425-
if (page_is_pfmemalloc(virt_to_head_page(data)))
426-
skb->pfmemalloc = 1;
425+
skb_propagate_pfmemalloc(virt_to_head_page(data), skb);
427426
}
428427
return skb;
429428
}
@@ -445,8 +444,7 @@ struct sk_buff *build_skb_around(struct sk_buff *skb,
445444

446445
if (frag_size) {
447446
skb->head_frag = 1;
448-
if (page_is_pfmemalloc(virt_to_head_page(data)))
449-
skb->pfmemalloc = 1;
447+
skb_propagate_pfmemalloc(virt_to_head_page(data), skb);
450448
}
451449
return skb;
452450
}

0 commit comments

Comments
 (0)