From patchwork Mon Aug 21 11:56:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13359343 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 A202FEE4996 for ; Mon, 21 Aug 2023 11:45:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 87E898D0002; Mon, 21 Aug 2023 07:45:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C1C38E0005; 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 1FCE58D0002; 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 F28288E0002 for ; Mon, 21 Aug 2023 07:45:41 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B8DF91C9A96 for ; Mon, 21 Aug 2023 11:45:41 +0000 (UTC) X-FDA: 81147932082.06.EF2D33A Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id 88D68C000D for ; Mon, 21 Aug 2023 11:45:38 +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.188 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=496QIw6C5jV7GVvmMfl4tBYrr6HieHOGuCrhHEnGykE=; b=xRmk0h9owxUXAeOqARKd2MHiAEgMtONM9FhPQSqxsLcay2droAhecZm5qiEHLR27OoN+jQ wTPMDV0Ci/d8/maIp4wImyLexpgqmv3rYkARQrdlFvdVXl5PfAjq+EuDtwYIy4aZV7iRbF Vfb1+wqpJH0MrqxKtzcf8TNWCmbm214= 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.188 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=gj8IUwkdNZB5CjNiY9BbXOOh/C77EMgQs1x0UZHIIp+N61yrnSdYNkDnWUA//AXxshMjIS 26oWQxGBs9zUmSjmMFtNeMDtSokxxNEgQkPCYSNSpS0L70PdRfOmKSbjNwxZ80oTr0OW9g +8nQi/rhJJXeg8Db1hL1DLDHMBtxwdg= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RTrDT6tzyzNnKL; Mon, 21 Aug 2023 19:42:01 +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:35 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Mike Kravetz , , Kefeng Wang Subject: [PATCH v2 5/8] mm: migrate: use __folio_test_movable() Date: Mon, 21 Aug 2023 19:56:21 +0800 Message-ID: <20230821115624.158759-6-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-Rspam-User: X-Stat-Signature: r36fw5n6cmekyjffhgk3uojcu7kjm3x9 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 88D68C000D X-HE-Tag: 1692618338-777659 X-HE-Meta: U2FsdGVkX181oisLcE3Wkd8xc9+/a4u4NtwrVgboocteQowUZubXgYyrueiPzYjgL0jsKwwtioEC7cfGDNuFzN25aEnt2o0VIytvBwlgf4vH+BdGxb2JB+HTHwieFjK+5VLMBCIS8ALQhpdqX/x35TgVKaU/NITf6x0bIOe/bbtWfa3EoHuxf8LREaDYHC7G4BY328DQ+ww+Vwjo6dyYDk3NjiGORAGWFSwSEZkARz+iAMx5JiAaSr1dbPV+KvEbxN9cqF1o7DXchjTl9r8Zn7M9JDGVwPB7oSnoyaxJ9RqxYFwGeDh8Mm+yw37RH6uUOQwNttcGD8qkFk0G4yBuGHZI1+ACtB5iI2zCblF+zfvvEkOZArVDZzkOg2YLQP15KIbOVAbswm9fxJMQgfqLSxJxpl+oIjC0+yIoyHxv044LKvVrrolsKsRQ3QnGb2i9iNnNaATZniTmr1MkAIN7ASU0QTks3wbBzJDdO2lTY6uVJx3g/DLKLu7W3eCcK09B8R6QZteHW8yW2xGoF34ZMK5gIYmiIgNKyntk3ckTM7NrteUUZ5KvwvCtiyNOSSJ9YZM6j+wsWvowoLfp5sJoHY/0buIh93pAZ7+bG/+JmENa+5mx55yvg0X1cV46BzUx9p/+CTZ5O9BShNbt8ZAyKwLtsNC6j3HvNQjlE9pF0eg4ekL7SJCw5lHo2K/eFYWx/VqmIMMlvTUQDFBCgQgSfEAHgh7nqL10flPLLVzLqVbxqfTsHZkZZPaBtRd/230uJzwjKAWn/0/bZncv4Pr0anNWl5Xp96m47n7jnRQSdZh5Ip7QICKWf/FKS0cikeAzdKWP+TVXVVonGE12VLFajfs/YkfXOOWUOTjXM98+xoAvxgH4PFzWyAxBQgIo1pXMbagN0XQQR4xcVL9m2/vKmQ9dAzYD9wYSZjcFgt9zYLNB43QG7N0dQ9dWTravagNj7kEjtwxWuArwGV8rG/0 l04bHmhm gFBj0SHmB/TGCO1HTwZ5218vP9Fdvoq5HJI0I9lwRiBkaJUEtHrMBimvai1ar0f76RXWZbYhZELmW1W4WiYaD+Y02Fq+qUe7NHV1YWAtXMoKV113+k5N2vlVFEEQs4Zskq5RRavHjFGOhjY74sASs09xrWfwz4tX52e7A94Lq85sf3m3iCNq0BhPMK5Tsyn/PEHvwrs7f2s1MahEb0Slhoqoo8238AKgXc6LPxPhSm7tFDBJlOfnP+VYPdXlgwsOBYjbmH3NSkvxQzWEJlo27s/tUlQ== 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 again. Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand Signed-off-by: Kefeng Wang --- mm/migrate.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index fc728f9a383f..b715cd59bdec 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);