From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB15EC27C76 for ; Wed, 25 Jan 2023 13:45:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 688BF6B0072; Wed, 25 Jan 2023 08:45:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 638EE6B0075; Wed, 25 Jan 2023 08:45:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 500946B0078; Wed, 25 Jan 2023 08:45:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 429F96B0072 for ; Wed, 25 Jan 2023 08:45:01 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1FDF5120418 for ; Wed, 25 Jan 2023 13:45:01 +0000 (UTC) X-FDA: 80393442402.08.B101D0C Received: from outbound-smtp27.blacknight.com (outbound-smtp27.blacknight.com [81.17.249.195]) by imf16.hostedemail.com (Postfix) with ESMTP id 28BBD180018 for ; Wed, 25 Jan 2023 13:44:58 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of mgorman@techsingularity.net designates 81.17.249.195 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674654299; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PKYuIAqSMWcwB9klwbP3s4uu8PZy8GlgNn39jK3DY8g=; b=s+/iT59Lh30iYPN9IfNqnhkRnmYMJ5hkPBM4Or4Aioohxxr+ogiOqJ/S0sTEmyEsjKR7Oz clSS3qh0Ebp3O1F/AUtnuilW1chAhKLfyhAX9bAkNZK92gwTk0rRr0Piovr7VnOVjZ43Gw MwQXsClYgf5m9HxkVCbwS3fze4xs1xI= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of mgorman@techsingularity.net designates 81.17.249.195 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674654299; a=rsa-sha256; cv=none; b=WAqWbZIIWTLo+JXxh6urDmnP79bVdCvdpWRCmZdQnhYglDlbAC03lTGYKbmXhMcgtZQC5P KQhbt0L5M3yakWnPY1+UUFRDB666VS0XK7dxC6OwHoax3M6xaNdZMf9B2QtmG0bAjlGWnO s3bYFpY0VSBctYvhokXMoYHSPENpyF8= Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp27.blacknight.com (Postfix) with ESMTPS id D03F214A029 for ; Wed, 25 Jan 2023 13:44:57 +0000 (GMT) Received: (qmail 20634 invoked from network); 25 Jan 2023 13:44:57 -0000 Received: from unknown (HELO morpheus.112glenside.lan) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPA; 25 Jan 2023 13:44:57 -0000 From: Mel Gorman To: Vlastimil Babka Cc: Andrew Morton , Jiri Slaby , Maxim Levitsky , Michal Hocko , Pedro Falcato , Paolo Bonzini , Chuyi Zhou , Linux-MM , LKML , Mel Gorman Subject: [PATCH 1/4] mm, compaction: Rename compact_control->rescan to finish_pageblock Date: Wed, 25 Jan 2023 13:44:31 +0000 Message-Id: <20230125134434.18017-2-mgorman@techsingularity.net> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230125134434.18017-1-mgorman@techsingularity.net> References: <20230125134434.18017-1-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 28BBD180018 X-Rspam-User: X-Stat-Signature: 4ag3hqbi8siuizdmy6h585fzdm6u86fx X-HE-Tag: 1674654298-853267 X-HE-Meta: U2FsdGVkX1/Lhehu1sbUnRdTRQeWkccOktV4/GFBWRr8giH+C+WkuEcKgA8nxF/dC38XMOAp0jHNPZBZwTKUwz1TGWzJqIWMSGIwa6qJTSnTpCQ7ob5Zf9OsXT6i2hfzMv1qg6N/TwSb5fwmK6B3dKXd+3+gV7LP405vAH73UZsBOjXjEBb5aTi9FkBXrHZjYMitujtPzhT5l0L0dbzBOrZqjHDKSRhnJcX90cs4ZDYE7XbRRVJIetWWJIntlQF4QQMk4+Usib2XWTNftoBgsD00mVnk2mj+xzx+KSOvF+tI2sSOX9T8SQSP9DjdcGAHMWUTanFAyHn2uhuAoHV5dWfs0l94Z132jlsnPRyLlEUwvedVAwSfkXJGv7yJwCDCZNgQ4ATg74EIY3bI8pmz30Ts4Pr4bHMBgO9feQjKRd27VpsIZWnUe8s6Nr7S4k3/1KwV9miDWNNYBN2FlKiw2qhuh/hYha72VMpEUCfTlE7t4vDxHRgyEKnpGH+mZN+62QS/AfmhnzzMrsxmU3bGs/hcnR6pHSuEIecR6UnkY+6VwEE9a9SawiwHUrXpRTyRQKYBnp0SIDlFhXnIzobC6ydTMtrbV0wzKyt1chDwVuxDJfjEpzOe+PMcQ8KFxvyuOnTuBbCikVcY8jARAOZJfP3fCDxOsbFRaphjwiiAUuUHkUhNqB5nG70RW4NtJ5Th6fSoYyuZepXpStVJ7/MCsfm4yMBUBn4gX75cuSr7jABtTr286reQKFTXfekq04dPXE14n6xrI0g30SRHxUP9O5yO0nLJEpmJyUoeMNRFmrIz8UhcNTqb3QXx9HE9ZW/tYFP0lwdS4tcluU8CaW1vQWWfng0JSxuQBXWMs3FCNnndsPG5z53GHOIphvFk3XumzC0lFOhdsl5KyhIwZzp4F4vLjkOF4p8/vhPcW+mDA2IETNjVLRg6mPLOq8Q6+tGROaSntWcmUMnH3Zb06EP A9PxqvjU ADLLbJj1Tpc1xAgwIqgSPVLOtCmuiRRzDqIQGjETocnIImdk4ZdUQ8jGMkrx2GdqUR5KmtoVIr16NHq/waTWUiogdCfwwjVMAgNfIHN/qgz6FkwT2OTmM1RETkD1Vn7oCqiK3+Ux7oWB5J73vepuezXMNj4SEt9mMEzRAoLSLSw6V+X/KSzSbKUMawQTwfhQvK1hT8q2qYdWNkObUtB2Gkfc9yYe0QVzsY2jt9b1aQXl86Hrz8QN8O4riPYq/I7uAL/utoDhW4D66fX9WHRtN85rthqASYDVlhEIp5T2RCptgCq6bUqmszvyAXJ2xMjtlE+T+DeeP21oaYrYwp8EUcjlW8/tXKV/CmulQ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The rescan field was not well named albeit accurate at the time. Rename the field to finish_pageblock to indicate that the remainder of the pageblock should be scanned regardless of COMPACT_CLUSTER_MAX. The intent is that pageblocks with transient failures get marked for skipping to avoid revisiting the same pageblock. Signed-off-by: Mel Gorman --- mm/compaction.c | 24 ++++++++++++------------ mm/internal.h | 6 +++++- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index ca1603524bbe..c018b0e65720 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1102,12 +1102,12 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, /* * Avoid isolating too much unless this block is being - * rescanned (e.g. dirty/writeback pages, parallel allocation) + * fully scanned (e.g. dirty/writeback pages, parallel allocation) * or a lock is contended. For contention, isolate quickly to * potentially remove one source of contention. */ if (cc->nr_migratepages >= COMPACT_CLUSTER_MAX && - !cc->rescan && !cc->contended) { + !cc->finish_pageblock && !cc->contended) { ++low_pfn; break; } @@ -1172,14 +1172,14 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, } /* - * Updated the cached scanner pfn once the pageblock has been scanned + * Update the cached scanner pfn once the pageblock has been scanned. * Pages will either be migrated in which case there is no point * scanning in the near future or migration failed in which case the * failure reason may persist. The block is marked for skipping if * there were no pages isolated in the block or if the block is * rescanned twice in a row. */ - if (low_pfn == end_pfn && (!nr_isolated || cc->rescan)) { + if (low_pfn == end_pfn && (!nr_isolated || cc->finish_pageblock)) { if (valid_page && !skip_updated) set_pageblock_skip(valid_page); update_cached_migrate(cc, low_pfn); @@ -2374,17 +2374,17 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) unsigned long iteration_start_pfn = cc->migrate_pfn; /* - * Avoid multiple rescans which can happen if a page cannot be - * isolated (dirty/writeback in async mode) or if the migrated - * pages are being allocated before the pageblock is cleared. - * The first rescan will capture the entire pageblock for - * migration. If it fails, it'll be marked skip and scanning - * will proceed as normal. + * Avoid multiple rescans of the same pageblock which can + * happen if a page cannot be isolated (dirty/writeback in + * async mode) or if the migrated pages are being allocated + * before the pageblock is cleared. The first rescan will + * capture the entire pageblock for migration. If it fails, + * it'll be marked skip and scanning will proceed as normal. */ - cc->rescan = false; + cc->finish_pageblock = false; if (pageblock_start_pfn(last_migrated_pfn) == pageblock_start_pfn(iteration_start_pfn)) { - cc->rescan = true; + cc->finish_pageblock = true; } switch (isolate_migratepages(cc)) { diff --git a/mm/internal.h b/mm/internal.h index bcf75a8b032d..21466d0ab22f 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -422,7 +422,11 @@ struct compact_control { bool proactive_compaction; /* kcompactd proactive compaction */ bool whole_zone; /* Whole zone should/has been scanned */ bool contended; /* Signal lock contention */ - bool rescan; /* Rescanning the same pageblock */ + bool finish_pageblock; /* Scan the remainder of a pageblock. Used + * when there are potentially transient + * isolation or migration failures to + * ensure forward progress. + */ bool alloc_contig; /* alloc_contig_range allocation */ }; -- 2.35.3