[PATCH] sunrpc: drop unneeded nrpools check in svc_pool_for_cpu()

From: Jeff Layton

Date: Wed Jul 08 2026 - 08:03:22 EST


As Neil pointed out in review:

"The values stored in svc_pool_map.to_pool are all less than
svc_pool_map.npools. So that if() condition cannot be true."

Drop the useless check from this hotpath.

Suggested-by: NeilBrown <neil@xxxxxxxxxx>
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
Chuck, feel free to fold this into 5/5 of the pool_mode series.
---
net/sunrpc/svc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 13d63f6b1d88..a098e1c13ca3 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -269,10 +269,6 @@ struct svc_pool *svc_pool_for_cpu(struct svc_serv *serv)
if (nrpools <= 1)
return serv->sv_pools;

- pidx = m->to_pool[cpu_to_node(raw_smp_processor_id())];
- if (pidx >= nrpools)
- pidx = 0;
-
/*
* It's possible to have a pool with no threads. Userland can just set
* things up this way directly. Also, when threads are autodistributed
@@ -284,6 +280,7 @@ struct svc_pool *svc_pool_for_cpu(struct svc_serv *serv)
* populated pool, trading NUMA locality for a guarantee that the
* transport is serviced.
*/
+ pidx = m->to_pool[cpu_to_node(raw_smp_processor_id())];
for (i = 0; i < nrpools; i++) {
struct svc_pool *pool = &serv->sv_pools[pidx];


---
base-commit: 9435623ac560654825a62ee4b628ae4bbaa87920
change-id: 20260708-pool-mode-2f6e2d652174

Best regards,
--
Jeff Layton <jlayton@xxxxxxxxxx>