linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 5.4 79/83] net: use indirect call wrappers for skb_copy_datagram_iter()
Date: Fri,  1 May 2020 15:23:58 +0200	[thread overview]
Message-ID: <20200501131542.761532213@linuxfoundation.org> (raw)
In-Reply-To: <20200501131524.004332640@linuxfoundation.org>

From: Eric Dumazet <edumazet@google.com>

commit 29f3490ba9d2399d3d1b20c4aa74592d92bd4e11 upstream.

TCP recvmsg() calls skb_copy_datagram_iter(), which
calls an indirect function (cb pointing to simple_copy_to_iter())
for every MSS (fragment) present in the skb.

CONFIG_RETPOLINE=y forces a very expensive operation
that we can avoid thanks to indirect call wrappers.

This patch gives a 13% increase of performance on
a single flow, if the bottleneck is the thread reading
the TCP socket.

Fixes: 950fcaecd5cc ("datagram: consolidate datagram copy to iter helpers")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/core/datagram.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -51,6 +51,7 @@
 #include <linux/slab.h>
 #include <linux/pagemap.h>
 #include <linux/uio.h>
+#include <linux/indirect_call_wrapper.h>
 
 #include <net/protocol.h>
 #include <linux/skbuff.h>
@@ -407,6 +408,11 @@ int skb_kill_datagram(struct sock *sk, s
 }
 EXPORT_SYMBOL(skb_kill_datagram);
 
+INDIRECT_CALLABLE_DECLARE(static size_t simple_copy_to_iter(const void *addr,
+						size_t bytes,
+						void *data __always_unused,
+						struct iov_iter *i));
+
 static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
 			       struct iov_iter *to, int len, bool fault_short,
 			       size_t (*cb)(const void *, size_t, void *,
@@ -420,7 +426,8 @@ static int __skb_datagram_iter(const str
 	if (copy > 0) {
 		if (copy > len)
 			copy = len;
-		n = cb(skb->data + offset, copy, data, to);
+		n = INDIRECT_CALL_1(cb, simple_copy_to_iter,
+				    skb->data + offset, copy, data, to);
 		offset += n;
 		if (n != copy)
 			goto short_copy;
@@ -442,8 +449,9 @@ static int __skb_datagram_iter(const str
 
 			if (copy > len)
 				copy = len;
-			n = cb(vaddr + skb_frag_off(frag) + offset - start,
-			       copy, data, to);
+			n = INDIRECT_CALL_1(cb, simple_copy_to_iter,
+					vaddr + skb_frag_off(frag) + offset - start,
+					copy, data, to);
 			kunmap(page);
 			offset += n;
 			if (n != copy)



  parent reply	other threads:[~2020-05-01 13:40 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 13:22 [PATCH 5.4 00/83] 5.4.37-rc1 review Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 01/83] remoteproc: Fix wrong rvring index computation Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 02/83] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 03/83] printk: queue wake_up_klogd irq_work only if per-CPU areas are ready Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 04/83] ASoC: stm32: sai: fix sai probe Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 05/83] usb: dwc3: gadget: Do link recovery for SS and SSP Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 06/83] kbuild: fix DT binding schema rule again to avoid needless rebuilds Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 07/83] usb: gadget: udc: bdc: Remove unnecessary NULL checks in bdc_req_complete Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 08/83] usb: gadget: udc: atmel: Fix vbus disconnect handling Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 09/83] afs: Make record checking use TASK_UNINTERRUPTIBLE when appropriate Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 10/83] afs: Fix to actually set AFS_SERVER_FL_HAVE_EPOCH Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 11/83] iio:ad7797: Use correct attribute_group Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 12/83] propagate_one(): mnt_set_mountpoint() needs mount_lock Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 13/83] counter: 104-quad-8: Add lock guards - generic interface Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 14/83] s390/ftrace: fix potential crashes when switching tracers Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 15/83] ASoC: q6dsp6: q6afe-dai: add missing channels to MI2S DAIs Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 16/83] ASoC: tas571x: disable regulators on failed probe Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 17/83] ASoC: meson: axg-card: fix codec-to-codec link setup Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 18/83] ASoC: wm8960: Fix wrong clock after suspend & resume Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 19/83] drivers: soc: xilinx: fix firmware driver Kconfig dependency Greg Kroah-Hartman
