Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1391656 > unrolled thread

[PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()

Started byMuhammad Falak R Wani <falakreyaz@gmail.com>
First post2016-04-30 21:10 +0200
Last post2016-05-02 16:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Muhammad Falak R Wani <falakreyaz@gmail.com> - 2016-04-30 21:10 +0200
    Re: [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Alex Deucher <alexdeucher@gmail.com> - 2016-05-02 16:50 +0200

#1391656 — [PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()

FromMuhammad Falak R Wani <falakreyaz@gmail.com>
Date2016-04-30 21:10 +0200
Subject[PATCH] drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
Message-ID<rtIr8-4hO-23@gated-at.bofh.it>
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.

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>
---
 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);
 
-- 
1.9.1

[toc] | [next] | [standalone]


#1392255

FromAlex Deucher <alexdeucher@gmail.com>
Date2016-05-02 16:50 +0200
Message-ID<runkE-58W-51@gated-at.bofh.it>
In reply to#1391656
On Sun, May 1, 2016 at 11:26 AM, Christian König
<christian.koenig@amd.com> wrote:
> 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>

Applied.  thanks!

Alex


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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web