Skip to content

Commit 8b0b146

Browse files
Hannes Reineckemartinkpetersen
authored andcommitted
scsi: fcoe: Remove fcoe_select_cpu()
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> Link: https://lore.kernel.org/r/20250605062014.105302-1-hare@kernel.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 19272b3 commit 8b0b146

1 file changed

Lines changed: 1 addition & 21 deletions

File tree

drivers/scsi/fcoe/fcoe.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,26 +1299,6 @@ static void fcoe_thread_cleanup_local(unsigned int cpu)
12991299
flush_work(&p->work);
13001300
}
13011301

1302-
/**
1303-
* fcoe_select_cpu() - Selects CPU to handle post-processing of incoming
1304-
* command.
1305-
*
1306-
* This routine selects next CPU based on cpumask to distribute
1307-
* incoming requests in round robin.
1308-
*
1309-
* Returns: int CPU number
1310-
*/
1311-
static inline unsigned int fcoe_select_cpu(void)
1312-
{
1313-
static unsigned int selected_cpu;
1314-
1315-
selected_cpu = cpumask_next(selected_cpu, cpu_online_mask);
1316-
if (selected_cpu >= nr_cpu_ids)
1317-
selected_cpu = cpumask_first(cpu_online_mask);
1318-
1319-
return selected_cpu;
1320-
}
1321-
13221302
/**
13231303
* fcoe_rcv() - Receive packets from a net device
13241304
* @skb: The received packet
@@ -1405,7 +1385,7 @@ static int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev,
14051385
cpu = ntohs(fh->fh_ox_id) & fc_cpu_mask;
14061386
else {
14071387
if (ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN)
1408-
cpu = fcoe_select_cpu();
1388+
cpu = skb->alloc_cpu;
14091389
else
14101390
cpu = ntohs(fh->fh_rx_id) & fc_cpu_mask;
14111391
}

0 commit comments

Comments
 (0)