[PATCH] events/uprobes: move smp_read_barrier_depends() where needed
From: Andrea Parri
Date: Thu Jun 09 2016 - 14:19:06 EST
There is no need to use the barrier if there is no dereference/
memory access; move it where needed (currently, affecting only
Alpha). While touching this, also make the reads _ONCE().
Signed-off-by: Andrea Parri <parri.andrea@xxxxxxxxx>
---
kernel/events/uprobes.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index b7a525ab2083..b1364acd683e 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1520,10 +1520,11 @@ static unsigned long get_trampoline_vaddr(void)
struct xol_area *area;
unsigned long trampoline_vaddr = -1;
- area = current->mm->uprobes_state.xol_area;
- smp_read_barrier_depends();
- if (area)
- trampoline_vaddr = area->vaddr;
+ area = READ_ONCE(current->mm->uprobes_state.xol_area);
+ if (area) {
+ smp_read_barrier_depends();
+ trampoline_vaddr = READ_ONCE(area->vaddr);
+ }
return trampoline_vaddr;
}
--
1.9.1