From patchwork Mon May 15 11:33:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 13241286 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 96CD2C77B7D for ; Mon, 15 May 2023 11:34:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D430900007; Mon, 15 May 2023 07:34:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 283F4900002; Mon, 15 May 2023 07:34:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 19A07900007; Mon, 15 May 2023 07:34:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0AA58900002 for ; Mon, 15 May 2023 07:34:32 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id CFBE8141405 for ; Mon, 15 May 2023 11:34:31 +0000 (UTC) X-FDA: 80792281542.07.BC25FFB Received: from outbound-smtp04.blacknight.com (outbound-smtp04.blacknight.com [81.17.249.35]) by imf08.hostedemail.com (Postfix) with ESMTP id ED9DC160017 for ; Mon, 15 May 2023 11:34:29 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of mgorman@techsingularity.net designates 81.17.249.35 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684150470; 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=Jz8SIeZM33TCY29BiJtLYJYjb71lbG7QpgZzYM5PrZA=; b=KF3vx0LsXHp0/I5tYycdPYi5B3VmLmQLoGQouf0n8wo+F38nvf5L+mGNxqoSlHm1DL+YHb 0MRY2r6IFVMzNydRu53U6Rseh9717zuiSJzWDqvDZdV9Mk6LhQjyGEyedUAMQPvgiEMjPP xPv52mA8x0pHtR+NwpKme0xFCKjAYzc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684150470; a=rsa-sha256; cv=none; b=Z8yVwYFbWdra+zygCeXQYo98JB9gIJ0C/84WoGmykaOd8z1fdnbT6TTB/lKTHol5PgzQjS VDI2I93Fs4PanjVOdfWCU1lSkVJNdnrdvlfWbjkwmRJzallHj5k/Irv9nrOusqYtLyhEuQ aiTXoijdbAEdPLe/bwNdvEVuFzpl8JU= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of mgorman@techsingularity.net designates 81.17.249.35 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp04.blacknight.com (Postfix) with ESMTPS id 8D063BEE71 for ; Mon, 15 May 2023 12:34:28 +0100 (IST) Received: (qmail 27031 invoked from network); 15 May 2023 11:34:28 -0000 Received: from unknown (HELO localhost.localdomain) (mgorman@techsingularity.net@[193.118.249.27]) by 81.17.254.9 with ESMTPA; 15 May 2023 11:34:28 -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 3/4] mm: compaction: Update pageblock skip when first migration candidate is not at the start Date: Mon, 15 May 2023 12:33:43 +0100 Message-Id: <20230515113344.6869-4-mgorman@techsingularity.net> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230515113344.6869-1-mgorman@techsingularity.net> References: <20230515113344.6869-1-mgorman@techsingularity.net> MIME-Version: 1.0 X-Rspamd-Queue-Id: ED9DC160017 X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: zemrrrc7fzusjd935pdxzcy6zhhe65in X-HE-Tag: 1684150469-927299 X-HE-Meta: U2FsdGVkX19If7R4JO55heFX7RsBWGyr5ADVXroZ5Bm7NDfCTKGxlCmRMPpDEmP0GhnmqyUEKXUTqIrrJxPOLiQtnN56zm31VLj2zUk+8IMwmF7Aqr2jTz3n3H+MZx1herGRkecfCKzrhgsFnX974vozXKnRX6I3CE+CHVCep9ve04CsAun1M22BK+YtB5fbMSt/QgX5+967Xaoq54+2ebygmow8tJ8AsHD0JjRXhiyHYS/PmTIIkn+pPmCIP4G+PgyO+mb8onYRjws7NOlXqalI2taWkVXQ55YiXe4tqnMtOPAueFO2yxocATPY4lgVxXj2N8ZWnyzdltdfrmQPUwgPHOINPrplfT9FmiHYFTiF1evZe1EU6GC3Jv8WQriRy7rvrrIUB9KIZ3K6bqw4FpGa88mcodMB144tFPuXy8tWrQnA2FU1Jjx0xCkuc06/NnBNM+NuuVKVMfwmEzO3dpywnGTYMG9nQjlstOTTohyB9zm5mcXPldgVfgLQ1gdChSLvi8lNBLCb2SO9ExskF4pdmpcGSaJfkoodS51Qoriij43+lpbOx3IACKlqvyiA79Xe2H3i7W36eEfSaejscfcfs+yDevelVg4sJLKqtKsIhaMK9kZB4xIvgCq/HCG3jVNgyKW9hMonJKfchP94CNTT6WD4NFZYf8APd0uZiExdPf6cpYvzTdpRtuO5MuuERvWo4D8mstcYdPuPQSrko3bsTwHSV5OlVSHnjnaXbQtD9enO28xzH7z/POGcPJkMErEUTY1wS556AHqCBQ9/9AAye97xVIUWh4OteW7ZatAZSfDw3d84X/pU0EEl3ogSFwqzA4KLaJmCNwr5Td3MciGjOKXLzHRawiY/xrr5ae9MDDHCE++6kAS7JKhdBStM1I4OjV+Dl+LngcXvK66wm7JGcfkj4D3329KaBIjuVzYH9u/dSB16//DirMtcM2mYqLEAJlqH+AVKcYhgv0s uYF2lHm+ hpeg/k9ACX/TMX4NSBSMxuqMngrufdrYxE3ul1lb1BrorCObg4pKh2aKhk2fD1rd601NvGaJXOQf7RHruKZG2lPGHVZbdZ/R4HPfTT0l4pAB7KodEtXcN4H7wYxt42FhEj2HunPGOBE78Ijfgeu7ykew7Epk9C50ILxhJth5xqfTtHklNllN2BFLIKDT6p0FJii8ItD7ixFx4zUW5eklauP84MbrhJvTlxQ3hjYoEqmAVNx7MUJcRXZiHCtv2pZLffKMm/qmlVvIjx5dKikR3jaGUrfxjH38sMEtw 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: isolate_migratepages_block should mark a pageblock as skip if scanning started on an aligned pageblock boundary but it only updates the skip flag if the first migration candidate is also aligned. Tracing during a compaction stress load (mmtests: workload-usemem-stress-numa-compact) that many pageblocks are not marked skip causing excessive scanning of blocks that had been recently checked. Update pageblock skip based on "valid_page" which is set if scanning started on a pageblock boundary. Signed-off-by: Mel Gorman --- mm/compaction.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index accc6568091a..d7be990b1d60 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -392,18 +392,14 @@ void reset_isolation_suitable(pg_data_t *pgdat) * Sets the pageblock skip bit if it was clear. Note that this is a hint as * locks are not required for read/writers. Returns true if it was already set. */ -static bool test_and_set_skip(struct compact_control *cc, struct page *page, - unsigned long pfn) +static bool test_and_set_skip(struct compact_control *cc, struct page *page) { bool skip; - /* Do no update if skip hint is being ignored */ + /* Do not update if skip hint is being ignored */ if (cc->ignore_skip_hint) return false; - if (!pageblock_aligned(pfn)) - return false; - skip = get_pageblock_skip(page); if (!skip && !cc->no_set_skip_hint) set_pageblock_skip(page); @@ -470,8 +466,7 @@ static void update_cached_migrate(struct compact_control *cc, unsigned long pfn) { } -static bool test_and_set_skip(struct compact_control *cc, struct page *page, - unsigned long pfn) +static bool test_and_set_skip(struct compact_control *cc, struct page *page) { return false; } @@ -1075,9 +1070,9 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, lruvec_memcg_debug(lruvec, page_folio(page)); /* Try get exclusive access under lock */ - if (!skip_updated) { + if (!skip_updated && valid_page) { skip_updated = true; - if (test_and_set_skip(cc, page, low_pfn)) + if (test_and_set_skip(cc, valid_page)) goto isolate_abort; }