linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qib_keys: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
@ 2014-08-18 12:32 Andreea-Cristina Bernat
  2014-09-19 12:51 ` Marciniszyn, Mike
  0 siblings, 1 reply; 2+ messages in thread
From: Andreea-Cristina Bernat @ 2014-08-18 12:32 UTC (permalink / raw)
  To: infinipath, roland, sean.hefty, hal.rosenstock, linux-rdma, linux-kernel
  Cc: paulmck

The uses of "rcu_assign_pointer()" are NULLing out the pointers.
According to RCU_INIT_POINTER()'s block comment:
"1.   This use of RCU_INIT_POINTER() is NULLing out the pointer"
it is better to use it instead of rcu_assign_pointer() because it has a
smaller overhead.

The following Coccinelle semantic patch was used:
@@
@@

- rcu_assign_pointer
+ RCU_INIT_POINTER
  (..., NULL)

Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
---
 drivers/infiniband/hw/qib/qib_keys.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_keys.c b/drivers/infiniband/hw/qib/qib_keys.c
index 3b9afcc..ad843c7 100644
--- a/drivers/infiniband/hw/qib/qib_keys.c
+++ b/drivers/infiniband/hw/qib/qib_keys.c
@@ -122,10 +122,10 @@ void qib_free_lkey(struct qib_mregion *mr)
 	if (!mr->lkey_published)
 		goto out;
 	if (lkey == 0)
-		rcu_assign_pointer(dev->dma_mr, NULL);
+		RCU_INIT_POINTER(dev->dma_mr, NULL);
 	else {
 		r = lkey >> (32 - ib_qib_lkey_table_size);
-		rcu_assign_pointer(rkt->table[r], NULL);
+		RCU_INIT_POINTER(rkt->table[r], NULL);
 	}
 	qib_put_mr(mr);
 	mr->lkey_published = 0;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] qib_keys: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
  2014-08-18 12:32 [PATCH] qib_keys: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Andreea-Cristina Bernat
@ 2014-09-19 12:51 ` Marciniszyn, Mike
  0 siblings, 0 replies; 2+ messages in thread
From: Marciniszyn, Mike @ 2014-09-19 12:51 UTC (permalink / raw)
  To: Andreea-Cristina Bernat
  Cc: paulmck, roland, Hefty, Sean, hal.rosenstock, linux-rdma, linux-kernel

> Subject: [PATCH] qib_keys: Replace rcu_assign_pointer() with
> RCU_INIT_POINTER()
> 

I would prefer the summary be:
IB/qib: qib_remove_lkey()  Replace rcu_assign_pointer() with
> RCU_INIT_POINTER()

Otherwise the patch looks ok and has been tested.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-19 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-18 12:32 [PATCH] qib_keys: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Andreea-Cristina Bernat
2014-09-19 12:51 ` Marciniszyn, Mike

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