1 From: Vasu Dev <vasu.dev@intel.com>
2 Subject: [FcOE] improved load balancing in rx path
3 References: bnc #459142
5 Currently incoming frame exchange id ANDing with total number of bits
6 in online CPU bits mask, resulted only at most two CPUs selection in
7 rx path, so instead used online CPU bits mask to direct incoming frame
8 to a all cpus for better load balancing.
10 Added code to default to first CPU in case selected CPU is offline or
11 its rx thread not present.
13 Signed-off-by: Vasu Dev <vasu.dev@intel.com>
14 Acked-by: Bernhard Walle <bwalle@suse.de>
17 drivers/scsi/fcoe/libfcoe.c | 13 +++++++------
18 1 file changed, 7 insertions(+), 6 deletions(-)
21 --- a/drivers/scsi/fcoe/libfcoe.c
22 +++ b/drivers/scsi/fcoe/libfcoe.c
23 @@ -230,13 +230,14 @@ int fcoe_rcv(struct sk_buff *skb, struct
27 - * The exchange ID are ANDed with num of online CPUs,
28 - * so that will have the least lock contention in
29 - * handling the exchange. if there is no thread
30 - * for a given idx then use first online cpu.
31 + * The incoming frame exchange id(oxid) is ANDed with num of online
32 + * cpu bits to get cpu_idx and then this cpu_idx is used for selecting
33 + * a per cpu kernel thread from fcoe_percpu. In case the cpu is
34 + * offline or no kernel thread for derived cpu_idx then cpu_idx is
35 + * initialize to first online cpu index.
37 - cpu_idx = oxid & (num_online_cpus() >> 1);
38 - if (fcoe_percpu[cpu_idx] == NULL)
39 + cpu_idx = oxid & (num_online_cpus() - 1);
40 + if (!fcoe_percpu[cpu_idx] || !cpu_online(cpu_idx))
41 cpu_idx = first_cpu(cpu_online_map);
43 fps = fcoe_percpu[cpu_idx];