From: Johannes Weiner <hannes@cmpxchg.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Vlastimil Babka <vbabka@suse.cz>,
Mel Gorman <mgorman@techsingularity.net>, Zi Yan <ziy@nvidia.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] mm: page_alloc: defrag_mode kswapd/kcompactd watermarks
Date: Fri, 14 Mar 2025 17:05:58 -0400 [thread overview]
Message-ID: <20250314210558.GD1316033@cmpxchg.org> (raw)
In-Reply-To: <20250313210647.1314586-6-hannes@cmpxchg.org>
Andrew, could you please fold this delta patch?
---
From 3d2ff7b72df9e4f1a31b3cff2ae6a4584c06bdca Mon Sep 17 00:00:00 2001
From: Johannes Weiner <hannes@cmpxchg.org>
Date: Fri, 14 Mar 2025 11:38:41 -0400
Subject: [PATCH] mm: page_alloc: defrag_mode kswapd/kcompactd watermarks fix
Fix squawks from rebasing that affect the behavior of !defrag_mode.
FWIW, it seems to actually have slightly helped the vanilla kernel in
the benchmark. But the point was to not change the default behavior:
VANILLA WMARKFIX-VANILLA
Hugealloc Time mean 52739.45 ( +0.00%) 62758.21 ( +19.00%)
Hugealloc Time stddev 56541.26 ( +0.00%) 76253.41 ( +34.86%)
Kbuild Real time 197.47 ( +0.00%) 197.25 ( -0.11%)
Kbuild User time 1240.49 ( +0.00%) 1241.33 ( +0.07%)
Kbuild System time 70.08 ( +0.00%) 71.00 ( +1.28%)
THP fault alloc 46727.07 ( +0.00%) 41492.73 ( -11.20%)
THP fault fallback 21910.60 ( +0.00%) 27146.53 ( +23.90%)
Direct compact fail 195.80 ( +0.00%) 260.93 ( +33.10%)
Direct compact success 7.93 ( +0.00%) 6.67 ( -14.18%)
Direct compact success rate % 3.51 ( +0.00%) 2.76 ( -16.78%)
Compact daemon scanned migrate 3369601.27 ( +0.00%) 3827734.27 ( +13.60%)
Compact daemon scanned free 5075474.47 ( +0.00%) 5910839.73 ( +16.46%)
Compact direct scanned migrate 161787.27 ( +0.00%) 168271.13 ( +4.01%)
Compact direct scanned free 163467.53 ( +0.00%) 222558.33 ( +36.15%)
Compact total migrate scanned 3531388.53 ( +0.00%) 3996005.40 ( +13.16%)
Compact total free scanned 5238942.00 ( +0.00%) 6133398.07 ( +17.07%)
Alloc stall 2371.07 ( +0.00%) 2478.00 ( +4.51%)
Pages kswapd scanned 2160926.73 ( +0.00%) 1726204.67 ( -20.12%)
Pages kswapd reclaimed 533191.07 ( +0.00%) 537963.73 ( +0.90%)
Pages direct scanned 400450.33 ( +0.00%) 450004.87 ( +12.37%)
Pages direct reclaimed 94441.73 ( +0.00%) 99193.07 ( +5.03%)
Pages total scanned 2561377.07 ( +0.00%) 2176209.53 ( -15.04%)
Pages total reclaimed 627632.80 ( +0.00%) 637156.80 ( +1.52%)
Swap out 47959.53 ( +0.00%) 45186.20 ( -5.78%)
Swap in 7276.00 ( +0.00%) 7109.40 ( -2.29%)
File refaults 138043.00 ( +0.00%) 145238.73 ( +5.21%)
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
mm/compaction.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/compaction.c b/mm/compaction.c
index 4a2ccb82d0b2..a481755791a9 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -3075,6 +3075,8 @@ static bool kcompactd_node_suitable(pg_data_t *pgdat)
struct zone *zone;
enum zone_type highest_zoneidx = pgdat->kcompactd_highest_zoneidx;
enum compact_result ret;
+ unsigned int alloc_flags = defrag_mode ?
+ ALLOC_WMARK_HIGH : ALLOC_WMARK_MIN;
for (zoneid = 0; zoneid <= highest_zoneidx; zoneid++) {
zone = &pgdat->node_zones[zoneid];
@@ -3084,7 +3086,7 @@ static bool kcompactd_node_suitable(pg_data_t *pgdat)
ret = compaction_suit_allocation_order(zone,
pgdat->kcompactd_max_order,
- highest_zoneidx, ALLOC_WMARK_MIN,
+ highest_zoneidx, alloc_flags,
false, true);
if (ret == COMPACT_CONTINUE)
return true;
@@ -3108,7 +3110,7 @@ static void kcompactd_do_work(pg_data_t *pgdat)
.mode = MIGRATE_SYNC_LIGHT,
.ignore_skip_hint = false,
.gfp_mask = GFP_KERNEL,
- .alloc_flags = ALLOC_WMARK_HIGH,
+ .alloc_flags = defrag_mode ? ALLOC_WMARK_HIGH : ALLOC_WMARK_MIN,
};
enum compact_result ret;
--
2.48.1
next prev parent reply other threads:[~2025-03-14 21:06 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 21:05 [PATCH 0/5] mm: reliable huge page allocator Johannes Weiner
2025-03-13 21:05 ` [PATCH 1/5] mm: compaction: push watermark into compaction_suitable() callers Johannes Weiner
2025-03-14 15:08 ` Zi Yan
2025-03-16 4:28 ` Hugh Dickins
2025-03-17 18:18 ` Johannes Weiner
2025-03-21 6:21 ` kernel test robot
2025-03-21 13:55 ` Johannes Weiner
2025-04-10 15:19 ` Vlastimil Babka
2025-04-10 20:17 ` Johannes Weiner
2025-04-11 7:32 ` Vlastimil Babka
2025-03-13 21:05 ` [PATCH 2/5] mm: page_alloc: trace type pollution from compaction capturing Johannes Weiner
2025-03-14 18:36 ` Zi Yan
2025-03-13 21:05 ` [PATCH 3/5] mm: page_alloc: defrag_mode Johannes Weiner
2025-03-14 18:54 ` Zi Yan
2025-03-14 20:50 ` Johannes Weiner
2025-03-14 22:54 ` Zi Yan
2025-03-22 15:05 ` Brendan Jackman
2025-03-23 0:58 ` Johannes Weiner
2025-03-23 1:34 ` Johannes Weiner
2025-03-23 3:46 ` Johannes Weiner
2025-03-23 18:04 ` Brendan Jackman
2025-03-31 15:55 ` Johannes Weiner
2025-03-13 21:05 ` [PATCH 4/5] mm: page_alloc: defrag_mode kswapd/kcompactd assistance Johannes Weiner
2025-03-13 21:05 ` [PATCH 5/5] mm: page_alloc: defrag_mode kswapd/kcompactd watermarks Johannes Weiner
2025-03-14 21:05 ` Johannes Weiner [this message]
2025-04-11 8:19 ` Vlastimil Babka
2025-04-11 15:39 ` Johannes Weiner
2025-04-11 16:51 ` Vlastimil Babka
2025-04-11 18:21 ` Johannes Weiner
2025-04-13 2:20 ` Johannes Weiner
2025-04-15 7:31 ` Vlastimil Babka
2025-04-15 7:44 ` Vlastimil Babka
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=20250314210558.GD1316033@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=vbabka@suse.cz \
--cc=ziy@nvidia.com \
/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