From patchwork Wed Aug 2 09:53:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13337930 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 AD08AC001DE for ; Wed, 2 Aug 2023 09:45:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EBB0E280144; Wed, 2 Aug 2023 05:45:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E6C0B280143; Wed, 2 Aug 2023 05:45:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0B8F280144; Wed, 2 Aug 2023 05:45:28 -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 BC045280112 for ; Wed, 2 Aug 2023 05:45:28 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7CD07C0DF4 for ; Wed, 2 Aug 2023 09:45:28 +0000 (UTC) X-FDA: 81078681936.29.0B43677 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf22.hostedemail.com (Postfix) with ESMTP id 39E50C0005 for ; Wed, 2 Aug 2023 09:45:25 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.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=1690969526; 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=C9SLzI1jBQxZ3MenzIaKU+m294r5B3MM6jSUBENnZOM=; b=2hoYdvHsatABphCExfUcMpsyTe/9EEXUVpXcUXzIeALUp8Xy05fIBw+ENFAKVYSvgXyFj4 btrdgGg42Lp92SAH74BwtaXIOOXr0qB+fyM9X/HZzL0hAIw06LviDwQH1zCNOV8Nj6HNqS dyF2gsjVpWxEhp3ytXiZ5wgG65vKJOU= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.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=1690969526; a=rsa-sha256; cv=none; b=xXonfRRohHz5diLjuNdVUjK7s45dUtPu6gH1+eRenSJhIuGvKGI3KCogmFP1LRiQ3oucP/ vil0LOKeb2sh4z8C+H9oOlTDY2yTAIhqdrukR6wxfAnoHcJsczzD3ddb27hvKSYnXaicab bgV3oWELOGCEkruD4roPipZFyfMcdNA= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RG6WQ2pXczrS1v; Wed, 2 Aug 2023 17:44:18 +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.27; Wed, 2 Aug 2023 17:45:20 +0800 From: Kefeng Wang To: Andrew Morton , , CC: Huang Ying , David Hildenbrand , Matthew Wilcox , Kefeng Wang Subject: [PATCH 4/4] mm: migrate: use __folio_test_movable() Date: Wed, 2 Aug 2023 17:53:46 +0800 Message-ID: <20230802095346.87449-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230802095346.87449-1-wangkefeng.wang@huawei.com> References: <20230802095346.87449-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 39E50C0005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 8g91c3c1otgype94fm3kd4s8isb8ba7u X-HE-Tag: 1690969525-689809 X-HE-Meta: U2FsdGVkX1+4jYZbsPtSyGj5SBcONAol4G17+cZYU8CQqzFbnWysjb9fjT/4psgNJJBpe8EZBrJfcnzrqJp3K7MfXt1psIy/rhWVqVQL7fS+pxSDJRhPbFemybwjxKOdQK8NRTtmpph0HRoqL8qPWeQVdzHjY8Z2SLQVwxYCckOt3+MI7LnhmcDzGbsiaMTHgzOgqKuDwo/dv+ntzG8BuSjvBPqZmCCcHKniLddIh8AmF28QWlOPMDxU95vexV7LI989OjixCPd4eNca9++icPvJQoRCvY16X9JvYDJim9o9Mjy9+4LMdgO05OdS1BTKBD4zui5X4PycqAeXTzt7i+D+mD7FVTULr6WXi95/i0eJhHuoRFpCZz8Kjj11WbGhiCnXGbzhgSOjnh0bkJafwV+z8GBqaJvycK3yMPVHlRlWvVHFtPzDy3pmG4KlErZ2qBW/QunNvk8McjplDRIoenz6wHYnen7xlMnsikY/YvKAL/PRXY7Bv4ccJG0fcI6GZa/bDiEY6301tKsbddwB29OGjCHihsUi+D68rymfRYsyFLwgF78Z+CndiD46CHe4Y+0uvByHPK8DknjOm/RUOt0spqB3nGZRcPKdiae9sOey+fkjN39++NvOFsMK4hpa37Pc1GSnpAONo18qOlISjIvD2nbm6QsptItTlAqBoSD+4hLe8+FAKEHkVQ9NbQT9PSOuIK/qpfz7e4pyRGDm9uWD1q5ee774rGZCEG13ogux3O2y3G4VSH/NVAAMPpDN7bSI924GZAs1LUJt1g4jm6YY5HIToi5W7ff5/8ntp2kHDDmYuTiAu3IaJyw1Ho3+eo/JV5PD0TFW9K5QjqTlIQNIzzw6/q0C7K8LYlCNHmM2a6ogx+ZkGrE0USL8jpV8zzGzmZei7j9CIikO7MtwTwrC2hkSPPzYWqxIhWzsfIt8FB+zov55/5e1+tV8tR6KNRVz4ujt0gBzgm4wTZx bGGH+Vea xnmdNWtvVBV65rP+edkxeV0BR7/JUJaT3dm7JeVTR+kSc60rhmbIanhJBoTHxViaTxq82GnXp7bbTiHvEbDkj649GF9YMenLGC54Bb+E4H7O5lSTqxC04XYv8tGuEq/ILw7DHnx0JD2Od3iP2hqAufBDrMLBBh1y2o4g5GAtVFPaOylyCV0TCeWmwacsAWTDrIcwD 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: Use __folio_test_movable(), no need to convert from folio to page. Signed-off-by: Kefeng Wang Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- mm/migrate.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 4be61f944cac..8590e6f68cf3 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -157,8 +157,8 @@ void putback_movable_pages(struct list_head *l) list_del(&folio->lru); /* * We isolated non-lru movable folio so here we can use - * __PageMovable because LRU folio's mapping cannot have - * PAGE_MAPPING_MOVABLE. + * __folio_test_movable because LRU folio's mapping cannot + * have PAGE_MAPPING_MOVABLE. */ if (unlikely(__folio_test_movable(folio))) { VM_BUG_ON_FOLIO(!folio_test_isolated(folio), folio); @@ -943,7 +943,7 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, enum migrate_mode mode) { int rc = -EAGAIN; - bool is_lru = !__PageMovable(&src->page); + bool is_lru = !__folio_test_movable(src); VM_BUG_ON_FOLIO(!folio_test_locked(src), src); VM_BUG_ON_FOLIO(!folio_test_locked(dst), dst); @@ -990,7 +990,7 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, * src is freed; but stats require that PageAnon be left as PageAnon. */ if (rc == MIGRATEPAGE_SUCCESS) { - if (__PageMovable(&src->page)) { + if (__folio_test_movable(src)) { VM_BUG_ON_FOLIO(!folio_test_isolated(src), src); /* @@ -1082,7 +1082,7 @@ static void migrate_folio_done(struct folio *src, /* * Compaction can migrate also non-LRU pages which are * not accounted to NR_ISOLATED_*. They can be recognized - * as __PageMovable + * as __folio_test_movable */ if (likely(!__folio_test_movable(src))) mod_node_page_state(folio_pgdat(src), NR_ISOLATED_ANON + @@ -1103,7 +1103,7 @@ static int migrate_folio_unmap(new_folio_t get_new_folio, int rc = -EAGAIN; int page_was_mapped = 0; struct anon_vma *anon_vma = NULL; - bool is_lru = !__PageMovable(&src->page); + bool is_lru = !__folio_test_movable(src); bool locked = false; bool dst_locked = false; @@ -1261,7 +1261,7 @@ static int migrate_folio_move(free_folio_t put_new_folio, unsigned long private, int rc; int page_was_mapped = 0; struct anon_vma *anon_vma = NULL; - bool is_lru = !__PageMovable(&src->page); + bool is_lru = !__folio_test_movable(src); struct list_head *prev; __migrate_folio_extract(dst, &page_was_mapped, &anon_vma);