Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6630264rwr; Tue, 9 May 2023 19:00:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ItuI91SmFa2cUrrx6OA6Jwg2a7uoBCkOecymlb2rksL+v46MPVcJRfrGyDKh4HvPuvYsC X-Received: by 2002:a05:6a20:7fa9:b0:f8:ac26:b899 with SMTP id d41-20020a056a207fa900b000f8ac26b899mr20035974pzj.0.1683684038229; Tue, 09 May 2023 19:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683684038; cv=none; d=google.com; s=arc-20160816; b=uKPDiAZTZ/U8mwUFDDt6FO+zumFVMEzLlHmOSI8BxK004+aTwlNg54UYnMeXbz9hfM VUSOx+n00oIoaIY1SjuwMikCIqsgVpd65NEPv3AM1jKRgEUtM8oAqGGL7UY87JFJ/WnJ tF4nZ5TV8RTrOcw5lQxLpmxxSmzMeUVXaoimEudqC+UNbye9dJ2jVfr85S9k0V3FDTmq 7j7gl69h7rOhd6NpGNzQu68WDZN/o9FozcXH0/H4RANYwLvnCuWh0dhjCJ6RAYOU1SBK /3k5lN9FGtVyDD3fPGRoJGdRvmbNud5YD9TuDUz4MAiZgbtPKT43tj/6w422DNRvkCQu 9+Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=jxfemDDyQNEsCokgpuuXuus9rxaNLMAQe3Cs1+Pe5AQ=; b=Ugq/PMQsFbqHIA5BArBGwIWmJ/8Yvh6ZSa0UJ7K9W3+I691jnrN4XL/e9XlvBW3YYJ yn2TceRzQtyXkrE1ncBJDWrz6qVWTQIHUu4utyVJwKdt7KEhIbFK8V4ciXrZ3Uw0GH/0 Fpg/qeSxuSwYI5Vtk6p4CIRP/ttOpLwzZzpsWQA/5D+XYqUpdopFHDfWwN2HRYSV6idE VdNXUs65fy1Gu8OFYZ4j/SYFzSZNE+17+zF6+Q3tByeoujis7WpNMACgMiYKUvcZRxnn f1T7d8W2AOnjlm+z3ld/ZuFT6yNLPddjaWHflLsln3AFjgd8Ry5UQ98nhHzSFKqoFP/g qqfA== 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 e63-20020a636942000000b0051b13a071a8si2753807pgc.575.2023.05.09.19.00.25; Tue, 09 May 2023 19:00:38 -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 S235430AbjEJBuT (ORCPT + 99 others); Tue, 9 May 2023 21:50:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbjEJBuR (ORCPT ); Tue, 9 May 2023 21:50:17 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BA563A9A for ; Tue, 9 May 2023 18:50:15 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=xhao@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0ViDQE-W_1683683410; Received: from 30.240.106.49(mailfrom:xhao@linux.alibaba.com fp:SMTPD_---0ViDQE-W_1683683410) by smtp.aliyun-inc.com; Wed, 10 May 2023 09:50:11 +0800 Message-ID: <3104080d-549b-8aa8-0265-371d4d33cfe6@linux.alibaba.com> Date: Wed, 10 May 2023 09:50:10 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 2/2] migrate_pages_batch: code cleanup: remove is_large To: Huang Ying , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zi Yan , Yang Shi , Baolin Wang , Oscar Salvador , Alistair Popple References: <20230509022014.380493-1-ying.huang@intel.com> <20230509022014.380493-2-ying.huang@intel.com> From: haoxin In-Reply-To: <20230509022014.380493-2-ying.huang@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 在 2023/5/9 上午10:20, Huang Ying 写道: > Previously, in migrate_pages_batch we need to track whether the source > folio is large/THP before splitting. So is_large is used to cache > folio_test_large() result. Now, we don't need that variable any more > because we don't count retrying and failure of large folios (only > counting that of THP folios). So, in this patch, is_large is removed > to simplify the code. > > This is just code cleanup, no functionality changes are expected. > > Signed-off-by: "Huang, Ying" > Cc: Xin Hao > Cc: Zi Yan > Cc: Yang Shi > Cc: Baolin Wang > Cc: Oscar Salvador > Cc: Alistair Popple > --- > mm/migrate.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 10709aed76d3..2ac927a82bbc 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1618,7 +1618,6 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, > int nr_failed = 0; > int nr_retry_pages = 0; > int pass = 0; > - bool is_large = false; > bool is_thp = false; > struct folio *folio, *folio2, *dst = NULL, *dst2; > int rc, rc_saved = 0, nr_pages; > @@ -1635,13 +1634,7 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, > nr_retry_pages = 0; > > list_for_each_entry_safe(folio, folio2, from, lru) { > - /* > - * Large folio statistics is based on the source large > - * folio. Capture required information that might get > - * lost during migration. > - */ > - is_large = folio_test_large(folio); > - is_thp = is_large && folio_test_pmd_mappable(folio); > + is_thp = folio_test_large(folio) && folio_test_pmd_mappable(folio); > nr_pages = folio_nr_pages(folio); > > cond_resched(); > @@ -1688,7 +1681,7 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, > nr_failed++; > stats->nr_thp_failed += is_thp; > /* Large folio NUMA faulting doesn't split to retry. */ > - if (is_large && !nosplit) { > + if (folio_test_large(folio) && !nosplit) { > int ret = try_split_folio(folio, split_folios); > > if (!ret) { LGTM. Reviewed-by: Xin Hao