From nobody Wed Dec 17 14:20:39 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D470EE49AB for ; Mon, 21 Aug 2023 11:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233281AbjHULpu (ORCPT ); Mon, 21 Aug 2023 07:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233130AbjHULpo (ORCPT ); Mon, 21 Aug 2023 07:45:44 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF26A100 for ; Mon, 21 Aug 2023 04:45:36 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RTrGv0Z7QzrSwY; Mon, 21 Aug 2023 19:44:07 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) 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; Mon, 21 Aug 2023 19:45:34 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Mike Kravetz , , Kefeng Wang Subject: [PATCH v2 3/8] mm: migrate: convert numamigrate_isolate_page() to numamigrate_isolate_folio() Date: Mon, 21 Aug 2023 19:56:19 +0800 Message-ID: <20230821115624.158759-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230821115624.158759-1-wangkefeng.wang@huawei.com> References: <20230821115624.158759-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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 Content-Type: text/plain; charset="utf-8" Rename numamigrate_isolate_page() to numamigrate_isolate_folio(), then make it takes a folio and use folio API to save compound_head() calls. 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(struc= t folio *src, return __folio_alloc_node(gfp, order, nid); } =20 -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 =3D thp_nr_pages(page); - int order =3D compound_order(page); + int nr_pages =3D folio_nr_pages(folio); =20 /* 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 *pgda= t, 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; } =20 - if (!isolate_lru_page(page)) + if (!folio_isolate_lru(folio)) return 0; =20 - 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); =20 /* - * 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; } =20 @@ -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; =20 - isolated =3D numamigrate_isolate_page(pgdat, page); + isolated =3D numamigrate_isolate_folio(pgdat, page_folio(page)); if (!isolated) goto out; =20 --=20 2.41.0