Skip to content

Commit

Permalink
Merge branch 'couple-of-minor-improvements-to-build_skb-variants'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jakub Kicinski committed Mar 11, 2023
2 parents f758bfe + 3c64012 commit c568a8d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit c568a8d

Please sign in to comment.