1 From af2c1401e6f9177483be4fad876d0073669df9df Mon Sep 17 00:00:00 2001
2 From: Mel Gorman <mgorman@suse.de>
3 Date: Wed, 18 Dec 2013 17:08:45 -0800
4 Subject: mm: numa: guarantee that tlb_flush_pending updates are visible before page table updates
6 From: Mel Gorman <mgorman@suse.de>
8 commit af2c1401e6f9177483be4fad876d0073669df9df upstream.
10 According to documentation on barriers, stores issued before a LOCK can
11 complete after the lock implying that it's possible tlb_flush_pending
12 can be visible after a page table update. As per revised documentation,
13 this patch adds a smp_mb__before_spinlock to guarantee the correct
16 Signed-off-by: Mel Gorman <mgorman@suse.de>
17 Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
18 Reviewed-by: Rik van Riel <riel@redhat.com>
19 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24 include/linux/mm_types.h | 7 ++++++-
25 1 file changed, 6 insertions(+), 1 deletion(-)
27 --- a/include/linux/mm_types.h
28 +++ b/include/linux/mm_types.h
29 @@ -478,7 +478,12 @@ static inline bool mm_tlb_flush_pending(
30 static inline void set_tlb_flush_pending(struct mm_struct *mm)
32 mm->tlb_flush_pending = true;
36 + * Guarantee that the tlb_flush_pending store does not leak into the
37 + * critical section updating the page tables
39 + smp_mb__before_spinlock();
41 /* Clearing is done after a TLB flush, which also provides a barrier. */
42 static inline void clear_tlb_flush_pending(struct mm_struct *mm)