public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi/fcoe: remove fcoe_select_cpu()
@ 2025-06-05  6:20 Hannes Reinecke
  2025-06-10  1:30 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2025-06-05  6:20 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: James Bottomley, Bart van Assche, Yury Norov, linux-scsi,
	Hannes Reinecke

The function fcoe_select_cpu() is just used to distribute incoming
skbs which start a new FC command sequence. But the network stack
already received (and processed) that skb, and there is a _really_
good chance that all subsequent skbs for this sequence will be
handled with the same CPU. So we should just use the cpu on which
this skb was allocated on and save ourselves some overhead due
to pointless scheduling.

Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
 drivers/scsi/fcoe/fcoe.c | 22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index b911fdb387f3..4912087de10d 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -1299,26 +1299,6 @@ static void fcoe_thread_cleanup_local(unsigned int cpu)
 	flush_work(&p->work);
 }
 
-/**
- * fcoe_select_cpu() - Selects CPU to handle post-processing of incoming
- *			command.
- *
- * This routine selects next CPU based on cpumask to distribute
- * incoming requests in round robin.
- *
- * Returns: int CPU number
- */
-static inline unsigned int fcoe_select_cpu(void)
-{
-	static unsigned int selected_cpu;
-
-	selected_cpu = cpumask_next(selected_cpu, cpu_online_mask);
-	if (selected_cpu >= nr_cpu_ids)
-		selected_cpu = cpumask_first(cpu_online_mask);
-
-	return selected_cpu;
-}
-
 /**
  * fcoe_rcv() - Receive packets from a net device
  * @skb:    The received packet
@@ -1405,7 +1385,7 @@ static int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev,
 		cpu = ntohs(fh->fh_ox_id) & fc_cpu_mask;
 	else {
 		if (ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN)
-			cpu = fcoe_select_cpu();
+			cpu = skb->alloc_cpu;
 		else
 			cpu = ntohs(fh->fh_rx_id) & fc_cpu_mask;
 	}
-- 
2.35.3


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

end of thread, other threads:[~2025-06-10  1:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-05  6:20 [PATCH] scsi/fcoe: remove fcoe_select_cpu() Hannes Reinecke
2025-06-10  1:30 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox