Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1904173rwd; Mon, 15 May 2023 04:55:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4oAkGuTJ99EQkmAWQYZJYdqF5CeF4Nvr+JfWD8ibYoHYH+eDQJieBHBpOgFLHn4xgTWJ1Y X-Received: by 2002:a17:902:e5cf:b0:1ac:807b:deb1 with SMTP id u15-20020a170902e5cf00b001ac807bdeb1mr30372345plf.38.1684151720676; Mon, 15 May 2023 04:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684151720; cv=none; d=google.com; s=arc-20160816; b=YV/KkA39hbE5F/LsLG1RZhXPzJJIsfvJDbkwh46kfJh0WAdgxyDzNW+3kce7B2whSl R174ga6C+v9FEXtlL5zmQYW1x9/exx3OGRgUykLjcSuZLsq3ehNylY4J1Vm04A4DVmlw zjrCStQlFqzjThMIC1oybjY9IyrE9agSwvUwQokPVkNHToAeU6vpgqZBZcJaJij8VBF+ SOvcSnUuvM28lCs0C6xeyn556ryLyOaCwvEdnucBVbaov8M9rSLHS7QucWA+15eDCjGM PM8ZbiqBd4IvW4OsA9BP73cQe9QZJjwdZu8Zw4vgWM3eq1cUOmMGsRhoZ2JgrNHWCuSb DLDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pi112mLeRM+erqz/KNGo0TvI7Z4NtOUOSuT9Dm0OpxM=; b=TEcTemtnsyWZGz9dsuGO/liptWP7l0yfrpz73YHYVQZTULQQqtZtKJKXYN1al1oE4M jVRG8LnjBwDn51axbkhWeV0OBGjP7hFBOmJyIqu8Zn/y0r9iOC0dfui3wvaS/6gFxZqX Dk+p8M6/bs1ho9lUqNRxubCJ0DX+Y07I6gjJam1pnPWdD0Sxqy4/VHFwlP0jvkBDi95T +ZI7qtiEIOR029b9HO6P7pWEbtek+OO+YEKUmCOS/Dj3TBafJsfU/deEMqrwrrHAKh2i K4L4pxmqsmB1oY1cBcb3iCEiNPuXhJSsb/SXMrbxbjxFttNsC7GKO4dPN20uGz3DHOEu O+WQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j15-20020a170903024f00b001ab29e16b3asi16784555plh.286.2023.05.15.04.55.07; Mon, 15 May 2023 04:55:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241332AbjEOLhi (ORCPT + 99 others); Mon, 15 May 2023 07:37:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241331AbjEOLff (ORCPT ); Mon, 15 May 2023 07:35:35 -0400 Received: from outbound-smtp62.blacknight.com (outbound-smtp62.blacknight.com [46.22.136.251]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E53B1985 for ; Mon, 15 May 2023 04:34:19 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp62.blacknight.com (Postfix) with ESMTPS id DFC7FFAF8C 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.35.3