Skip to contentSkip to conversation

sunrpc: drop unneeded nrpools check in svc_pool_for_cpu()

PATCH In review Jeff Layton 2 participants 2 messages Jul 8

Subsystems (3)
lore
Share & tools
lore

Jeff Layton

author maintainer
#0 lore raw

PATCH 1/1 sunrpc: drop unneeded nrpools check in svc_pool_for_cpu()

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.

---
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(-)
net/sunrpc/svc.c +1 -4
index 13d63f6b1d88..a098e1c13ca3 100644
@@ -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,

Signature · 1 line
Jeff Layton <[email protected]>
maintainer
#1 lore raw
Quoted 11 lines · Jeff Layton

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.

---
Chuck, feel free to fold this into 5/5 of the pool_mode series.

Folded in to 5/5 and pushed out to nfsd-testing.

Signature · 1 line
Chuck Lever