netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: micro-optimize skb_datagram_iter
@ 2024-06-13 11:35 Sagi Grimberg
  2024-06-15  2:40 ` patchwork-bot+netdevbpf
  2024-06-16  8:06 ` kernel test robot
  0 siblings, 2 replies; 17+ messages in thread
From: Sagi Grimberg @ 2024-06-13 11:35 UTC (permalink / raw)
  To: netdev; +Cc: Eric Dumazet, Jakub Kicinski

We only use the mapping in a single context in a short and contained scope,
so kmap_local_page is sufficient and cheaper. This will also allow
skb_datagram_iter to be called from softirq context.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 net/core/datagram.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/datagram.c b/net/core/datagram.c
index a8b625abe242..ac74df248205 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -436,14 +436,14 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
 		end = start + skb_frag_size(frag);
 		if ((copy = end - offset) > 0) {
 			struct page *page = skb_frag_page(frag);
-			u8 *vaddr = kmap(page);
+			u8 *vaddr = kmap_local_page(page);
 
 			if (copy > len)
 				copy = len;
 			n = INDIRECT_CALL_1(cb, simple_copy_to_iter,
 					vaddr + skb_frag_off(frag) + offset - start,
 					copy, data, to);
-			kunmap(page);
+			kunmap_local(vaddr);
 			offset += n;
 			if (n != copy)
 				goto short_copy;
-- 
2.43.0


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

end of thread, other threads:[~2024-06-21  7:54 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13 11:35 [PATCH] net: micro-optimize skb_datagram_iter Sagi Grimberg
2024-06-15  2:40 ` patchwork-bot+netdevbpf
2024-06-16  8:06 ` kernel test robot
2024-06-16  9:24   ` Sagi Grimberg
2024-06-16 21:51     ` David Laight
2024-06-16 21:53       ` Matthew Wilcox
2024-06-17 10:18         ` David Laight
2024-06-16 21:56     ` Matthew Wilcox
2024-06-17  6:29       ` Sagi Grimberg
2024-06-17 16:58         ` Jakub Kicinski
2024-06-18  6:37           ` Sagi Grimberg
2024-06-19 12:46         ` David Howells
2024-06-19 13:54           ` Sagi Grimberg
2024-06-19 14:51             ` Eric Dumazet
2024-06-19 14:56               ` Eric Dumazet
2024-06-19 15:25               ` Sagi Grimberg
2024-06-21  7:54             ` David Howells

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