[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181214230601.GE29005@techsingularity.net>
Date: Fri, 14 Dec 2018 23:06:01 +0000
From: Mel Gorman <mgorman@...hsingularity.net>
To: Linux-MM <linux-mm@...ck.org>
Cc: David Rientjes <rientjes@...gle.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Michal Hocko <mhocko@...nel.org>, ying.huang@...el.com,
kirill@...temov.name, Andrew Morton <akpm@...ux-foundation.org>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>
Subject: [PATCH 14/14] mm, compaction: Do not direct compact remote memory
Remote compaction is expensive and possibly counter-productive. Locality
is expected to often have better performance characteristics than remote
high-order pages. For small allocations, it's expected that locality is
generally required or fallbacks are possible. For larger allocations such
as THP, they are forbidden at the time of writing but if __GFP_THISNODE
is ever removed, then it would still be preferable to fallback to small
local base pages over remote THP in the general case. kcompactd is still
woken via kswapd so compaction happens eventually.
Signed-off-by: Mel Gorman <mgorman@...hsingularity.net>
---
mm/compaction.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/mm/compaction.c b/mm/compaction.c
index 39d33b6d1172..05fecd7227e4 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -2208,6 +2208,16 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
continue;
}
+ /*
+ * Do not compact remote memory. It's expensive and high-order
+ * small allocations are expected to prefer or require local
+ * memory. Similarly, larger requests such as THP can fallback
+ * to base pages in preference to remote huge pages if
+ * __GFP_THISNODE is not specified
+ */
+ if (zone_to_nid(zone) != zone_to_nid(ac->preferred_zoneref->zone))
+ continue;
+
status = compact_zone_order(zone, order, gfp_mask, prio,
alloc_flags, ac_classzone_idx(ac), capture);
rc = max(status, rc);
--
2.16.4
--
Mel Gorman
SUSE Labs
Powered by blists - more mailing lists