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: 13382702 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 94683CA5534 for ; Wed, 13 Sep 2023 09:52:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 440876B0170; Wed, 13 Sep 2023 05:52:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CF046B0173; Wed, 13 Sep 2023 05:52:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F4BF6B0173; Wed, 13 Sep 2023 05:52:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0473B6B0170 for ; Wed, 13 Sep 2023 05:52:08 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C7ADA1CA9F0 for ; Wed, 13 Sep 2023 09:52:07 +0000 (UTC) X-FDA: 81231108294.15.5C23322 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf06.hostedemail.com (Postfix) with ESMTP id 92BC418001C for ; Wed, 13 Sep 2023 09:52:04 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 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=1694598725; 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=XimLV5Z1rXezPIZu6awNd81iU32QlWiaxWWjX2F1Naw=; b=Z1Ey8Hhkw14ve+o9C++aardRRT4Tdkus4o4QB5OoW74clV9wtwTM0VkvufFja9RVLX4YQu ADGnBs0K2Zdj1kDjGntMFIFFvQVCQOyRgmlV+MknuXMJhi8gTgLZSeVYfVmVsk+FEa2Nrk dpMclESt2W1R4iTT4qCGN1WT5WFeamY= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694598725; a=rsa-sha256; cv=none; b=ubn9iV5ECJwuyvd8G8wtroaJfswLIPlNSUDxfLIO2nVcOPPrZzJAHZ91yoZPmoFYdyiGx5 jfiSgn2vIHFPe2aLDosNTfwp8KJhOqjKNbzB+aZ5EE2LcHklSgRhO+S29iYLD5iccZ1wqE uOEUyIb1QyFvmsYgP4hasJevnmHB7GI= 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 X-Rspamd-Queue-Id: 92BC418001C X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 459k6hm59mpc1brrmgfdtffj1sk64jwp X-HE-Tag: 1694598724-24299 X-HE-Meta: U2FsdGVkX19ijG1B+b1QCa+u6wG1qlgdjkFgqCdq5umMEz6pkPVR48bcwlU6776FDdtQnX52zzDZBzznB+29iZQOrV2rTFrPwGBjyGYeHbgiFPNZK5pgeblIh/SkP0JC4aUQSNcVAABj7d7nxHCqjigSSSXXj6LsQIOX67w199k8rKQJQD8t4vdpTcxhBW0B/r4dwuWjFjWQw/G0QpPleml1ZL39TdWXHY9Wg6I1ola+IZu62ZGxsKT/swwnlEz6ByKInIKE47sqrmJGqfO0zrhBeRTrzwYlnr6JrA9NG2LOtSa9WB+upOLEIWi5wGHnlEpww/lNBJ24YVsgtDE/q3VIVZP30ko59woc90dtp/rGgVo5ab5FXJAjt2rEEDsFYH2PAgRSLFRwkYm71ffCJwouyfJSS0xuBS7ii63lCuFagwtjp2wN+NRYsdKBKd/QJylv2h5rzPeTfnucNStU9m8mCBl2u+LMlBRgJENsG8YMsvNiqO3HsiUHZrRaUu/9geofrMIN7h+8f/cPOnAVYb0ZQ+UOEbY5OULNpFYE2mffQ7HEiZlRxmyh7Y5k+IZoirHzMGB257ocyvm7YOihaNUYyo0d0gMlemFaFbv5yZ5/bxtrh8W418Wsnexx1U8ugGUty0LEMI2TcxFH8ArjJaovSb78PHuhL2FkVKfMHlZoK406pGm7wweegV6cIYlJpKClfkLvS8PqJJh0t5Co9Cie1eHuWuBMfpInFWkRWKYgw/ia2GsAslr6lWuciCxA2tBg8VfHoTAY1+XUC2eF/0QDs4o3bP02DyclLokRooullot8f16zWKs3byYwq9G1UqOBokfVuUXx2gmOfMzY2PPOZjKN83H2lwnSDZOrRZD9tf1U4GIe/OSOc0avvJp45hyR4obeJUlTztlxCFRByTIOyzVupOed3B1VNHc/cSx7Z9Kfu26E04AjpFba4XV8q06XGA2EOK6qZBrKLfA BDHik6+B RdzM5XzlbztikjKCsAEj5Jd2iJFeZrotjbWdzFi/14WTCbQ+m0RXAOlwqWh1GPQqoiShos8k9eXDRdCC65+ilsFNNms6L92Zn7QMqSdH/vvGsi7vhlCY5YVUomz/6zbhIeik/cAzNZCeWH+JH8tfEEwJ+14cBgMpajRTK1Tu40c7mJl5wbPbcjOF6nnfONIU2OTbi3YFulb8Wrd0xjCZFQRF1/g== 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. 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;