linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_alloc: don't wake up kswapd from rmqueue() unless __GFP_KSWAPD_RECLAIM is specified
@ 2023-05-11 13:47 Tetsuo Handa
  2023-05-12  3:45 ` Andrew Morton
  2023-05-13 10:23 ` Mel Gorman
  0 siblings, 2 replies; 12+ messages in thread
From: Tetsuo Handa @ 2023-05-11 13:47 UTC (permalink / raw)
  To: Andrew Morton, Vlastimil Babka, Mel Gorman; +Cc: linux-mm

Commit 73444bc4d8f9 ("mm, page_alloc: do not wake kswapd with zone lock
held") moved wakeup_kswapd() from steal_suitable_fallback() to rmqueue()
using ZONE_BOOSTED_WATERMARK flag. But since zone->flags is a shared
variable, a thread doing !__GFP_KSWAPD_RECLAIM allocation request might
observe this flag being set immediately after another thread doing
__GFP_KSWAPD_RECLAIM allocation request set this flag.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: 73444bc4d8f9 ("mm, page_alloc: do not wake kswapd with zone lock held")
---
 mm/page_alloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 47421bedc12b..4283b5916f36 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3052,7 +3052,8 @@ struct page *rmqueue(struct zone *preferred_zone,
 
 out:
 	/* Separate test+clear to avoid unnecessary atomics */
-	if (unlikely(test_bit(ZONE_BOOSTED_WATERMARK, &zone->flags))) {
+	if (unlikely(test_bit(ZONE_BOOSTED_WATERMARK, &zone->flags))
+	    && (alloc_flags & ALLOC_KSWAPD)) {
 		clear_bit(ZONE_BOOSTED_WATERMARK, &zone->flags);
 		wakeup_kswapd(zone, 0, 0, zone_idx(zone));
 	}
-- 
2.18.4



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-05-22 14:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-11 13:47 [PATCH] mm/page_alloc: don't wake up kswapd from rmqueue() unless __GFP_KSWAPD_RECLAIM is specified Tetsuo Handa
2023-05-12  3:45 ` Andrew Morton
2023-05-13  9:38   ` Tetsuo Handa
2023-05-13 10:23 ` Mel Gorman
2023-05-14  0:28   ` [PATCH v2] mm/page_alloc: don't wake " Tetsuo Handa
2023-05-15  6:03     ` Huang, Ying
2023-05-15  6:35       ` Huang, Ying
2023-05-15  7:38     ` Mel Gorman
2023-05-15 10:17       ` Tetsuo Handa
2023-05-16  1:44         ` Huang, Ying
2023-05-22 13:57           ` Tetsuo Handa
2023-05-22 14:58             ` Mel Gorman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox