linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Liuyixian (Eason)" <liuyixian@huawei.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: <dledford@redhat.com>, <leon@kernel.org>,
	<linux-rdma@vger.kernel.org>, <linuxarm@huawei.com>
Subject: Re: [PATCH v7 for-next 2/2] RDMA/hns: Delayed flush cqe process with workqueue
Date: Tue, 4 Feb 2020 15:41:37 +0800	[thread overview]
Message-ID: <ecef1a64-6aa0-c1f9-e0f8-cc40329eb335@huawei.com> (raw)
In-Reply-To: <20200128195643.GA8107@ziepe.ca>



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);

> 
> 


  reply	other threads:[~2020-02-04  7:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15  9:49 [PATCH v7 for-next 0/2] RDMA/hns: Add the workqueue framework for flush cqe handler Yixian Liu
2020-01-15  9:49 ` [PATCH v7 for-next 1/2] " Yixian Liu
2020-01-15  9:49 ` [PATCH v7 for-next 2/2] RDMA/hns: Delayed flush cqe process with workqueue Yixian Liu
2020-01-28 19:56   ` Jason Gunthorpe
2020-02-04  7:41     ` Liuyixian (Eason) [this message]
2020-01-28 20:05   ` Jason Gunthorpe
2020-02-04  8:47     ` Liuyixian (Eason)
2020-02-05 20:30       ` Jason Gunthorpe
2020-02-06  9:14         ` Liuyixian (Eason)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ecef1a64-6aa0-c1f9-e0f8-cc40329eb335@huawei.com \
    --to=liuyixian@huawei.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).