Re: [PATCH] fixup "qla2xxx: Optimize NPIV tear down process"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/2/19 8:25 AM, Martin Wilck wrote:
> On Wed, 2019-10-02 at 08:17 -0700, Bart Van Assche wrote:
>>
>> Both loops check the loop termination condition twice. Has it been
>> considered to write these loops such that the loop termination
>> condition
>> is only tested once, e.g. using the following pattern?
>>
>> for (i = 0; i < 10; i++)
>> 	if (wait_event_timeout(...) > 0)
>> 		break;
>>
> 
> Right, that's probably better. This was just meant as a minimal,
> temporary fix for the already applied patch. I expect Himanshu or Quinn
> to follow up anyway.
> 
> I also still think that it'd be better to get the wake_up() calls
> right and not have to loop over wait_event_timeout() at all.

Such a loop is most useful if some status information is reported during
every iteration. An example from the SCSI target code:

do {
	ret = wait_event_timeout(se_sess->cmd_list_wq,
			percpu_ref_is_zero(&se_sess->cmd_count),
			180 * HZ);
	list_for_each_entry(cmd, &se_sess->sess_cmd_list, se_cmd_list)
		target_show_cmd("session shutdown: still waiting for ",
				cmd);
} while (ret <= 0);

Bart.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux