lkml.org 
[lkml]   [2016]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
From
Date
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);
>

\
 
 \ /
  Last update: 2016-05-01 18:21    [W:0.045 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site