Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1890531rwd; Mon, 15 May 2023 04:42:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7tXNvKABrW9x1cPOzSDjD8Z/e6IgHNw6+S4kVal7oFLrawGhPWvxHWj0VLIaplEx9FVlHb X-Received: by 2002:a17:902:e84d:b0:1ab:eee:c609 with SMTP id t13-20020a170902e84d00b001ab0eeec609mr43088638plg.40.1684150945057; Mon, 15 May 2023 04:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684150945; cv=none; d=google.com; s=arc-20160816; b=ArtIsWWzslGMphWA98UUYNhLLb9q9nMy1nX9Q0Osj9usHcRmH/ux1vP6tB7E80gJ3Q ssYY7UjWaqEGhP9Ipfwo92zo+i2Cnrwe/etA3Ael3xf+9w6/SCXOZAKakkMt/JOHB4iC T1rBFjUj3TtPTvUauhqGyksoRu5n5VO4n6QV8MGRW5JQJjV0ui4P4EHWImP0AQfdffe0 r7YX7ig/57FCMbvImO+D8T1CgrjnCfHdpFNN/C6UDVhYIGFramhlX1G0F8j436d8j70u mWV66k8BWANXSBNTuBSiP+jt1B7//5xArreps1En4kwtgcB34dQKx9Ean0nEq1jmSIx0 6Q4w== 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=Jz8SIeZM33TCY29BiJtLYJYjb71lbG7QpgZzYM5PrZA=; b=n79sW/tkkkeWcYH82IxAosAF3MQOVFlZRYD+wequSG+7MkeMSeKqE8YiGvye0vhjZB aJPLWH58EPl8akM3LyDKHVLkkzWMFvUqaaqrstyL5Se07BOjrvs5NlNl2Yinu4CAtBFx 4DdK7r261DiEKV8qisth2vfad05+nipXbyJL0uMXR8/dUYV3nyTvibN7gpCcTITmPdl1 hHqw0K83F8symj1or0U2p+I63KLBtPKyfkG2EvK/+GgiAOjBDYgskGatnQnO9w4Gim9C 7Bnd/ntcy3X2eB7qLrRZG/G4eUh+9If11QlG+hvzh6bIDx1qVMzHstKm1QLiNvlMQZno YLtA== 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 s14-20020a170902988e00b001ac528e3f1bsi15095838plp.154.2023.05.15.04.42.09; Mon, 15 May 2023 04:42:25 -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 S241395AbjEOLhw (ORCPT + 99 others); Mon, 15 May 2023 07:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241308AbjEOLfv (ORCPT ); Mon, 15 May 2023 07:35:51 -0400 Received: from outbound-smtp41.blacknight.com (outbound-smtp41.blacknight.com [46.22.139.224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E154F19A6 for ; Mon, 15 May 2023 04:34:29 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp41.blacknight.com (Postfix) with ESMTPS id 8D811230D 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 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 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; } -- 2.35.3