From patchwork Mon May 15 11:33:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 13241282 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 D621FC77B75 for ; Mon, 15 May 2023 11:34:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F23D900006; Mon, 15 May 2023 07:34:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A26C900002; Mon, 15 May 2023 07:34:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59182900006; Mon, 15 May 2023 07:34:21 -0400 (EDT) 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 4A9B7900002 for ; Mon, 15 May 2023 07:34:21 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2CEA81C8C96 for ; Mon, 15 May 2023 11:34:21 +0000 (UTC) X-FDA: 80792281122.27.AFBD194 Received: from outbound-smtp17.blacknight.com (outbound-smtp17.blacknight.com [46.22.139.234]) by imf02.hostedemail.com (Postfix) with ESMTP id 404FE8000E for ; Mon, 15 May 2023 11:34:19 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf02.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.234 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=1684150459; 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=pi112mLeRM+erqz/KNGo0TvI7Z4NtOUOSuT9Dm0OpxM=; b=40sNeyZYihckq912vdYXP23q6RCM4R6ccy8UwWNWla2SlITfsget1Jg9MU4V7v00V3SPqG SOcmJfOFkzx6DzCsWWhcxqQ1BUR75a+zFXQBZykHhQmOsJvu/Lg9HdCErGwaSlfppTizDy HoMmvIMb4BQcImtR315qkDgXazS2tFc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684150459; a=rsa-sha256; cv=none; b=k3VK1cmza4gsXrWe1bfBbaGoxZiddKUUqNmdwcY1a64yfaZQ9OrMXBpUSkHro+GPblyfyW 9VO1POrnDKMEEqOazAtm8Na0k1586k9ky7CkUP/7OZ1ypR6rOUajjbgosbqVxCQoKbHJ/G kxIKg8TVBK4PbwZzmmxWZLlkS7HWmAs= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf02.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.234 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp17.blacknight.com (Postfix) with ESMTPS id DA4F81C451F for ; Mon, 15 May 2023 12:34:17 +0100 (IST) Received: (qmail 26294 invoked from network); 15 May 2023 11:34:17 -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:17 -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 2/4] mm: compaction: Only force pageblock scan completion when skip hints are obeyed Date: Mon, 15 May 2023 12:33:42 +0100 Message-Id: <20230515113344.6869-3-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-Stat-Signature: zpyutr4g4pi8ztj8sxmqu7riwsaecxno X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 404FE8000E X-Rspam-User: X-HE-Tag: 1684150458-575097 X-HE-Meta: U2FsdGVkX1+i8z4pbFqvlxmkq5ThwucxDCEnw/AlX+4lrfH9ZLTgv6LagOU9/pVpg6vS6u4qi/ocDO585luBgaYhJJS/6z0DMQMIeWIqYtm6p2ZE1QYawDAMvluaPzS7668mDMigxjcabN17R04NDhRzffSi0WKY1u6mdsFB97zX/4ZVCeAgUuvI5NNxTcd4oEl/2yzYvDftI9M47YluNQ3PNIIGkcuIKVnbRHrZSsvHxadWS/wPNXKZz5j+Dydso+1yjUvaZKdaO2quGb887EpiteFpcCe6ekQHUmDhnY3PVQ9Vu80ecZuqiKDdkcUAskaveByat4eyXh5mYngtJQXFTUMUN1Uf26pjL/tHVbpFIznYmMMu79pBKZvN7T7RPy5vFQh/ga/3OdHu68nfRO8ERmzYHhQ5ZKsbGlEqHhmMq5PsXHZqiwd/r7hDecIh+sLi6TmNxTK62hMKxz50m/ZR1S2kvTgUooikPvOVXN+q/IeNSQ1j0w2CQu5iqupTMsB09pS4pQHR0Z4ortVwlR0Qly1fSjmAzTyU1H8hkfUJDsc1t0tIIZcLOvPgzmZZcBYoQhGqgp07853z5vOk+kdAZiMpXJnSjh6Or8N/rNdbz/zV52bponmbS1uGmhu3c0n1itO8wYsavmxyhATzeY8iqU6/HW1OGl2/A/38dnVLGNuwvHYLusy02KxhvcMS5F/e9q/c6ImFaOgp3yIzkj/vVEveZZttDKZYvjLfhTw3z1cAkPkRyMwDX3RAnt2t0pBGv1xRcdQ/ZMFi5OPMKccx7dMpuJ7sGTvjSuWeo8bS34fke5GSRfZeyFCRnCSrO1mTqErOvGRorhXliRYUeuQY4/FffswSlPRx017EkY1mh/6ql4T7qDsATCPVuRJ9Cd8LmfS6WmeNAxA/qv6WBtVumd3r1YnwmSkgNzRA68U1QFLAS4/mqrk9NGMiNu2YdPkIVGeQr1ymG4wP9UO 9zsO4ief LAVYR+IBrh7sXO0PxcxtYejFWnc/N4KMEqDPsfC1+dWWbLCbOVbQKI3mS+/erqmbneyg7leYCsXgCyWQTQhRjmq2prd0agNcTXcJBdUlIqTpmdYpPsjbgZc5vUU4XJmfCFuqHk335mk67Vi1kHZXtEb9Nz/5yeftpSVmXqA7tmfjdG5FaPRxzvDZqSe9s2VEAUbKda38oHC14TTYyaJ8FP+Y/y+hLJi2TR5unckpDa5uVe0vUyXcJWSFioMD71NS9E/PGpiUbyRwFHn5FLZAIVLFiIVZN7mscWKkj 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: fast_find_migrateblock relies on skip hints to avoid rescanning a recently selected pageblock but compact_zone() only forces the pageblock scan completion to set the skip hint if in direct compaction. While this prevents direct compaction repeatedly scanning a subset of blocks due to fast_find_migrateblock(), it does not prevent proactive compaction, node compaction and kcompactd encountering the same problem described in commit cfccd2e63e7e ("mm, compaction: finish pageblocks on complete migration failure"). Force the scan completion of a pageblock to set the skip hint if skip hints are obeyed to prevent fast_find_migrateblock() repeatedly selecting a subset of pageblocks. Suggested-by: Vlastimil Babka Signed-off-by: Mel Gorman Acked-by: Vlastimil Babka --- mm/compaction.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 81791c124bb8..accc6568091a 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2456,7 +2456,8 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) } /* * If an ASYNC or SYNC_LIGHT fails to migrate a page - * within the current order-aligned block, scan the + * within the current order-aligned block and + * fast_find_migrateblock may be used then scan the * remainder of the pageblock. This will mark the * pageblock "skip" to avoid rescanning in the near * future. This will isolate more pages than necessary @@ -2465,7 +2466,7 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) * recently partially scanned. */ if (!pageblock_aligned(cc->migrate_pfn) && - cc->direct_compaction && !cc->finish_pageblock && + !cc->ignore_skip_hint && !cc->finish_pageblock && (cc->mode < MIGRATE_SYNC)) { cc->finish_pageblock = true;