* [PATCH net-next] net: skb_queue_purge_reason() optimizations
@ 2023-10-03 18:19 Eric Dumazet
2023-10-04 12:44 ` Simon Horman
2023-10-05 0:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2023-10-03 18:19 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: netdev, eric.dumazet, Eric Dumazet
1) Exit early if the list is empty.
2) splice the list into a local list,
so that we block hard irqs only once.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/core/skbuff.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 87f5372b197fff4ffef5df34ef126eb1e297ae4c..0401f40973a584ba4a89509b02510c8352bd6fb5 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3722,10 +3722,19 @@ EXPORT_SYMBOL(skb_dequeue_tail);
void skb_queue_purge_reason(struct sk_buff_head *list,
enum skb_drop_reason reason)
{
- struct sk_buff *skb;
+ struct sk_buff_head tmp;
+ unsigned long flags;
+
+ if (skb_queue_empty_lockless(list))
+ return;
+
+ __skb_queue_head_init(&tmp);
+
+ spin_lock_irqsave(&list->lock, flags);
+ skb_queue_splice_init(list, &tmp);
+ spin_unlock_irqrestore(&list->lock, flags);
- while ((skb = skb_dequeue(list)) != NULL)
- kfree_skb_reason(skb, reason);
+ __skb_queue_purge_reason(&tmp, reason);
}
EXPORT_SYMBOL(skb_queue_purge_reason);
--
2.42.0.582.g8ccd20d70d-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: skb_queue_purge_reason() optimizations
2023-10-03 18:19 [PATCH net-next] net: skb_queue_purge_reason() optimizations Eric Dumazet
@ 2023-10-04 12:44 ` Simon Horman
2023-10-05 0:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-10-04 12:44 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
eric.dumazet
On Tue, Oct 03, 2023 at 06:19:20PM +0000, Eric Dumazet wrote:
> 1) Exit early if the list is empty.
>
> 2) splice the list into a local list,
> so that we block hard irqs only once.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: skb_queue_purge_reason() optimizations
2023-10-03 18:19 [PATCH net-next] net: skb_queue_purge_reason() optimizations Eric Dumazet
2023-10-04 12:44 ` Simon Horman
@ 2023-10-05 0:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-05 0:40 UTC (permalink / raw)
To: Eric Dumazet; +Cc: davem, kuba, pabeni, netdev, eric.dumazet
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 3 Oct 2023 18:19:20 +0000 you wrote:
> 1) Exit early if the list is empty.
>
> 2) splice the list into a local list,
> so that we block hard irqs only once.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
>
> [...]
Here is the summary with links:
- [net-next] net: skb_queue_purge_reason() optimizations
https://git.kernel.org/netdev/net-next/c/d86e5fbd4c96
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] 3+ messages in thread
end of thread, other threads:[~2023-10-05 0:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-03 18:19 [PATCH net-next] net: skb_queue_purge_reason() optimizations Eric Dumazet
2023-10-04 12:44 ` Simon Horman
2023-10-05 0:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).