All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Muhammad Falak R Wani <falakreyaz@gmail.com>,
	David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
Date: Sun, 1 May 2016 17:26:54 +0200	[thread overview]
Message-ID: <5726203E.7060308@amd.com> (raw)
In-Reply-To: <1462042824-10851-1-git-send-email-falakreyaz@gmail.com>

Am 30.04.2016 um 21:00 schrieb Muhammad Falak R Wani:
> The rcu_assign_pointer() ensures that the initialization of a structure
> is carried out before storing a pointer to that structre. It is always
> safe to use RCU_INIT_POINTER() to NULL a pointer, instead of
> rcu_assign_pointer().
> This results in slightly smaller/faster code.

Thanks for the detailed explanation, I was already wondering what the 
difference is between the two.

>
> The following semantic patch was used:
> <smpl>
>
> @@
> @@
>
> - rcu_assign_pointer
> + RCU_INIT_POINTER
>    (..., NULL)
>
> </smpl>
>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index d81f1f4..4500ff1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -198,7 +198,7 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
>   
>   		/* There is always exactly one thread signaling this fence slot */
>   		fence = rcu_dereference_protected(*ptr, 1);
> -		rcu_assign_pointer(*ptr, NULL);
> +		RCU_INIT_POINTER(*ptr, NULL);
>   
>   		BUG_ON(!fence);
>   

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: "Christian König" <christian.koenig@amd.com>
To: Muhammad Falak R Wani <falakreyaz@gmail.com>,
	David Airlie <airlied@linux.ie>
Cc: Chunming Zhou <David1.Zhou@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
Date: Sun, 1 May 2016 17:26:54 +0200	[thread overview]
Message-ID: <5726203E.7060308@amd.com> (raw)
In-Reply-To: <1462042824-10851-1-git-send-email-falakreyaz@gmail.com>

Am 30.04.2016 um 21:00 schrieb Muhammad Falak R Wani:
> The rcu_assign_pointer() ensures that the initialization of a structure
> is carried out before storing a pointer to that structre. It is always
> safe to use RCU_INIT_POINTER() to NULL a pointer, instead of
> rcu_assign_pointer().
> This results in slightly smaller/faster code.

Thanks for the detailed explanation, I was already wondering what the 
difference is between the two.

>
> The following semantic patch was used:
> <smpl>
>
> @@
> @@
>
> - rcu_assign_pointer
> + RCU_INIT_POINTER
>    (..., NULL)
>
> </smpl>
>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index d81f1f4..4500ff1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -198,7 +198,7 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
>   
>   		/* There is always exactly one thread signaling this fence slot */
>   		fence = rcu_dereference_protected(*ptr, 1);
> -		rcu_assign_pointer(*ptr, NULL);
> +		RCU_INIT_POINTER(*ptr, NULL);
>   
>   		BUG_ON(!fence);
>   

  reply	other threads:[~2016-05-01 15:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-30 19:00 [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Muhammad Falak R Wani
2016-05-01 15:26 ` Christian König [this message]
2016-05-01 15:26   ` Christian König
2016-05-02 14:46   ` Alex Deucher
2016-05-02 14:46     ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5726203E.7060308@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=falakreyaz@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.