[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201201161441.GG5487@ziepe.ca>
Date: Tue, 1 Dec 2020 12:14:41 -0400
From: Jason Gunthorpe <jgg@...pe.ca>
To: "Saleem, Shiraz" <shiraz.saleem@...el.com>
Cc: Yejune Deng <yejune.deng@...il.com>,
"Latif, Faisal" <faisal.latif@...el.com>,
"dledford@...hat.com" <dledford@...hat.com>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] infiniband: i40iw: replace atomic_add_return()
On Tue, Dec 01, 2020 at 02:42:25PM +0000, Saleem, Shiraz wrote:
> > case I40IW_CM_STATE_ESTABLISHED:
> > case I40IW_CM_STATE_SYN_RCVD:
> > @@ -3020,7 +3020,7 @@ static int i40iw_cm_reject(struct i40iw_cm_node
> > *cm_node, const void *pdata, u8
> > i40iw_cleanup_retrans_entry(cm_node);
> >
> > if (!loopback) {
> > - passive_state = atomic_add_return(1, &cm_node->passive_state);
> > + passive_state = atomic_inc_return(&cm_node->passive_state);
>
> Fine with it as its consistent across i40iw. But aren't there many
> more instances of this across the tree? Isn't this a choice best
> left to the developer?
I don't think it is a style choice, the narrowest applicable atomic
should always be used as a matter of clarity and performance.
Jason
Powered by blists - more mailing lists