mm,compaction: serialize waitqueue_active() checks (for real)
Subsystems (2)
[email protected]
maintainerPATCH 16/51 mm,compaction: serialize waitqueue_active() checks (for real)
From: Davidlohr Bueso <[email protected]>
Subject: mm,compaction: serialize waitqueue_active() checks (for real)
Andrea brought to my attention that the L->{L,S} guarantees are completely bogus for this case. I was looking at the diagram, from the offending commit, when that _is_ the race, we had the load reordered already.
What we need is at least S->L semantics, thus simply use wq_has_sleeper() to serialize the call for good.
Fixes 46acef048a6 (mm,compaction: serialize waitqueue_active() checks)
Signed-off-by Davidlohr Bueso <[email protected]>
Reported-by Andrea Parri <[email protected]>
Cc Vlastimil Babka <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
mm/compaction.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
mm/compaction.c renamed from mm/compaction.c~mmcompaction-serialize-waitqueue_active-checks-for-real +0 -6
@@ -1999,17 +1999,14 @@ void wakeup_kcompactd(pg_data_t *pgdat,if (pgdat->kcompactd_max_order < order) pgdat->kcompactd_max_order = order; -/* -* Pairs with implicit barrier in wait_event_freezable() -* such that wakeups are not missed in the lockless -* waitqueue_active() call. -*/ -smp_acquire__after_ctrl_dep ();