linux-rdma.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
       [not found] ` <1462106131-9073-1-git-send-email-falakreyaz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Muhammad Falak R Wani @ 2016-05-01 12:35 UTC (permalink / raw)
  Cc: Mike Marciniszyn, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] staging/rdma/hfi1: use RCU_INIT_POINTER() when NULLing.
       [not found] ` <1462106131-9073-1-git-send-email-falakreyaz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 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-u79uwXL29TY76Z2rM5mHXA, Mike Marciniszyn,
	Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b

[-- Attachment #1: Type: text/plain, Size: 1469 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

> ---
>  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-u79uwXL29TY76Z2rM5mHXA@public.gmane.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.
       [not found] ` <1462106131-9073-1-git-send-email-falakreyaz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  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-u79uwXL29TY76Z2rM5mHXA
  Cc: Mike Marciniszyn, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b

[-- Attachment #1: Type: text/plain, Size: 1054 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              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
     [not found] ` <1462106131-9073-1-git-send-email-falakreyaz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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).