All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2] Couple of minor improvements to build_skb variants
@ 2023-03-08 13:17 Gal Pressman
  2023-03-08 13:17 ` [PATCH net-next v2 1/2] skbuff: Replace open-coded skb_propagate_pfmemalloc()s Gal Pressman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Gal Pressman @ 2023-03-08 13:17 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Paolo Abeni, Gal Pressman

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/20230215121707.1936762-1-gal@nvidia.com/
* 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(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next v2 1/2] skbuff: Replace open-coded skb_propagate_pfmemalloc()s
  2023-03-08 13:17 [PATCH net-next v2 0/2] Couple of minor improvements to build_skb variants Gal Pressman
@ 2023-03-08 13:17 ` Gal Pressman
  2023-03-09 13:33   ` Simon Horman
  2023-03-08 13:17 ` [PATCH net-next v2 2/2] skbuff: Add likely to skb pointer in build_skb() Gal Pressman
  2023-03-11  1:00 ` [PATCH net-next v2 0/2] Couple of minor improvements to build_skb variants patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Gal Pressman @ 2023-03-08 13:17 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Paolo Abeni, Gal Pressman, Tariq Toukan

Use skb_propagate_pfmemalloc() in build_skb()/build_skb_around() instead
of open-coding it.

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
 net/core/skbuff.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index eb7d33b41e71..5c1a65cc2f39 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -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;
 }
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v2 2/2] skbuff: Add likely to skb pointer in build_skb()
  2023-03-08 13:17 [PATCH net-next v2 0/2] Couple of minor improvements to build_skb variants Gal Pressman
  2023-03-08 13:17 ` [PATCH net-next v2 1/2] skbuff: Replace open-coded skb_propagate_pfmemalloc()s Gal Pressman
@ 2023-03-08 13:17 ` Gal Pressman
  2023-03-09 13:33   ` Simon Horman
  2023-03-11  1:00 ` [PATCH net-next v2 0/2] Couple of minor improvements to build_skb variants patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Gal Pressman @ 2023-03-08 13:17 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Paolo Abeni, Gal Pressman, Tariq Toukan,
	Larysa Zaremba

Similarly 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().

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
---
 net/core/skbuff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 5c1a65cc2f39..34df1aa0584b 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -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);
 	}
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v2 1/2] skbuff: Replace open-coded skb_propagate_pfmemalloc()s
  2023-03-08 13:17 ` [PATCH net-next v2 1/2] skbuff: Replace open-coded skb_propagate_pfmemalloc()s Gal Pressman
@ 2023-03-09 13:33   ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2023-03-09 13:33 UTC (permalink / raw)
  To: Gal Pressman
  Cc: David S. Miller, Jakub Kicinski, netdev, Eric Dumazet,
	Paolo Abeni, Tariq Toukan

On Wed, Mar 08, 2023 at 03:17:19PM +0200, Gal Pressman wrote:
> Use skb_propagate_pfmemalloc() in build_skb()/build_skb_around() instead
> of open-coding it.
> 
> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
> Signed-off-by: Gal Pressman <gal@nvidia.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v2 2/2] skbuff: Add likely to skb pointer in build_skb()
  2023-03-08 13:17 ` [PATCH net-next v2 2/2] skbuff: Add likely to skb pointer in build_skb() Gal Pressman
@ 2023-03-09 13:33   ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2023-03-09 13:33 UTC (permalink / raw)
  To: Gal Pressman
  Cc: David S. Miller, Jakub Kicinski, netdev, Eric Dumazet,
	Paolo Abeni, Tariq Toukan, Larysa Zaremba

On Wed, Mar 08, 2023 at 03:17:20PM +0200, Gal Pressman wrote:
> Similarly 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().
> 
> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
> Signed-off-by: Gal Pressman <gal@nvidia.com>
> Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v2 0/2] Couple of minor improvements to build_skb variants
  2023-03-08 13:17 [PATCH net-next v2 0/2] Couple of minor improvements to build_skb variants Gal Pressman
  2023-03-08 13:17 ` [PATCH net-next v2 1/2] skbuff: Replace open-coded skb_propagate_pfmemalloc()s Gal Pressman
  2023-03-08 13:17 ` [PATCH net-next v2 2/2] skbuff: Add likely to skb pointer in build_skb() Gal Pressman
@ 2023-03-11  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-11  1:00 UTC (permalink / raw)
  To: Gal Pressman; +Cc: davem, kuba, netdev, edumazet, pabeni

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 8 Mar 2023 15:17:18 +0200 you wrote:
> 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/20230215121707.1936762-1-gal@nvidia.com/
> * 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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-11  1:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 13:17 [PATCH net-next v2 0/2] Couple of minor improvements to build_skb variants Gal Pressman
2023-03-08 13:17 ` [PATCH net-next v2 1/2] skbuff: Replace open-coded skb_propagate_pfmemalloc()s Gal Pressman
2023-03-09 13:33   ` Simon Horman
2023-03-08 13:17 ` [PATCH net-next v2 2/2] skbuff: Add likely to skb pointer in build_skb() Gal Pressman
2023-03-09 13:33   ` Simon Horman
2023-03-11  1:00 ` [PATCH net-next v2 0/2] Couple of minor improvements to build_skb variants patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.