Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp913835rwd; Thu, 25 May 2023 05:55:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4655Vcwqd4Eh+WWMUA17+O/SYEYRpnUtaFr0fxLaBN9i30RXxqGnVGofw+MmE+GPOXWYTo X-Received: by 2002:a05:6a00:1341:b0:64a:7723:fe04 with SMTP id k1-20020a056a00134100b0064a7723fe04mr8957835pfu.4.1685019321151; Thu, 25 May 2023 05:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685019321; cv=none; d=google.com; s=arc-20160816; b=hZf1tIhNn2VoR0ROm20bMd0DiqAsdu/G66BCDh1sijSgzTaWwxIztluQ71e+deMgTl FsMBZPPsP37IIhIpSUGPRNo4bkAUWfhoRrUI8BbNpOubsOhh5UWbqEgau7np1YbjlnDU 8ByzMF3saM9KNnrKHAdsFiEzDuMaOmJNHPY7Iv3zxQ2T1HoRrIIK1qRWLqtuvCMvhl9S OOf9nx6btAgpt4pSJK8Ct4lDBDQrBV2wU5ZVwktnSjnHFyYDYg2c+H0isLc5o5eoPxnk zh7RcaiwwUS9REtMARS7i/Oz0K8DnEoiuiFwwOLeZJ7m/rdnTdCc4nN8Gw2IhYYWSbWM 6GbQ== 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=9PEP4Qe0owgriL+os+ebwHktoCpGXaTA8NLjInkUkIw=; b=qftLKiFD+qNX6j9gY7Nfzk40d+4cSogwWQO6vySPvVO/auXcsVrAgq0beIIz9fekOh 5Yz23mRNf6SVjCLu6nB7+oG9HJMCpavhDoHdZrBfqyNZw8B6cXU6PuizKzqj9SJFtx0c PXQnCg+itlaa2ujTS7X3qCP78AAZaCtX0RzRDKni4/61lcJ9V/MnXiVYpzHfXcewOyGI Es3tTnMOTL44UKg5Hn3zpaLN3vPKKHpJbu0Z5jVVNEQ9IF3MtQOsr3GlahLi1Y1zq1Hi eIOZWjZ9UPfrZtsPKg2vs46/GzAWDRjSa0JQF/HjzHfYNUjf5xmuuJeNhgIvr8ew8CMU 6qkA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b0052c47df208dsi16564pgb.326.2023.05.25.05.55.09; Thu, 25 May 2023 05:55:21 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240345AbjEYMyZ (ORCPT + 99 others); Thu, 25 May 2023 08:54:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236065AbjEYMyT (ORCPT ); Thu, 25 May 2023 08:54:19 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B46D183 for ; Thu, 25 May 2023 05:54:18 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R861e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VjSJ3gf_1685019253; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VjSJ3gf_1685019253) by smtp.aliyun-inc.com; Thu, 25 May 2023 20:54:14 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, vbabka@suse.cz, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] mm: compaction: skip more fully scanned pageblock Date: Thu, 25 May 2023 20:53:58 +0800 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 In fast_isolate_around(), it assumes the pageblock is fully scanned if cc->nr_freepages < cc->nr_migratepages after trying to isolate some free pages, and will set skip flag to avoid scanning in future. However this can miss setting the skip flag for a fully scanned pageblock (returned 'start_pfn' is equal to 'end_pfn') in the case where cc->nr_freepages is larger than cc->nr_migratepages. So using the returned 'start_pfn' from isolate_freepages_block() and 'end_pfn' to decide if a pageblock is fully scanned makes more sense. It can also cover the case where cc->nr_freepages < cc->nr_migratepages, which means the 'start_pfn' is usually equal to 'end_pfn' except some uncommon fatal error occurs after non-strict mode isolation. Signed-off-by: Baolin Wang --- mm/compaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/compaction.c b/mm/compaction.c index 3737c6591bfb..1e5183f39ca9 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1411,7 +1411,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn) isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false); /* Skip this pageblock in the future as it's full or nearly full */ - if (cc->nr_freepages < cc->nr_migratepages) + if (start_pfn == end_pfn) set_pageblock_skip(page); return; -- 2.27.0