Skip to contentSkip to conversation

mm,compaction: serialize waitqueue_active() checks (for real)

PATCH New [email protected] 1 participant 1 message Oct 3, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 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)
Cc Vlastimil Babka <[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
diff -puN mm/compaction.c~mmcompaction-serialize-waitqueue_active-checks-for-real mm/compaction.c
@@ -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();