Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1888539rwd; Mon, 15 May 2023 04:40:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ59m1ZObi5RXU6I1PRHFwiEgm7ZdfCkx/lObke4t7E0F+DXjOc+IAxrPI7W1SBTqwvTxq1k X-Received: by 2002:a05:6a00:15c3:b0:646:6e40:b421 with SMTP id o3-20020a056a0015c300b006466e40b421mr30681023pfu.1.1684150826135; Mon, 15 May 2023 04:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684150826; cv=none; d=google.com; s=arc-20160816; b=0YhjG/woL5Or/9bxyU5t5XtmZMFO6S+auoLP+0ud+87YKeU6UO0TmcL7N5KlWMd32d BwN8tGcwAY5WskLMuEIypSgCMcpNRjW6PVQKXkQEjtUcMtCNEtRr6zTiOUt4ox94uDYQ 3fbZBFflaW9OLsOAcmfIBNOhveIUMjSVD/tujQf576aAzD7DwGjJ10GVYkCYAalPkEkZ g17pDkfAeyILmIXXNrR1Me5xwSWU2BDlZERkS5zHHM6iHVMzk5qvrq+yYQTPdVdQkulH drmS1Mr6rJWHpAv8vytvsRFED1KNf8ycxtAIW+wBn2EuoL7mCPilAD4nwlWX7xcE71NV jeBw== 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=y1cOqJXY7aZ9Lb2ZYK9B8/0b1tBjH9Wwuq/UJgsC/Lo=; b=Pn0FDuL6MlDgmOm2GBJimCedrQ9+jItN3tQxP0hxLlGG+fqoGKvomPA28MO5GIc0Yw oRchnZucLJj74vHGqpsc308NVumTMDo+gtCTdOma4fsFlb1VQbaMYArUvrk2HYEDBR5e MGbHkeWsOLjAOJ+NBDOT3SJ8HU7YQZdrZfCcJS0qyXm3GWpY33P04RFlbXJiJUMEhfI8 mOSeidTEKMOswcRvBnbXqMB8dowiy9l65KwmheyqmvMO7KuEhbO9TGPeBHRpcQi6NeMI r9Np2OKlm69emw/CGq17VkQ3bv9yA17JbM1EbLH2wlbAov/cWF/Y/iuir2B0tkCZKDpg 7v9A== 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 k20-20020aa79734000000b006438e35303csi16483194pfg.260.2023.05.15.04.40.10; Mon, 15 May 2023 04:40:26 -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 S241319AbjEOLgN (ORCPT + 99 others); Mon, 15 May 2023 07:36:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241317AbjEOLeJ (ORCPT ); Mon, 15 May 2023 07:34:09 -0400 Received: from outbound-smtp35.blacknight.com (outbound-smtp35.blacknight.com [46.22.139.218]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E075E49 for ; Mon, 15 May 2023 04:34:08 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp35.blacknight.com (Postfix) with ESMTPS id 36DD022AB for ; Mon, 15 May 2023 12:34:07 +0100 (IST) Received: (qmail 25659 invoked from network); 15 May 2023 11:34:07 -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:06 -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: Ensure rescanning only happens on partially scanned pageblocks Date: Mon, 15 May 2023 12:33:41 +0100 Message-Id: <20230515113344.6869-2-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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, 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 compact_zone() intends to rescan pageblocks if there is a failure to migrate "within the current order-aligned block". However, the pageblock scan may already be complete and moved to the next block causing the next pageblock to be "rescanned". Ensure only the most recent pageblock is rescanned. Reported-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 c8bcdea15f5f..81791c124bb8 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2464,8 +2464,9 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) * fast_find_migrateblock revisiting blocks that were * recently partially scanned. */ - if (cc->direct_compaction && !cc->finish_pageblock && - (cc->mode < MIGRATE_SYNC)) { + if (!pageblock_aligned(cc->migrate_pfn) && + cc->direct_compaction && !cc->finish_pageblock && + (cc->mode < MIGRATE_SYNC)) { cc->finish_pageblock = true; /* -- 2.35.3