[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1395600549-10314-1-git-send-email-monamagarwal123@gmail.com>
Date: Mon, 24 Mar 2014 00:19:08 +0530
From: Monam Agarwal <monamagarwal123@...il.com>
To: a.p.zijlstra@...llo.nl, paulus@...ba.org, mingo@...hat.com,
acme@...stprotocols.net, linux-kernel@...r.kernel.org
Subject: [PATCH 30/47] kernel: Use RCU_INIT_POINTER(x, NULL) in events/core.c
This patch replaces rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL)
The rcu_assign_pointer() ensures that the initialization of a structure
is carried out before storing a pointer to that structure.
And in the case of the NULL pointer, there is no structure to initialize.
So, rcu_assign_pointer(p, NULL) can be safely converted to RCU_INIT_POINTER(p, NULL)
Signed-off-by: Monam Agarwal <monamagarwal123@...il.com>
---
kernel/events/core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index fa0b2d4..8c22758 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3247,7 +3247,7 @@ static void free_event(struct perf_event *event)
mutex_lock(&event->mmap_mutex);
rb = event->rb;
if (rb) {
- rcu_assign_pointer(event->rb, NULL);
+ RCU_INIT_POINTER(event->rb, NULL);
ring_buffer_detach(event, rb);
ring_buffer_put(rb); /* could be last */
}
@@ -3938,7 +3938,7 @@ static void perf_mmap_close(struct vm_area_struct *vma)
return;
/* Detach current event from the buffer. */
- rcu_assign_pointer(event->rb, NULL);
+ RCU_INIT_POINTER(event->rb, NULL);
ring_buffer_detach(event, rb);
mutex_unlock(&event->mmap_mutex);
@@ -3977,7 +3977,7 @@ again:
* iterating the wrong list.
*/
if (event->rb == rb) {
- rcu_assign_pointer(event->rb, NULL);
+ RCU_INIT_POINTER(event->rb, NULL);
ring_buffer_detach(event, rb);
ring_buffer_put(rb); /* can't be last, we still have one */
}
@@ -5690,7 +5690,7 @@ static void swevent_hlist_release(struct swevent_htable *swhash)
if (!hlist)
return;
- rcu_assign_pointer(swhash->swevent_hlist, NULL);
+ RCU_INIT_POINTER(swhash->swevent_hlist, NULL);
kfree_rcu(hlist, rcu_head);
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists