Netdev List
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Chuck Lever <chuck.lever@oracle.com>,
	Anna Schumaker <anna.schumaker@hammerspace.com>,
	Sasha Levin <sashal@kernel.org>,
	trondmy@kernel.org, anna@kernel.org, cel@kernel.org,
	jlayton@kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, linux-nfs@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH AUTOSEL 6.18-5.10] xprtrdma: Add request-pool slack for delayed recycling
Date: Mon, 31 Aug 2026 09:30:10 -0400	[thread overview]
Message-ID: <20260831133314.4125787-582-sashal@kernel.org> (raw)
In-Reply-To: <20260831133314.4125787-1-sashal@kernel.org>

From: Chuck Lever <chuck.lever@oracle.com>

[ Upstream commit 64bf6892057b746c55bcc045b9492741b72d8d27 ]

After the previous patch gates req recycling on Send completion,
a completed RPC's rpcrdma_req can remain pinned by the sendctx
ring until the next signaled Send completion releases it. The
transmitted-RPC ceiling is unchanged: xprt_request_get_cong()
gates Sends against xprt->cwnd, the RPC/RDMA credit window fed
by server-granted credits and capped at re_max_requests. The
req pool, however, must exceed max_reqs by enough that this
recycle delay does not stall a slot allocation that the credit
window would admit.

The headroom is bounded. frwr_open() sets re_send_batch to
re_max_requests >> 3 -- one in every eight Sends is signaled --
so at most re_send_batch unsignaled Sends can be outstanding
before the next signaled completion releases them. That equals
max_reqs / 8 reqs in the worst case, with a one-slot floor for
small max_reqs values where the right-shift rounds to zero.

The sendctx ring and the hardware Send Queue are not enlarged
to match. Both are sized in rpcrdma_sendctxs_create() and
frwr_query_device() for re_max_requests in-flight Sends, which
is the ceiling the credit window enforces. The pool slack does
not raise that ceiling -- it only lets allocation keep pace
with the credit window during the brief interval in which
earlier reqs are pinned waiting for the next signaled
completion. At any moment, at most re_send_batch sendctxes are
held by unswept unsignaled Sends, leaving the rest of the ring
available for newly admitted Sends.

Allocate max_reqs + DIV_ROUND_UP(max_reqs, 8) request objects
and name the slack calculation at the allocation site so the
1/8 bound stays tied to the Send-signaling batch size.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

Connection lost, reconnecting to https://agentn.us.api5.cursor.sh
(attempt 1)...
Retry attempt 1...
Connection lost, reconnecting to https://agentn.us.api5.cursor.sh
(attempt 2)...
Retry attempt 2...
The background git searches finished and match the earlier analysis:

- **No slack commit in this tree** — searches for `"request-pool
  slack"`, `req_pool_slack`, and `rpcrdma_req_pool_slack` all came back
  empty.
- **Prerequisite is present** — `53442c7d0c888` ("Decouple req recycling
  from RPC completion") is in v6.18.44; patches 1, 2, 4, and 5 of the
  series are there, but patch 3 (pool slack) is missing.
- **`verbs.c` still allocates exactly `max_reqs`** — the regression from
  the incomplete backport is real in this tree.

Verdict unchanged: **YES** for backport to v6.18.44.

 net/sunrpc/xprtrdma/verbs.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index e2d3cee825cd7..8449107b2a095 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -1123,6 +1123,22 @@ static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf)
 	spin_unlock(&buf->rb_lock);
 }
 
