From: Davidlohr Bueso <dave@stgolabs.net>
To: akpm@linux-foundation.org
Cc: vbabka@suse.cz, parri.andrea@gmail.com,
linux-kernel@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>
Subject: Re: [PATCH] mm,compaction: serialize waitqueue_active() checks (for real)
Date: Thu, 14 Sep 2017 10:53:13 -0700 [thread overview]
Message-ID: <20170914175313.GB811@linux-80c1.suse> (raw)
In-Reply-To: <20170914000908.713-1-dave@stgolabs.net>
On Wed, 13 Sep 2017, Davidlohr Bueso wrote:
>- /*
>- * 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();
sorry, forgot to delete this. Here's v2.
-----8<-----------------------------------------------------
[PATCH v2] 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)
Reported-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
mm/compaction.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/mm/compaction.c b/mm/compaction.c
index fb548e4c7bd4..03d31a875341 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1999,17 +1999,14 @@ void wakeup_kcompactd(pg_data_t *pgdat, int order, int classzone_idx)
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();
-
if (pgdat->kcompactd_classzone_idx > classzone_idx)
pgdat->kcompactd_classzone_idx = classzone_idx;
- if (!waitqueue_active(&pgdat->kcompactd_wait))
+ /*
+ * Pairs with implicit barrier in wait_event_freezable()
+ * such that wakeups are not missed.
+ */
+ if (!wq_has_sleeper(&pgdat->kcompactd_wait))
return;
if (!kcompactd_node_suitable(pgdat))
--
2.12.0
prev parent reply other threads:[~2017-09-14 17:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-14 0:09 [PATCH] mm,compaction: serialize waitqueue_active() checks (for real) Davidlohr Bueso
2017-09-14 17:53 ` Davidlohr Bueso [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170914175313.GB811@linux-80c1.suse \
--to=dave@stgolabs.net \
--cc=akpm@linux-foundation.org \
--cc=dbueso@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=parri.andrea@gmail.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox