From patchwork Mon Aug 21 11:56:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13359345 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36FD2EE49AA for ; Mon, 21 Aug 2023 11:45:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D54878E0003; Mon, 21 Aug 2023 07:45:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8189F8E0007; Mon, 21 Aug 2023 07:45:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57F648D0002; Mon, 21 Aug 2023 07:45:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 011E28E0003 for ; Mon, 21 Aug 2023 07:45:41 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B81F1120BBC for ; Mon, 21 Aug 2023 11:45:41 +0000 (UTC) X-FDA: 81147932082.10.C8ED63F Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf01.hostedemail.com (Postfix) with ESMTP id 6366B4001B for ; Mon, 21 Aug 2023 11:45:38 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf01.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692618339; a=rsa-sha256; cv=none; b=1dnhdZQKnLzWr1IOXIooYDZgFDuUx/QxCi5WMlKXIXrQxHlQffRJwFZ1Zb16iCxlt64xya mMX56WRv87cNuoxREOL3j4GI2ekwaSmoa8fHDjCzrueFv5R52vM9Cronwc7jcAfYqvVGAR zKbjzXy7XbQ+RvP37Y0gH6F1ZTa7+QA= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf01.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692618339; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I41Rmr70L+mSC1kfltJOSaYN9UhRfL5214LDD4T0WaI=; b=wOf+78sa5kOu06eT3CuTnmJ7dThs0cAhz1q2/P6R45wAVo/m3h3m51kmOfupK+k/q3AMHU YLZMyaFcG64hr/8vnwCiyvIhmf4TiHtm7I868+3nh2/rjrq3TUiyy2Wt2NyreFGZeV5pec wl1yIiIBxPux0AYIITMnBTMDVhgj3Iw= 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 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 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 6366B4001B X-Stat-Signature: y8n7ckpt5dedr8iggdkgwc96aeg5gsh9 X-Rspam-User: X-HE-Tag: 1692618338-124992 X-HE-Meta: U2FsdGVkX18w+3sm4vIaqVDScXynIIRuQqbFVqmf+rcli2AqbG4XkyS5vMcCL0YbUpM/5ezly8D2V0XGUt4soyZXuYw/flYXMmI05iPPbqfYdfnF8pJSpH001Oge+Yw3IMcY/vhvV/dfRvpR5xXq2Jv0s92/vMjRzFXMtdZ19MBmzCZBoMfOPKao1gAQfDdQy+AsmwfVKhbQX5qMxnqWIjh58abYtfoVYC5/curatSaS3O6Lvq6FAwjoT7VP9ZqHYviyXw53RXX3vIIsH3Ho/fDcZeJQuDEEg+kzFP63vFf9t7JzS7SaLiGV7kI6myp8RIEF4MJydk3HtQwDSGQLsMl2Sv3aErB3Q4pNUTDdS7qDktQRjcvoMsUakUubxplVQTPlIhNlstrefaWAtTPIdbhBEo8eq61SFGx0HKbTApQKZBL1Y8rKaTDbSNeqPfOgxXAYvxqSG4xxl87aShx0Ivc1FenhJdxOmiwMvGJ808TA58em0WILte813jis+msq8rIA5Cg+k4AaxLvBgp5IkDedej8Ogl0l+T56xIeMOMpM8rZffK5Ti04PBtS1161OvfRhIVaAv02i+OUJykxMzoD9eKl1aJO5NYbjfcq2tMWra+dk0VZ3A0LufQeStUiCWR7AncYjJIDdtVoIFZa40C0K9HtVi0rj2xZnWe6o6k8O13Xm26a18Iz0siBP+otZbTasnUlh6Oqp4yoojy7wtmC8+HkYgb/7FIkv1tU6n8JTArAy80aJKhBkP2ZxDP6jucBbVKL8AHbMHyg3V+oI1JaaGTyWLhGw3E1PPFnl1+nB99wpYlLVtBVitBGg2msmVPZL23Uq1jxRsAkA7uG/Z9+SKBhy3aq1vcivaW4C0GmI9iI0diEqEhQYjAnCLp/jtOt0O3D3AI8YRDLKtB/viscSrK9GYacvVQ80Y9hXZdyvHqaBtnybm7RYh9JYr8VeDCqJNePjREXl7t9yOET xJarnrZd Oyj28eRjf1/ToXZulYKhyh8kIRcZWnATvEr2jYX2Y5GFMUzOrmpO8+5fGLPaPC8hzCVBfI/VvlnVEVtKsc6e5Ah3ADsxfhdEunj7JKeJohx+EjWHDNzlwY27dWd/xvNO7PMFUfRCS3cdRAhGJZcY8cZZa0c/CeXwJvi6bYZiy9tX2Zq/oKpJIeYD1ocFWWFpakNJj X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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(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;