Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1427009
| From | Davidlohr Bueso <dave@stgolabs.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 08/12] infiniband: Employ atomic_fetch_inc() |
| Date | 2016-06-20 22:20 +0200 |
| Message-ID | <rMdPQ-4rx-29@gated-at.bofh.it> (permalink) |
| References | <rMdG9-4no-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Now that we have fetch_inc() we can stop using inc_return() - 1. These are very similar to the existing OP-RETURN primitives we already have, except they return the value of the atomic variable _before_ modification. Cc: Doug Ledford <dledford@redhat.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Signed-off-by: Davidlohr Bueso <dbueso@suse.de> --- drivers/infiniband/hw/cxgb4/device.c | 3 +-- drivers/infiniband/hw/hfi1/verbs.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index ae2e8b23d2dd..a32959fa2c82 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c @@ -111,8 +111,7 @@ void c4iw_log_wr_stats(struct t4_wq *wq, struct t4_cqe *cqe) if (!wq->rdev->wr_log) return; - idx = (atomic_inc_return(&wq->rdev->wr_log_idx) - 1) & - (wq->rdev->wr_log_size - 1); + idx = atomic_fetch_inc(&wq->rdev->wr_log_idx) & (wq->rdev->wr_log_size - 1); le.poll_sge_ts = cxgb4_read_sge_timestamp(wq->rdev->lldi.ports[0]); getnstimeofday(&le.poll_host_ts); le.valid = 1; diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c index 849c4b9399d4..9ba311b53085 100644 --- a/drivers/infiniband/hw/hfi1/verbs.c +++ b/drivers/infiniband/hw/hfi1/verbs.c @@ -261,8 +261,7 @@ static void wss_advance_clean_counter(void) * wss.clean_entry. The table size, wss.num_entries, * is always a power-of-2. */ - entry = (atomic_inc_return(&wss.clean_entry) - 1) - & (wss.num_entries - 1); + entry = atomic_fetch_inc(&wss.clean_entry) & (wss.num_entries - 1); /* clear the entry and count the bits */ bits = xchg(&wss.entries[entry], 0); -- 2.6.6
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 08/12] infiniband: Employ atomic_fetch_inc() Davidlohr Bueso <dave@stgolabs.net> - 2016-06-20 22:20 +0200
csiph-web