From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 7705F8E00AE for ; Fri, 4 Jan 2019 07:51:26 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id c18so34708199edt.23 for ; Fri, 04 Jan 2019 04:51:26 -0800 (PST) Received: from outbound-smtp25.blacknight.com (outbound-smtp25.blacknight.com. [81.17.249.193]) by mx.google.com with ESMTPS id gp17-v6si1475918ejb.103.2019.01.04.04.51.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 04:51:25 -0800 (PST) Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp25.blacknight.com (Postfix) with ESMTPS id 69C32B87AA for ; Fri, 4 Jan 2019 12:51:23 +0000 (GMT) From: Mel Gorman Subject: [PATCH 06/25] mm, compaction: Skip pageblocks with reserved pages Date: Fri, 4 Jan 2019 12:49:52 +0000 Message-Id: <20190104125011.16071-7-mgorman@techsingularity.net> In-Reply-To: <20190104125011.16071-1-mgorman@techsingularity.net> References: <20190104125011.16071-1-mgorman@techsingularity.net> Sender: owner-linux-mm@kvack.org List-ID: To: Linux-MM Cc: David Rientjes , Andrea Arcangeli , Vlastimil Babka , ying.huang@intel.com, kirill@shutemov.name, Andrew Morton , Linux List Kernel Mailing , Mel Gorman Reserved pages are set at boot time, tend to be clustered and almost never become unreserved. When isolating pages for either migration sources or target, skip the entire pageblock is one PageReserved page is encountered on the grounds that it is highly probable the entire pageblock is reserved. The performance impact is relative to the number of reserved pages in the system and their location so it'll be variable but intuitively it should make sense. If the memblock allocator was ever changed to spread reserved pages throughout the address space then this patch would be impaired but it would also be considered a bug given that such a change would ruin fragmentation. On both 1-socket and 2-socket machines, scan rates are reduced slightly on workloads that intensively allocate THP while the system is fragmented. Signed-off-by: Mel Gorman --- mm/compaction.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index 3afa4e9188b6..94d1e5b062ea 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -484,6 +484,15 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, goto isolate_fail; } + /* + * A reserved page is never freed and tend to be clustered in + * the same pageblock. Skip the block. + */ + if (PageReserved(page)) { + blockpfn = end_pfn; + break; + } + if (!PageBuddy(page)) goto isolate_fail; @@ -827,6 +836,13 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, goto isolate_success; } + /* + * A reserved page is never freed and tend to be + * clustered in the same pageblocks. Skip the block. + */ + if (PageReserved(page)) + low_pfn = end_pfn; + goto isolate_fail; } -- 2.16.4