Couple of minor improvements to build_skb variants
Subsystems (2)
v2 cover 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().
Changelog -v1->v2: https://lore.kernel.org/netdev/[email protected]/
* Add 'frag_size' into the likely call
Thanks
Gal Pressman (2):
skbuff: Replace open-coded skb_propagate_pfmemalloc()s
skbuff: Add likely to skb pointer in build_skb()
net/core/skbuff.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Signature · 1 line
2.39.1
PATCH v2 1/2 skbuff: Replace open-coded skb_propagate_pfmemalloc()s
Use skb_propagate_pfmemalloc() in build_skb()/build_skb_around() instead of open-coding it.
--- net/core/skbuff.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/core/skbuff.c +2 -4
@@ -422,8 +422,7 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)if (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; }
Signature · 1 line
2.39.1
Re: [PATCH net-next v2 1/2] skbuff: Replace open-coded skb_propagate_pfmemalloc()s
Quoted 5 lines · Gal Pressman
Use
skb_propagate_pfmemalloc()in build_skb()/build_skb_around() instead of open-coding it.Reviewed-by Tariq Toukan <[email protected]>Signed-off-by Gal Pressman <[email protected]>
PATCH v2 2/2 skbuff: Add likely to skb pointer in build_skb()
In reply to Gal PressmanSimilarly to napi_build_skb(), it is likely the skb allocation in build_skb() succeeded. frag_size != 0 is also likely, as stated in __build_skb_around().
--- net/core/skbuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/skbuff.c +1 -1
@@ -420,7 +420,7 @@ 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 ;skb_propagate_pfmemalloc (virt_to_head_page (data), skb); }
Signature · 1 line
2.39.1
Re: [PATCH net-next v2 2/2] skbuff: Add likely to skb pointer in build_skb()
Quoted 7 lines · Gal Pressman
Similarly to
napi_build_skb(), it is likely the skb allocation inbuild_skb()succeeded.frag_size!= 0 is also likely, as stated in__build_skb_around().Reviewed-by Tariq Toukan <[email protected]>Signed-off-by Gal Pressman <[email protected]>Reviewed-by Larysa Zaremba <[email protected]>
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Wed, 8 Mar 2023 15:17:18 +0200 you wrote:
First patch replaces open-coded occurrences of
skb_propagate_pfmemalloc()inbuild_skb()andbuild_skb_around(). The secnod patch adds alikely()to the skb allocation inbuild_skb().Changelog -
v1->v2: https://lore.kernel.org/netdev/[email protected]/
* Add 'frag_size' into the likely call[...]
Here is the summary with links:
- [net-next,v2,1/2] skbuff: Replace open-coded skb_propagate_pfmemalloc()s
https://git.kernel.org/netdev/net-next/c/566b6701d5df - [net-next,v2,2/2] skbuff: Add likely to skb pointer in build_skb() https://git.kernel.org/netdev/net-next/c/3c6401266f91
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html