[6/6] mm: compaction: skip fast freepages isolation if enough freepages are isolated
Message ID | f39c2c07f2dba2732fd9c0843572e5bef96f7f67.1685018752.git.baolin.wang@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp347241vqr; Thu, 25 May 2023 06:00:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5WsLSmOvGt+j3mWZcdI+gMf+tv2Ub9dm1ryhCUBxovmRzSeXm8XgieigEICZCX1lnHY/1S X-Received: by 2002:a17:90a:c7cf:b0:255:cddf:a0b8 with SMTP id gf15-20020a17090ac7cf00b00255cddfa0b8mr1580946pjb.47.1685019639736; Thu, 25 May 2023 06:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685019639; cv=none; d=google.com; s=arc-20160816; b=KqL6H8Al9OorhBe1d6I/GzCMVUptsJxKJHVEVc6R89iRN2SMsTlgRkvnK2+N7Ksh0M bU02mGYlNj7RNchWBtjTCaoKpS5D0RNDqeMxvuYUN/pUQzSx0noc1vsytr16XVSeBIGD QvhQkikTYUTGsqcj25cce1NFKAIlAdd0XS0M2ixwRagyvSBBjaHo1/bWCQGLdIZgJzTa RCBHW/vX7TH4uSqd+mjjqmoTqwGWGw9HAFkzogp7hY4Z9PgK9Fh+8ScHXii2Hi8YzRvm /Lpiz/uK08YlNceGMjVwPSu4EkHKuviFDtF3aTrbkzTHAqvig3jk0GsJXYQZrnlKK1p4 NYDg== 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=Mn3fhMFcaTYsz7UQ9NrJ1DjTrAq5Xs3DKzZTvyhCQfA=; b=jDku580Va0BgV2jKNnEAGVSV3eo68GXBguUJclU3iWiOe4zm2fj2uudZEXpwBTMZMg eutNU7wcUT2GcwSmDjvaKEHvvU+GgyZBY6PEO/uKRvvxpjExmk22DriOsrfYdI2skULn 99gTbLlDJQJbBc4exu/5Irr/GtIR2412VdRdQ+mVaxDsPMWaTkxzNcQM4La0855sKLpv XCEDWyYezTpAFHoruJzeNZtdfwW4u8tCh5w+e9yefwF/xroGNbTT+WpIC12mkrgr/TA6 +/12gzd8KWqidV5CTIwya7YKovGUHlhEQYIe3OK7ljQAYDoCDFrl8KAiCJWwP0sgYbtM VF6w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a17090a598b00b00252f4ca40c4si3636165pji.34.2023.05.25.06.00.24; Thu, 25 May 2023 06:00:39 -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 S241105AbjEYMyc (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Thu, 25 May 2023 08:54:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240536AbjEYMyW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 25 May 2023 08:54:22 -0400 Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6FB3189 for <linux-kernel@vger.kernel.org>; Thu, 25 May 2023 05:54:20 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R711e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VjSJ3iS_1685019256; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VjSJ3iS_1685019256) by smtp.aliyun-inc.com; Thu, 25 May 2023 20:54:17 +0800 From: Baolin Wang <baolin.wang@linux.alibaba.com> 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 6/6] mm: compaction: skip fast freepages isolation if enough freepages are isolated Date: Thu, 25 May 2023 20:54:01 +0800 Message-Id: <f39c2c07f2dba2732fd9c0843572e5bef96f7f67.1685018752.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <cover.1685018752.git.baolin.wang@linux.alibaba.com> References: <cover.1685018752.git.baolin.wang@linux.alibaba.com> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766871153711952948?= X-GMAIL-MSGID: =?utf-8?q?1766871153711952948?= |
Series |
Misc cleanups and improvements for compaction
|
|
Commit Message
Baolin Wang
May 25, 2023, 12:54 p.m. UTC
I've observed that fast isolation often isolates more pages than
cc->migratepages, and the excess freepages will be released back to the
buddy system. So skip fast freepages isolation if enough freepages are
isolated to save some CPU cycles.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
mm/compaction.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
On 5/25/23 14:54, Baolin Wang wrote: > I've observed that fast isolation often isolates more pages than > cc->migratepages, and the excess freepages will be released back to the > buddy system. So skip fast freepages isolation if enough freepages are > isolated to save some CPU cycles. > > Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> > --- > mm/compaction.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/mm/compaction.c b/mm/compaction.c > index eccec84dae82..3ade4c095ed2 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -1550,6 +1550,10 @@ static void fast_isolate_freepages(struct compact_control *cc) > > spin_unlock_irqrestore(&cc->zone->lock, flags); > > + /* Skip fast search if enough freepages isolated */ > + if (cc->nr_freepages >= cc->nr_migratepages) > + break; > + > /* > * Smaller scan on next order so the total scan is related > * to freelist_scan_limit.
diff --git a/mm/compaction.c b/mm/compaction.c index eccec84dae82..3ade4c095ed2 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1550,6 +1550,10 @@ static void fast_isolate_freepages(struct compact_control *cc) spin_unlock_irqrestore(&cc->zone->lock, flags); + /* Skip fast search if enough freepages isolated */ + if (cc->nr_freepages >= cc->nr_migratepages) + break; + /* * Smaller scan on next order so the total scan is related * to freelist_scan_limit.