linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging/rdma/hfi1: use RCU_INIT_POINTER() when NULLing.
@ 2016-05-01 12:35 Muhammad Falak R Wani
  2016-05-02  5:27 ` Leon Romanovsky
  2016-05-13 19:38 ` Doug Ledford
  0 siblings, 2 replies; 3+ messages in thread
From: Muhammad Falak R Wani @ 2016-05-01 12:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mike Marciniszyn, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma, devel, linux-kernel

It is safe to use RCU_INIT_POINTER() to NULL a pointer, instead of
rcu_assign_pointer().
This results in slightly smaller/faster code.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
 drivers/staging/rdma/hfi1/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c
index cfcdc16..34e0f90 100644
--- a/drivers/staging/rdma/hfi1/init.c
+++ b/drivers/staging/rdma/hfi1/init.c
@@ -1303,7 +1303,7 @@ static void cleanup_device_data(struct hfi1_devdata *dd)
 
 		spin_lock(&ppd->cc_state_lock);
 		cc_state = get_cc_state(ppd);
-		rcu_assign_pointer(ppd->cc_state, NULL);
+		RCU_INIT_POINTER(ppd->cc_state, NULL);
 		spin_unlock(&ppd->cc_state_lock);
 
 		if (cc_state)
-- 
1.9.1

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

* Re: [PATCH] staging/rdma/hfi1: use RCU_INIT_POINTER() when NULLing.
  2016-05-01 12:35 [PATCH] staging/rdma/hfi1: use RCU_INIT_POINTER() when NULLing Muhammad Falak R Wani
@ 2016-05-02  5:27 ` Leon Romanovsky
  2016-05-13 19:38 ` Doug Ledford
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2016-05-02  5:27 UTC (permalink / raw)
  To: Muhammad Falak R Wani
  Cc: linux-kernel, Mike Marciniszyn, Doug Ledford, Sean Hefty,
	Hal Rosenstock, linux-rdma, devel

[-- Attachment #1: Type: text/plain, Size: 1388 bytes --]

On Sun, May 01, 2016 at 06:05:31PM +0530, Muhammad Falak R Wani wrote:
> It is safe to use RCU_INIT_POINTER() to NULL a pointer, instead of
> rcu_assign_pointer().
> This results in slightly smaller/faster code.
> 
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>

I'm fine with your commit message and don't need to resend, however
the statements like "smaller code" need to be supported by
./scripts/bloat-o-meter and "faster code" by performance analysis.

Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

> ---
>  drivers/staging/rdma/hfi1/init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c
> index cfcdc16..34e0f90 100644
> --- a/drivers/staging/rdma/hfi1/init.c
> +++ b/drivers/staging/rdma/hfi1/init.c
> @@ -1303,7 +1303,7 @@ static void cleanup_device_data(struct hfi1_devdata *dd)
>  
>  		spin_lock(&ppd->cc_state_lock);
>  		cc_state = get_cc_state(ppd);
> -		rcu_assign_pointer(ppd->cc_state, NULL);
> +		RCU_INIT_POINTER(ppd->cc_state, NULL);
>  		spin_unlock(&ppd->cc_state_lock);
>  
>  		if (cc_state)
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] staging/rdma/hfi1: use RCU_INIT_POINTER() when NULLing.
  2016-05-01 12:35 [PATCH] staging/rdma/hfi1: use RCU_INIT_POINTER() when NULLing Muhammad Falak R Wani
  2016-05-02  5:27 ` Leon Romanovsky
@ 2016-05-13 19:38 ` Doug Ledford
  1 sibling, 0 replies; 3+ messages in thread
From: Doug Ledford @ 2016-05-13 19:38 UTC (permalink / raw)
  To: Muhammad Falak R Wani, linux-kernel
  Cc: Mike Marciniszyn, Sean Hefty, Hal Rosenstock, linux-rdma, devel

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

On 05/01/2016 08:35 AM, Muhammad Falak R Wani wrote:
> It is safe to use RCU_INIT_POINTER() to NULL a pointer, instead of
> rcu_assign_pointer().
> This results in slightly smaller/faster code.
> 
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
> ---
>  drivers/staging/rdma/hfi1/init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c
> index cfcdc16..34e0f90 100644
> --- a/drivers/staging/rdma/hfi1/init.c
> +++ b/drivers/staging/rdma/hfi1/init.c
> @@ -1303,7 +1303,7 @@ static void cleanup_device_data(struct hfi1_devdata *dd)
>  
>  		spin_lock(&ppd->cc_state_lock);
>  		cc_state = get_cc_state(ppd);
> -		rcu_assign_pointer(ppd->cc_state, NULL);
> +		RCU_INIT_POINTER(ppd->cc_state, NULL);
>  		spin_unlock(&ppd->cc_state_lock);
>  
>  		if (cc_state)
> 

Thanks, applied.

-- 
Doug Ledford <dledford@redhat.com>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

end of thread, other threads:[~2016-05-13 19:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-01 12:35 [PATCH] staging/rdma/hfi1: use RCU_INIT_POINTER() when NULLing Muhammad Falak R Wani
2016-05-02  5:27 ` Leon Romanovsky
2016-05-13 19:38 ` Doug Ledford

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