2020-05-01 13:22 ` [PATCH 5.4 20/83] nfsd: memory corruption in nfsd4_lock() Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 21/83] bpf: Forbid XADD on spilled pointers for unprivileged users Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 22/83] i2c: altera: use proper variable to hold errno Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 23/83] rxrpc: Fix DATA Tx to disable nofrag for UDP on AF_INET6 socket Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 24/83] net/cxgb4: Check the return from t4_query_params properly Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 25/83] xfs: acquire superblock freeze protection on eofblocks scans Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 26/83] svcrdma: Fix trace point use-after-free race Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 27/83] svcrdma: Fix leak of svc_rdma_recv_ctxt objects Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 28/83] net/mlx5e: Dont trigger IRQ multiple times on XSK wakeup to avoid WQ overruns Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 29/83] net/mlx5e: Get the latest values from counters in switchdev mode Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 30/83] PCI: Avoid ASMedia XHCI USB PME# from D0 defect Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 31/83] PCI: Add ACS quirk for Zhaoxin multi-function devices Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 32/83] PCI: Make ACS quirk implementations more uniform Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 33/83] PCI: Unify ACS quirk desired vs provided checking Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 34/83] PCI: Add Zhaoxin Vendor ID Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 35/83] PCI: Add ACS quirk for Zhaoxin Root/Downstream Ports Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 36/83] PCI: Move Apex Edge TPU class quirk to fix BAR assignment Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 37/83] ARM: dts: bcm283x: Disable dsi0 node Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 38/83] cpumap: Avoid warning when CONFIG_DEBUG_PER_CPU_MAPS is enabled Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 39/83] s390/pci: do not set affinity for floating irqs Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 40/83] net/mlx5: Fix failing fw tracer allocation on s390 Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 41/83] sched/core: Fix reset-on-fork from RT with uclamp Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 42/83] perf/core: fix parent pid/tid in task exit events Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 43/83] netfilter: nat: fix error handling upon registering inet hook Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 44/83] PM: sleep: core: Switch back to async_schedule_dev() Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 45/83] blk-iocost: Fix error on iocost_ioc_vrate_adj Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 46/83] um: ensure `make ARCH=um mrproper` removes arch/$(SUBARCH)/include/generated/ Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 47/83] bpf, x86_32: Fix incorrect encoding in BPF_LDX zero-extension Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 48/83] bpf, x86_32: Fix clobbering of dst for BPF_JSET Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 49/83] bpf, x86_32: Fix logic error in BPF_LDX zero-extension Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 50/83] mm: shmem: disable interrupt when acquiring info->lock in userfaultfd_copy path Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 51/83] xfs: clear PF_MEMALLOC before exiting xfsaild thread Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 52/83] bpf, x86: Fix encoding for lower 8-bit registers in BPF_STX BPF_B Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 53/83] libbpf: Initialize *nl_pid so gcc 10 is happy Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 54/83] net: fec: set GPR bit on suspend by DT configuration Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 55/83] x86: hyperv: report value of misc_features Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 56/83] signal: check sig before setting info in kill_pid_usb_asyncio Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 57/83] afs: Fix length of dump of bad YFSFetchStatus record Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 58/83] xfs: fix partially uninitialized structure in xfs_reflink_remap_extent Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 59/83] ALSA: hda: Release resources at error in delayed probe Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 60/83] ALSA: hda: Keep the controller initialization even if no codecs found Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 61/83] ALSA: hda: Explicitly permit using autosuspend if runtime PM is supported Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 62/83] scsi: target: fix PR IN / READ FULL STATUS for FC Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 63/83] scsi: target: tcmu: reset_ring should reset TCMU_DEV_BIT_BROKEN Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 64/83] objtool: Fix CONFIG_UBSAN_TRAP unreachable warnings Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 65/83] objtool: Support Clang non-section symbols in ORC dump Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 66/83] xen/xenbus: ensure xenbus_map_ring_valloc() returns proper grant status Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 67/83] ALSA: hda: call runtime_allow() for all hda controllers Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 68/83] net: stmmac: socfpga: Allow all RGMII modes Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 69/83] mac80211: fix channel switch trigger from unknown mesh peer Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 70/83] arm64: Delete the space separator in __emit_inst Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 71/83] ext4: use matching invalidatepage in ext4_writepage Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 72/83] ext4: increase wait time needed before reuse of deleted inode numbers Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 73/83] ext4: convert BUG_ONs to WARN_ONs in mballoc.c Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 74/83] blk-mq: Put driver tag in blk_mq_dispatch_rq_list() when no budget Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 75/83] hwmon: (jc42) Fix name to have no illegal characters Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 76/83] taprio: do not use BIT() in TCA_TAPRIO_ATTR_FLAG_* definitions Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 77/83] qed: Fix race condition between scheduling and destroying the slowpath workqueue Greg Kroah-Hartman
2020-05-01 13:23 ` [PATCH 5.4 78/83] Crypto: chelsio - Fixes a hang issue during driver registration Greg Kroah-Hartman
2020-05-01 13:23 ` Greg Kroah-Hartman [this message]
2020-05-01 13:23 ` [PATCH 5.4 80/83] qed: Fix use after free in qed_chain_free Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.4 81/83] ext4: check for non-zero journal inum in ext4_calculate_overhead Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.4 82/83] ASoC: soc-core: disable route checks for legacy devices Greg Kroah-Hartman
2020-05-01 13:24 ` [PATCH 5.4 83/83] ASoC: stm32: spdifrx: fix regmap status check Greg Kroah-Hartman
2020-05-01 15:17 ` [PATCH 5.4 00/83] 5.4.37-rc1 review Jon Hunter
2020-05-01 21:49 ` Naresh Kamboju
2020-05-02  6:49   ` Greg Kroah-Hartman
2020-05-01 22:11 ` Guenter Roeck
2020-05-02 23:15 ` shuah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200501131542.761532213@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).