From patchwork Wed Sep 13 09:51:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 138731 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp974438vqx; Wed, 13 Sep 2023 03:06:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfBN96WSTAMLJcZH+5maOtMYIeA0bMw2MK4O2vN0L6iLkACgftgEQvMG0oprwIiMJo/SV8 X-Received: by 2002:a17:903:278e:b0:1c3:3c91:61cc with SMTP id jw14-20020a170903278e00b001c33c9161ccmr1960721plb.13.1694599591087; Wed, 13 Sep 2023 03:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694599591; cv=none; d=google.com; s=arc-20160816; b=w2V6CEupS5tNQM6TqqEA2z1iJo0lA9Fef2EKTG0mvfuE2S3K5I9DAlrJ1Wv4UkAYqJ z1pXLpFrwLCwfnDtp7riM34BH+lGLuhJoq0StO3GaD3lyDmx/DN3HMZlaERxscWzF/TR DZgGKWfnIrHrVBI2th3EdmD33CB/kM7HfLJ2oF9vvUcW+7QPmYbe3hbtSwf2v18SzkXe bOaRGAQxtV0bhcgziQozBsu4UVth6qlkVAe/IYvvMxFzoyxob4/+ftISUXE70vU21L2g SlNHyvNvr6ehFl+pvKePePh98M7eTaJuN0uPb+VNxLvlo7CCImbh4vq6g7rDbMXrOzD0 5fkA== 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=XimLV5Z1rXezPIZu6awNd81iU32QlWiaxWWjX2F1Naw=; fh=Je6qNyAM729b1goCtB6PkBk+yQrlQCIjJMRY6BFgKTo=; b=GOrhfHcARcio6xGj/UN0Go5GYFq7MQIe/CzyaxatZ8FTavXuaXx8ZDR8JUTU+5Cbte Gtj99+XspN070Vh+w53cO1uPgIYiGNPUmFk5iUGrBGzysiR4KoKm0a8g+wjf6RgD1BCl b3HM3mxIT0ywvgOdWre8tjht2M8yUn2yZR2MrjH6roKlmi0TS5sONuIj5E6AdVoJ0Mb3 kVksXWpoLjlPWF2NEUptFyXj5cVnZv17T1M77MurHMn1VmNT52+UYJByVhkeJotodNDH b3VHG+tQxE2hriAQrGrHxl2SgJAwjdcmgrJzyQshSvca8UrTfklpMr0AT7IYY9eVWhMg 2tsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id r9-20020a170902be0900b001b9d9b01303si3313205pls.628.2023.09.13.03.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 03:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2766C823FAEE; Wed, 13 Sep 2023 02:52:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239492AbjIMJwP (ORCPT + 36 others); Wed, 13 Sep 2023 05:52:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239464AbjIMJwH (ORCPT ); Wed, 13 Sep 2023 05:52:07 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C38251BCC for ; Wed, 13 Sep 2023 02:52:01 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rlwcw44lpzMlHJ; Wed, 13 Sep 2023 17:48:32 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 13 Sep 2023 17:51:59 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Mike Kravetz , , Kefeng Wang Subject: [PATCH v3 3/8] mm: migrate: convert numamigrate_isolate_page() to numamigrate_isolate_folio() Date: Wed, 13 Sep 2023 17:51:26 +0800 Message-ID: <20230913095131.2426871-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230913095131.2426871-1-wangkefeng.wang@huawei.com> References: <20230913095131.2426871-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 02:52:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776916460673478061 X-GMAIL-MSGID: 1776916460673478061 Rename numamigrate_isolate_page() to numamigrate_isolate_folio(), then make it takes a folio and use folio API to save compound_head() calls. Reviewed-by: Zi Yan Signed-off-by: Kefeng Wang --- mm/migrate.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index f2d86dfd8423..281eafdf8e63 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2478,10 +2478,9 @@ static struct folio *alloc_misplaced_dst_folio(struct folio *src, return __folio_alloc_node(gfp, order, nid); } -static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) +static int numamigrate_isolate_folio(pg_data_t *pgdat, struct folio *folio) { - int nr_pages = thp_nr_pages(page); - int order = compound_order(page); + int nr_pages = folio_nr_pages(folio); /* Avoid migrating to a node that is nearly full */ if (!migrate_balanced_pgdat(pgdat, nr_pages)) { @@ -2493,22 +2492,23 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) if (managed_zone(pgdat->node_zones + z)) break; } - wakeup_kswapd(pgdat->node_zones + z, 0, order, ZONE_MOVABLE); + wakeup_kswapd(pgdat->node_zones + z, 0, + folio_order(folio), ZONE_MOVABLE); return 0; } - if (!isolate_lru_page(page)) + if (!folio_isolate_lru(folio)) return 0; - mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + page_is_file_lru(page), + node_stat_mod_folio(folio, NR_ISOLATED_ANON + folio_is_file_lru(folio), nr_pages); /* - * Isolating the page has taken another reference, so the - * caller's reference can be safely dropped without the page + * Isolating the folio has taken another reference, so the + * caller's reference can be safely dropped without the folio * disappearing underneath us during migration. */ - put_page(page); + folio_put(folio); return 1; } @@ -2542,7 +2542,7 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, if (page_is_file_lru(page) && PageDirty(page)) goto out; - isolated = numamigrate_isolate_page(pgdat, page); + isolated = numamigrate_isolate_folio(pgdat, page_folio(page)); if (!isolated) goto out;