+static unsigned int rpcrdma_req_pool_slack(unsigned int max_reqs)
+{
+	/* The sendctx ring can hold up to one Send-signaling batch
+	 * (re_send_batch, set by frwr_open() to re_max_requests >> 3)
+	 * of unfinished Sends. Each pins its req until a signaled Send
+	 * completion releases the sendctx. Size the pool above max_reqs
+	 * by that batch so the recycle delay does not stall a slot
+	 * allocation that the RPC/RDMA credit window would admit.
+	 *
+	 * Round up: re_max_requests >> 3 is zero when max_reqs < 8, but
+	 * a single unsignaled Send is still enough to pin one req. One
+	 * slack slot covers that case.
+	 */
+	return DIV_ROUND_UP(max_reqs, 8);
+}
+
 /**
  * rpcrdma_buffer_create - Create initial set of req/rep objects
  * @r_xprt: transport instance to (re)initialize
@@ -1132,6 +1148,7 @@ static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf)
 int rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt)
 {
 	struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
+	unsigned int max_reqs;
 	int i, rc;
 
 	buf->rb_bc_srv_max_requests = 0;
@@ -1145,7 +1162,9 @@ int rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt)
 	INIT_LIST_HEAD(&buf->rb_all_reps);
 
 	rc = -ENOMEM;
-	for (i = 0; i < r_xprt->rx_xprt.max_reqs; i++) {
+	max_reqs = r_xprt->rx_xprt.max_reqs;
+	max_reqs += rpcrdma_req_pool_slack(max_reqs);
+	for (i = 0; i < max_reqs; i++) {
 		struct rpcrdma_req *req;
 
 		req = rpcrdma_req_create(r_xprt,
-- 
2.53.0


  parent reply	other threads:[~2026-08-31 13:50 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260831133314.4125787-1-sashal@kernel.org>
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-6.12] netconsole: take target_cleanup_list_lock in drop_netconsole_target() Sasha Levin
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-6.6] bridge: Add missing READ_ONCE() annotations around FDB destination port Sasha Levin
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-6.6] net: phy: motorcomm: use device properties for firmware tuning Sasha Levin
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-5.15] dpaa2-switch: rework FDB management on the bridge leave path Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18] net: airoha: Reserve RX headroom to avoid skb reallocation Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-6.1] eth: mlx5: fix macsec dependency Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] phonet: check register_netdevice_notifier() error in phonet_device_init() Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18] net: sfp: apply I2C adapter quirks to limit block size Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] hsr: broadcast netlink notifications in the device's net namespace Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] vhost-scsi: flush backend after device ioctls Sasha Levin
2026-08-31 13:22 ` [PATCH AUTOSEL 6.18-5.10] bridge: Do not suppress ARP probes and DAD NS unconditionally Sasha Levin
2026-08-31 13:22 ` [PATCH AUTOSEL 6.18-5.10] sctp: Unwind address notifier registration on failure Sasha Levin
2026-08-31 13:22 ` [PATCH AUTOSEL 6.18-5.15] ptp: ocp: add shutdown callback Sasha Levin
2026-08-31 13:22 ` [PATCH AUTOSEL 6.18-6.12] net: lan966x: restore RX state on reload failure Sasha Levin
2026-08-31 13:22 ` [PATCH AUTOSEL 6.18-6.6] net/mlx5: E-Switch, align disable sequence with switchdev-to-legacy transition Sasha Levin
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-6.6] tls: Flush backlog before waiting for a new record Sasha Levin
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-5.10] net: dsa: sja1105: flower: reject cross-chip redirect Sasha Levin
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-6.12] net: hns3: improve the unused_tuple parameter setting Sasha Levin
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-6.1] net: thunderx: fix PTP device ref leak in nicvf_probe() Sasha Levin
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-5.10] net: stmmac: xgmac2: disable RBUE in default RX interrupt mask Sasha Levin
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-5.10] ipv6: Honor oif when choosing nexthop for locally generated traffic Sasha Levin
2026-08-31 13:24 ` [PATCH AUTOSEL 6.18-5.10] ipv6: addrconf: fix temp address generation after prefix deprecation Sasha Levin
2026-08-31 13:24 ` [PATCH AUTOSEL 6.18-5.10] net/sched: sch_drr: make cl->quantum lockless Sasha Levin
2026-08-31 13:24 ` [PATCH AUTOSEL 6.18] net: napi: Skip last poll when arming gro timer in busy poll Sasha Levin
2026-08-31 13:24 ` [PATCH AUTOSEL 6.18-5.10] rds: annotate data-race around rs_seen_congestion Sasha Levin
2026-08-31 13:24 ` [PATCH AUTOSEL 6.18-5.10] net: dsa: mv88e6xxx: enable .rmu_disable() for 6320 family Sasha Levin
2026-08-31 13:24 ` [PATCH AUTOSEL 6.18-5.10] net: qrtr: fix node refcount leak on ctrl packet alloc failure Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-5.15] dpaa2-switch: fix handling of NAPI on the remove path Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-5.15] net: dsa: mv88e6xxx: define .pot_clear() for 6321 Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-6.12] net/mlx5e: Verify unique vhca_id count instead of range Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-5.10] ice: pass the return value of skb_checksum_help() Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-6.12] pds_core: quiesce DMA before freeing resources Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-6.12] net/mlx5: HWS, Handle destroying table that has a miss table Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-5.10] rds: filter RDS_INFO_* getsockopt by caller's netns Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18] net: mscc: ocelot: validate netdev belongs to switch in .netdev_to_port() Sasha Levin
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-5.10] e1000e: limit endianness conversion to boundary words Sasha Levin
2026-08-31 13:26 ` [PATCH AUTOSEL 6.18] net: ethtool: cmis_cdb: hold instance lock for ops locked devices Sasha Levin
2026-08-31 13:26 ` [PATCH AUTOSEL 6.18-5.10] net: au1000: move free_irq out of the close-time spinlocked section Sasha Levin
2026-08-31 13:26 ` [PATCH AUTOSEL 6.18-5.10] vsock: use sk_acceptq_is_full() helper in all transports Sasha Levin
2026-08-31 13:26 ` [PATCH AUTOSEL 6.18-6.1] net: dsa: realtek: rtl8365mb: add support for RTL8367SB Sasha Levin
2026-08-31 13:26 ` [PATCH AUTOSEL 6.18-6.12] rtase: Fix flow control configuration Sasha Levin
2026-08-31 13:26 ` [PATCH AUTOSEL 6.18-5.15] dpaa2-switch: fix the error path in dpaa2_switch_rx() Sasha Levin
2026-08-31 13:27 ` [PATCH AUTOSEL 6.18-6.12] ipv6: use READ_ONCE() for bindv6only default in inet6_create() Sasha Levin
2026-08-31 13:27 ` [PATCH AUTOSEL 6.18] net_sched: sch_fq: convert skb->tstamp if not monotonic Sasha Levin
2026-08-31 13:27 ` [PATCH AUTOSEL 6.18] net/mlx5: HWS, Check if device is down while polling for completion Sasha Levin
2026-08-31 13:27 ` [PATCH AUTOSEL 6.18-6.6] net: microchip: sparx5: clean up PSFP resources on flower setup failure Sasha Levin
2026-08-31 13:27 ` [PATCH AUTOSEL 6.18-5.10] xfrm: allow migration from UDP encapsulated to non-encapsulated ESP Sasha Levin
2026-09-01  7:50   ` Antony Antony
2026-09-01  9:14     ` Sabrina Dubroca
2026-09-01 15:08     ` Sasha Levin
2026-08-31 13:27 ` [PATCH AUTOSEL 6.18] net: phy: sfp: detect presence via I2C when no MOD_DEF0 GPIO Sasha Levin
2026-08-31 13:27 ` [PATCH AUTOSEL 6.18-5.10] netlabel: fix IPv6 unlabeled address add error handling Sasha Levin
2026-08-31 13:27 ` [PATCH AUTOSEL 6.18-6.12] net: mana: hardening: Reject zero max_num_queues from MANA_QUERY_VPORT_CONFIG Sasha Levin
2026-08-31 13:28 ` [PATCH AUTOSEL 6.18-5.10] net: ibm: emac: Reserve VLAN header in MJS limit Sasha Levin
2026-08-31 13:28 ` [PATCH AUTOSEL 6.18-6.1] net: wwan: t7xx: Add delay between MD and SAP suspend Sasha Levin
2026-08-31 13:28 ` [PATCH AUTOSEL 6.18-6.12] net: sfp: add quirk for OEM 2.5G optical modules Sasha Levin
2026-08-31 13:28 ` [PATCH AUTOSEL 6.18-6.1] net: phy: sfp: probe for RollBall I2C-to-MDIO bridge in mdio-i2c Sasha Levin
2026-09-01  5:28   ` Petr Wozniak
2026-09-01 15:07     ` Sasha Levin
     [not found]   ` <CALSZ6VYWSva6FY-40n8f-eeinu5qXkPbwXue9N9+=D7iEL+ksg@mail.gmail.com>
2026-09-01 15:07     ` Sasha Levin
2026-08-31 13:28 ` [PATCH AUTOSEL 6.18-5.10] net/sched: act_csum: don't mangle UDP tunnel GSO packets Sasha Levin
2026-08-31 13:28 ` [PATCH AUTOSEL 6.18] net/mlx5: Relax capability check for eswitch query paths Sasha Levin
2026-08-31 13:28 ` [PATCH AUTOSEL 6.18] psp: validate IPv4 header fields in psp_dev_rcv() Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18-5.10] net/rds: Don't sleep inside rds_ib_conn_path_shutdown Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18-5.10] netfilter: nf_conntrack_expect: zero at allocation time Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18] net: sfp: extend SMBus support Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18] bpf, sockmap: reject a packet-modifying SK_SKB stream parser Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18-6.1] net: hsr: require valid EOT supervision TLV Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18-5.10] net: bridge: remove stale rcu_barrier() in br_multicast_dev_del() Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18] net: txgbe: fix phylink leak on AML init failure Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18] net/mlx5: Switch vport HCA cap helpers to kvzalloc Sasha Levin
2026-08-31 13:30 ` [PATCH AUTOSEL 6.18-5.10] netfilter: ipset: mark the rcu locked areas properly Sasha Levin
2026-08-31 13:30 ` Sasha Levin [this message]
2026-08-31 13:30 ` [PATCH AUTOSEL 6.18] netfilter: nf_tables: use DEBUG_NET_WARN_ON_ONCE in packet and control paths Sasha Levin
2026-08-31 13:30 ` [PATCH AUTOSEL 6.18-6.1] tls: reject the combination of TLS and sockmap Sasha Levin
2026-09-01  9:36   ` Sabrina Dubroca
2026-09-01 15:09     ` Sasha Levin
2026-09-02 15:35       ` Sabrina Dubroca
2026-08-31 13:30 ` [PATCH AUTOSEL 6.18-5.10] netfilter: nf_conntrack: use get_unaligned_be32() in tcp_sack() Sasha Levin
2026-08-31 13:30 ` [PATCH AUTOSEL 6.18-5.10] net: usb: qmi_wwan: add MeiG SRM813Q Sasha Levin
2026-08-31 13:30 ` [PATCH AUTOSEL 6.18-5.10] net: cpsw_new: unregister devlink on port registration failure Sasha Levin
2026-08-31 13:30 ` [PATCH AUTOSEL 6.18] net: ibm: emac: fix unchecked platform_get_irq return value Sasha Levin
2026-08-31 13:31 ` [PATCH AUTOSEL 6.18-5.10] net: ibm: emac: mal: fix potential system hang in mal_remove() Sasha Levin
2026-08-31 13:31 ` [PATCH AUTOSEL 6.18-5.15] netfilter: nfnetlink_log: wait for rcu grace period before freeing pernet state Sasha Levin
2026-08-31 13:31 ` [PATCH AUTOSEL 6.18-6.6] net: dsa: qca8k: Add support for force mode for fixed link topology Sasha Levin
2026-08-31 13:31 ` [PATCH AUTOSEL 6.18] net: ibm: emac: mal: fix unchecked platform_get_irq return values Sasha Levin
2026-08-31 13:31 ` [PATCH AUTOSEL 6.18-5.10] net: dsa: mv88e6xxx: fix number of g1 interrupts for 6320 family Sasha Levin
2026-08-31 13:31 ` [PATCH AUTOSEL 6.18] net: ensure SCM_TXTIME delivery time is no older than system boot Sasha Levin

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=20260831133314.4125787-582-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=anna.schumaker@hammerspace.com \
    --cc=anna@kernel.org \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jlayton@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=trondmy@kernel.org \
    /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