[PATCH 06/10] nvmet_fc: Reduce work_q count
James Smart
james.smart at broadcom.com
Mon May 15 15:39:13 PDT 2017
On 5/14/2017 11:40 PM, Hannes Reinecke wrote:
> On 05/13/2017 09:03 PM, James Smart wrote:
>> +static u32 nvmet_fc_cpu_cnt;
>> +static DEFINE_PER_CPU(struct nvmet_fc_work_by_cpu, nvmet_fc_cpu_workcpu);
>> +#define nvmet_fc_workcpu(cpu) (&per_cpu(nvmet_fc_cpu_workcpu, cpu))
>>
>> ...
>> +static void
>> +nvmet_fc_delete_workqueues(void)
>> +{
>> + struct nvmet_fc_work_by_cpu *workcpu;
>> + int i;
>> +
>> + for (i = 0; i < nvmet_fc_cpu_cnt; i++, workcpu++) {
>> + workcpu = nvmet_fc_workcpu(i);
>> +
>> + /* sanity check - all work should be removed */
>> + if (!list_empty(&workcpu->fod_list))
>> + pr_warn("%s: cpu %d worklist not empty\n", __func__, i);
>> +
>> + if (workcpu->work_q)
>> + destroy_workqueue(workcpu->work_q);
>> + }
>> +}
>> +
>> ...
>>
> Per-cpu ptr?
> Check drivers/scsi/fcoe/fcoe.c:fcoe_init() for reference.
As you can see above - I'm using per_cpu(), which is actually "#define
per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))". So I'm already
using it.
-- james
More information about the Linux-nvme
mailing list