Re: [PATCH v7 for-next 2/2] RDMA/hns: Delayed flush cqe process with workqueue

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

 




On 2020/1/29 3:56, Jason Gunthorpe wrote:
> On Wed, Jan 15, 2020 at 05:49:13PM +0800, Yixian Liu wrote:
>> -			if (ret) {
>> -				spin_unlock_irqrestore(&qp->sq.lock, flags);
>> -				*bad_wr = wr;
>> -				return ret;
>> +			if (atomic_read(&qp->flush_cnt) == 0) {
>> +				atomic_set(&qp->flush_cnt, 1);
>> +				init_flush_work(hr_dev, qp);
>> +			} else {
>> +				atomic_inc(&qp->flush_cnt);
>>  			}
> 
> Surely this should be written using atomic_add_return ??
> 
> Jason

Hi Jason,

Thanks very much for your good suggestion!
The code then can be simplified as:

if (atomic_add_return(1, &qp->flush_cnt) == 1)
	init_flush_work(hr_dev, qp);

> 
> 




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux