From patchwork Wed Dec 28 11:34:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13082862 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 2EDA2C3DA7C for ; Wed, 28 Dec 2022 11:18:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA47A8E0007; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C0B298E0008; Wed, 28 Dec 2022 06:18:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 833EC8E0009; Wed, 28 Dec 2022 06:18:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 51C9F8E0005 for ; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 232AB160233 for ; Wed, 28 Dec 2022 11:18:32 +0000 (UTC) X-FDA: 80291466864.26.4D5FC5C Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf04.hostedemail.com (Postfix) with ESMTP id 719E740012 for ; Wed, 28 Dec 2022 11:18:29 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.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=1672226310; 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=vqxNiO+XdrY/8V4epzE1ZYJZkPd3hYO9rbl7YMVD86c=; b=fUj4Al/tyGHpUl5BHXq9BPhZ2PzEJAcRPF6ndDTsgGpTtSyLVRpFwfJzfTnk+4hmpCrfxb cfjmnh22HUEmPjXlTPj4t0Pii81S5QLStk8ewSmOGejgmWIfH840UWg5D250fw/HotnwlG q25GLxqDfvS/gghe9MCAdg+C0gKTUk0= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.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=1672226310; a=rsa-sha256; cv=none; b=Vv6yAZQBL1gIv7fDEMJITIrtS/khpZ5S66DFYVJfAE0FqjYhwD7MrDhrx7VpCiwm0xVHBk h30cV1ailUYl4Z6MdoorJQX3LOGBjPzRaeIj4vvBVUj55Ut2HGxQ8/z48BVEcyB3fxgZCt tWlGDzJ3AkLtzfIxXgn75mpQidHgADs= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Nhpmw0v8GzkWv8; Wed, 28 Dec 2022 19:13:52 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 28 Dec 2022 19:18:23 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v3 1/7] mm: page_idle: convert page idle to use folios Date: Wed, 28 Dec 2022 19:34:07 +0800 Message-ID: <20221228113413.10329-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221228113413.10329-1-wangkefeng.wang@huawei.com> References: <20221228113413.10329-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 719E740012 X-Stat-Signature: 1yidi45myjah9o776xk78ueuaeg8zqtg X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1672226309-887708 X-HE-Meta: U2FsdGVkX19RWfuc9Y5gAP6+R2l6lyrlE55YqzTFtmIK4aLDNII2eQs7JoAsAPlqCPaaYYjiXTGAGpNUzhowCljd9BJF0fiWhBkjuM3Sc3rka7jYhzCjphLnQsg8yigeVzWWL5PuEoW9u3CPK10Md11DXYhbh+5nZ4VFg5DmuBmrB5S6c1AGgmi4wJdKoX8MBzzBwTw4pufv3Y+mTt/PGWlRqdkCFmAYLXs9fCf6IBKlTH46knPVBrIWFIgZ51s+Qan3j/B0m8eJdq3/6YiJONqwXgO+JDQQYzVnDjK/dJZmETRTjDcc5rnmW5Ps5jbnqFACkX99dq9GVc1B+gX26Cj1L7vagmGWfxAyIE8uS/iwgP5cNvyvV+Odkv2FU1qLBRbRbVukGtSYt9zjm2EpODBvPLtxBWbPA/SL9WJkfJa9R3Y2KetrVFPC6NY8Jy07v3CjYY4pwwfmGfry6FpaB2euOz5H0HA9XcDEQJA+kgRtMS47p2MnsoG86eFUOcD+rq/lonMv5eEkxYBChLi/3J6Xo+yiTsoJkiiKfXsVoQMUiIIPTYnbl91S9E9ZEpS6T98iWKaxJGJL/NgYPy6lS41iAEUTsmKrtncpoGg1F6VciYX69Ce56w8OtJFbabWryQUWiOspD5B482+wZbEaINIp6hNjh+OIB0yIZ5soXfRkPTieAf4aQoYukE/4xP+w+SL+tc56V93t0++Nck1J0zhwLzd5y0uyduytjh3t6uUDPWzSLPQMbLMXIl+DJ/Em3CzIjTAWGsGubr6K6ZfU7ZIIEILvaWZ1ed3TmTao5zoxHlGj8uMk7wqh8ou+kNKOzS2VJzPphXK/cL4MRzV0VD0NU7nbraHaUFUJH9coO+rvjHMAjTmYyW4hwygbOnNDQRpS+seFwNlfQs1IqMtleIhXQpE86TtIRC/+pZ4PCXu4BTw0lYUCVO1XZqPePBEKQsMYuSXOOCtHntRbpue GvO2mdeA uVCV/ 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: Firtly, make page_idle_get_page() return a folio, also rename it to page_idle_get_folio(), then, use it to covert page_idle_bitmap_read() and page_idle_bitmap_write() functions. Signed-off-by: Kefeng Wang Reviewed-by: SeongJae Park --- mm/page_idle.c | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/mm/page_idle.c b/mm/page_idle.c index bc08332a609c..41ea77f22011 100644 --- a/mm/page_idle.c +++ b/mm/page_idle.c @@ -31,19 +31,22 @@ * * This function tries to get a user memory page by pfn as described above. */ -static struct page *page_idle_get_page(unsigned long pfn) +static struct folio *page_idle_get_folio(unsigned long pfn) { struct page *page = pfn_to_online_page(pfn); + struct folio *folio; - if (!page || !PageLRU(page) || - !get_page_unless_zero(page)) + if (!page || PageTail(page)) return NULL; - if (unlikely(!PageLRU(page))) { - put_page(page); - page = NULL; + folio = page_folio(page); + if (!folio_test_lru(folio) || !folio_try_get(folio)) + return NULL; + if (unlikely(page_folio(page) != folio || !folio_test_lru(folio))) { + folio_put(folio); + folio = NULL; } - return page; + return folio; } static bool page_idle_clear_pte_refs_one(struct folio *folio, @@ -83,10 +86,8 @@ static bool page_idle_clear_pte_refs_one(struct folio *folio, return true; } -static void page_idle_clear_pte_refs(struct page *page) +static void page_idle_clear_pte_refs(struct folio *folio) { - struct folio *folio = page_folio(page); - /* * Since rwc.try_lock is unused, rwc is effectively immutable, so we * can make it static to save some cycles and stack. @@ -115,7 +116,7 @@ static ssize_t page_idle_bitmap_read(struct file *file, struct kobject *kobj, loff_t pos, size_t count) { u64 *out = (u64 *)buf; - struct page *page; + struct folio *folio; unsigned long pfn, end_pfn; int bit; @@ -134,19 +135,19 @@ static ssize_t page_idle_bitmap_read(struct file *file, struct kobject *kobj, bit = pfn % BITMAP_CHUNK_BITS; if (!bit) *out = 0ULL; - page = page_idle_get_page(pfn); - if (page) { - if (page_is_idle(page)) { + folio = page_idle_get_folio(pfn); + if (folio) { + if (folio_test_idle(folio)) { /* * The page might have been referenced via a * pte, in which case it is not idle. Clear * refs and recheck. */ - page_idle_clear_pte_refs(page); - if (page_is_idle(page)) + page_idle_clear_pte_refs(folio); + if (folio_test_idle(folio)) *out |= 1ULL << bit; } - put_page(page); + folio_put(folio); } if (bit == BITMAP_CHUNK_BITS - 1) out++; @@ -160,7 +161,7 @@ static ssize_t page_idle_bitmap_write(struct file *file, struct kobject *kobj, loff_t pos, size_t count) { const u64 *in = (u64 *)buf; - struct page *page; + struct folio *folio; unsigned long pfn, end_pfn; int bit; @@ -178,11 +179,11 @@ static ssize_t page_idle_bitmap_write(struct file *file, struct kobject *kobj, for (; pfn < end_pfn; pfn++) { bit = pfn % BITMAP_CHUNK_BITS; if ((*in >> bit) & 1) { - page = page_idle_get_page(pfn); - if (page) { - page_idle_clear_pte_refs(page); - set_page_idle(page); - put_page(page); + folio = page_idle_get_folio(pfn); + if (folio) { + page_idle_clear_pte_refs(folio); + folio_set_idle(folio); + folio_put(folio); } } if (bit == BITMAP_CHUNK_BITS - 1) From patchwork Wed Dec 28 11:34:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13082860 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 9C297C3DA7C for ; Wed, 28 Dec 2022 11:18:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 76B3F8E0001; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7496F8E0008; Wed, 28 Dec 2022 06:18:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 54D098E0006; Wed, 28 Dec 2022 06:18:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 26D3E8E0003 for ; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EF748C0BB2 for ; Wed, 28 Dec 2022 11:18:31 +0000 (UTC) X-FDA: 80291466822.28.05554CA Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf05.hostedemail.com (Postfix) with ESMTP id 80DAA100007 for ; Wed, 28 Dec 2022 11:18:29 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672226310; 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=6H99sao7Cvbt+F0FO5z1NYRXLj3fZQGHkzFFHDTuAQE=; b=mUUUAd5T7GfkhwhaBgYe/UHn2xU8Mymp3PWeh7KBXs7TH4e0Qq3koCoXnjLKEFmb3e6STr ZgoB6KBTPThpvjqkzD0T1zhQpY/06Cw7LpKnmNxaGJoAH3azzz3BkL9XfwocLlsEGmSng0 sQAJbLN1E0i1KD1izQNuQQ7K5uaQOpE= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672226310; a=rsa-sha256; cv=none; b=QgOG48BJUt7Vk4oePnQ+6pLM8jp+Og3yEkFAN1PELDXYiBCsWzBrlWJ56E9LLFa7Mt8ZJ7 X6dPyoqQwMVrihiuaX3BjbjhPHpwO0VQZ/UwqeUxwKg0LX5+xmHJGB5Fw70u61OeV1G33a gqhHWegJgFpUN8xMVAVh+YD4yBkeLWo= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Nhprg2V1kzmWq2; Wed, 28 Dec 2022 19:17:07 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 28 Dec 2022 19:18:24 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v3 2/7] mm/damon: introduce damon_get_folio() Date: Wed, 28 Dec 2022 19:34:08 +0800 Message-ID: <20221228113413.10329-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221228113413.10329-1-wangkefeng.wang@huawei.com> References: <20221228113413.10329-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Stat-Signature: cacme5ut9u96sgi9junyoiin7rua9hp4 X-Rspam-User: X-Rspamd-Queue-Id: 80DAA100007 X-Rspamd-Server: rspam06 X-HE-Tag: 1672226309-169411 X-HE-Meta: U2FsdGVkX1+lohrsByRNzS//uF4CnIpkY17NBvh4LGAhr+eSDKLXCVkPsdzQpCsglQ2HYj0fdXZo3UHO+ZUyC82KWnZB0OA1ZXUffPkDBHZBdWrLTtSG2Mv/lXLQWLjIF17GshtbF/iG47KtQUJBSXiYNP2D2U+vwa1dAOWUnJIrNjWOrIoVSXRIZNpNs8RDVK3qxEQcCcGq4lJ4WqZoD2oHCmbknFbJLzmMfRC4FUe9KQG/7VFTsod9a9MsHYHBC2nuxYSL9hUOUQLhnK6B7jnXOapOHrrbf1BRgEFBHs2PPNvzfORfZfWRhWla/JTRCRUoQeTfp2D2dVmUZdOCgPGmQA8HGT/dQ9OgVaIy6Wp1549u+BrnyVmg7tykkjPORW14E0/p9R7OL/IYp4Z1zXgl9al1pzY1eoyFktxaguFrrKIrYiqLfY/vYgFo/xAI0OLsEj8nEPAIZ/mnT2EF1rrbB1IJh00THpJwIwiTYlyd12Qx1V3yka2TOc3cazE7mg4J7kYBLCBLD4mmBfcqOVA66zRwFhk/0IZ6KTlzq9zLTyFssAdCv4n8XPBDdp7r6GV7h4RhmVPySWP4mf1FCqqWrnVrkcr34YDNQTnjS0yXXf++qXp4H2NtLNp0sS3s7uXICaN2Fth5VDBbMzeS+ra9P+emMv0wTpug1n0usBx3THW0Y9KIojpkDYWYXZ/bgzdC5u8sHwT7U7FVd08Ze3a/AxZ/E8dcIEAfjYUnSd4rsxej4npongU8GR3vcH6TuyvZgOqqzlObNYZfGXr0eWnLXrk1Yjp9kPhyxMxWHEpH2QoXEbfm5etOlIXrVAmdGmxtl3NaQ2w/FetuLb9OD8xZQbGErGdu8Kn1LvrY7dnP/HrHV9JtIXKPMXsyK06XZy1g6MguiD7DS1nC0488JJmsfTL+ipI4tKtNJChS4U1cNKbPeZBRLipaZsyOWS3p4fHWO0IJ8MWEAghpEFO ZfnUEbuA r9W7kGLa/6EPlRlI= 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: Introduce damon_get_folio(), and the temporary wrapper function damon_get_page(), which help us to convert damon related functions to use folios, and it will be dropped once the conversion is completed. Signed-off-by: Kefeng Wang --- mm/damon/ops-common.c | 18 +++++++++++------- mm/damon/ops-common.h | 9 ++++++++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c index 75409601f934..1294a256a87c 100644 --- a/mm/damon/ops-common.c +++ b/mm/damon/ops-common.c @@ -16,21 +16,25 @@ * Get an online page for a pfn if it's in the LRU list. Otherwise, returns * NULL. * - * The body of this function is stolen from the 'page_idle_get_page()'. We + * The body of this function is stolen from the 'page_idle_get_folio()'. We * steal rather than reuse it because the code is quite simple. */ -struct page *damon_get_page(unsigned long pfn) +struct folio *damon_get_folio(unsigned long pfn) { struct page *page = pfn_to_online_page(pfn); + struct folio *folio; - if (!page || !PageLRU(page) || !get_page_unless_zero(page)) + if (!page || PageTail(page)) return NULL; - if (unlikely(!PageLRU(page))) { - put_page(page); - page = NULL; + folio = page_folio(page); + if (!folio_test_lru(folio) || !folio_try_get(folio)) + return NULL; + if (unlikely(page_folio(page) != folio || !folio_test_lru(folio))) { + folio_put(folio); + folio = NULL; } - return page; + return folio; } void damon_ptep_mkold(pte_t *pte, struct mm_struct *mm, unsigned long addr) diff --git a/mm/damon/ops-common.h b/mm/damon/ops-common.h index 8d82d3722204..65f290f0a9d6 100644 --- a/mm/damon/ops-common.h +++ b/mm/damon/ops-common.h @@ -7,7 +7,14 @@ #include -struct page *damon_get_page(unsigned long pfn); +struct folio *damon_get_folio(unsigned long pfn); +static inline struct page *damon_get_page(unsigned long pfn) +{ + struct folio *folio = damon_get_folio(pfn); + + /* when folio is NULL, return &(0->page) mean return NULL */ + return &folio->page; +} void damon_ptep_mkold(pte_t *pte, struct mm_struct *mm, unsigned long addr); void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr); From patchwork Wed Dec 28 11:34:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13082863 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 70592C4332F for ; Wed, 28 Dec 2022 11:18:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16EF58E0005; Wed, 28 Dec 2022 06:18:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EC5128E0008; Wed, 28 Dec 2022 06:18:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A30D58E0003; Wed, 28 Dec 2022 06:18:32 -0500 (EST) 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 67E248E0003 for ; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3ABB2160327 for ; Wed, 28 Dec 2022 11:18:32 +0000 (UTC) X-FDA: 80291466864.25.7943A50 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf15.hostedemail.com (Postfix) with ESMTP id 1B9E1A0009 for ; Wed, 28 Dec 2022 11:18:29 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672226310; a=rsa-sha256; cv=none; b=O6TMeQpiDX8/pm9On2oCsRrxoMh+sSR8ZYFw/xVCOVe/dyZJMgALLUXGAO1+v+TZmm3uen IZRmNE7mLBxFi0KPokDrqyoIVU//DRzjSNcMVeeuQ2Oct5Utd9VogaR4jPpzhApZaYynjN B++mkQxXBLk//15Aw48G//Qy2JHOSek= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 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=1672226310; 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=TdrZ+DVWBxhNXXeX3zgk6LTsY5E3GFAgGUmdbkyk3HI=; b=LzVfusnYHhx0l7wC//Rqr7SflO962I1T43AUiK0o+w7Ws2r3OiUyAfWo9ICN9aYdeSLLzn Q9Gz+bIg1wGvV83qCZDLWYoo8lfKPPvcFYJ3OlEIAH5atTu8OJQqaxypoBV8cugRgqvuna Rw/1RQq5QWDgpdMY5TgfqcT032F0yK8= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Nhprh48Tjz16LZJ; Wed, 28 Dec 2022 19:17:08 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 28 Dec 2022 19:18:24 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v3 3/7] mm/damon: convert damon_ptep/pmdp_mkold() to use folios Date: Wed, 28 Dec 2022 19:34:09 +0800 Message-ID: <20221228113413.10329-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221228113413.10329-1-wangkefeng.wang@huawei.com> References: <20221228113413.10329-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 1B9E1A0009 X-Stat-Signature: dukbt5otn4h5x76k1cykjr6fc1pimh4c X-HE-Tag: 1672226309-450158 X-HE-Meta: U2FsdGVkX19prG4V3t/IW0p4YE/xiYoxTcC/TMGjSOOnudwjtszwAylHv3pJQSfZ+viuBOXt7kb8qGgoI+NmmtW64K58XznrnUdGJgXKldvYqWXC/dt8D2/Q1BcX3RIZI/UD7SSLOiIM7TCc6/bYyqPBN1RT0LJPw3pbqgWjJOSBsX3DAd8Z4SI65J/1mvaBIlr8CAXmII1c0/aJ+Lteg1xSDufgLQbXGy4nBMjCNq1TtZyjsPLxmCgZxivAC7WMk0rVU36YotJZAxH+gcbrcwAZbLfMpqEzlbGFsXCkHq/+8KzJtls23YBg2PArXftvsVNfgwguBrkNTtjtOx7OoaUiOS3LtEPd5DHMuHby135FHapU070tz3sY056xPzjvx+BFqOGLrSAQ1KznDNMM0eNgtcguJu1EkNgrD5XjnrrB8c98IbqOfXcoP7NP09GakdiKzmHZFsnwJkH/aXKVjbsoWfGiDwZXApm02s2iXQW7CGZS4vn79NZ+JMAmB8JOw/3+hU6lUsfN5cPzfLiBXtXYLwGLdL1wp774MtSssS3ueBM3KmFNQQ650RN/YVXZ3OWiXZP3jwGEdk21mCOaZ6iwshYUqcNuaHl3yDpzLHMu3eIEb59H8lUVVdwmBKA67VkXwc/qaLdOVKQ6H+zQfRf/kdAMDM+73FMWKqD0DV7oh3BO44IwV65MRZ7Yck0SPDxIITUV9q1jjOJ6cS8u47GCgvvcYNlnDY91+4Its4nwh+1C5LZDM+6RXiEM83vnsNtnppgfp4+EeVzUi727piTBPajJKQx7jD7iAltaH1x+n2nuG+nDZCjtxyALlfeznBtG8vf2bKWg5iDKb8MGdcTNrNAu0O/pw1TwDGNtvjDKIv7Tl1b3Rfh9G7wMNjh54tvbyX4fDtJ/qC+n/qkK/E2eME1xLy8g2u3IFp9kAdSs+jNjADwKq0QQqXX083Sc3qAYrytNueg+SrhX6ir V2P0auJG 4xGXN 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: With damon_get_folio(), let's convert damon_ptep_mkold() and damon_pmdp_mkold() to use folios. Signed-off-by: Kefeng Wang --- mm/damon/ops-common.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c index 1294a256a87c..cc63cf953636 100644 --- a/mm/damon/ops-common.c +++ b/mm/damon/ops-common.c @@ -40,9 +40,9 @@ struct folio *damon_get_folio(unsigned long pfn) void damon_ptep_mkold(pte_t *pte, struct mm_struct *mm, unsigned long addr) { bool referenced = false; - struct page *page = damon_get_page(pte_pfn(*pte)); + struct folio *folio = damon_get_folio(pte_pfn(*pte)); - if (!page) + if (!folio) return; if (pte_young(*pte)) { @@ -56,19 +56,19 @@ void damon_ptep_mkold(pte_t *pte, struct mm_struct *mm, unsigned long addr) #endif /* CONFIG_MMU_NOTIFIER */ if (referenced) - set_page_young(page); + folio_set_young(folio); - set_page_idle(page); - put_page(page); + folio_set_idle(folio); + folio_put(folio); } void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE bool referenced = false; - struct page *page = damon_get_page(pmd_pfn(*pmd)); + struct folio *folio = damon_get_folio(pmd_pfn(*pmd)); - if (!page) + if (!folio) return; if (pmd_young(*pmd)) { @@ -82,10 +82,10 @@ void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr) #endif /* CONFIG_MMU_NOTIFIER */ if (referenced) - set_page_young(page); + folio_set_young(folio); - set_page_idle(page); - put_page(page); + folio_set_idle(folio); + folio_put(folio); #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ } From patchwork Wed Dec 28 11:34:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13082866 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 DA962C4708E for ; Wed, 28 Dec 2022 11:18:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86BAE8E0008; Wed, 28 Dec 2022 06:18:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E7B98E0003; Wed, 28 Dec 2022 06:18:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 290938E000A; Wed, 28 Dec 2022 06:18:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E2E0E8E0009 for ; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AE329AAF36 for ; Wed, 28 Dec 2022 11:18:32 +0000 (UTC) X-FDA: 80291466864.21.0E0B2B2 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf13.hostedemail.com (Postfix) with ESMTP id 59A3520005 for ; Wed, 28 Dec 2022 11:18:28 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 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=1672226310; 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=KRyOhLV8t/viDPD1r/fMCP1wCfer/Ov11lFql4Kb3JQ=; b=y/qG/D+pjk8SxssLfHb8IBBylqgpOB3ddshMyeOcVUwUUlUNyJRB+oee0c3JMV+LSuofWD vhGqAFBzEZJfsHRb2D0PSDOCx7xLj3wuunv/kZhrkfaI4Z47bKETI/6P1Mq5VvXSOOfZvR 1fPs/+FQETPlOYS4fPr+34nxECGnvMI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672226310; a=rsa-sha256; cv=none; b=T3zpEB8UrvPUXZ7ZnwlmPXBdnYFuaJCp5ctATY/hoZK7u6HZP6EBrXHoDalPO+GPZHMUsK a+4DRKJhGhltTG++btz7fXQArxeIFXXxPck83nGhM/TKA2WIhHkh9bKwDSNsZBOB+XOG+n c5N+04q7SQheLQqCOreQ2VHHcZKI0PA= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Nhprj0Jltz16LrW; Wed, 28 Dec 2022 19:17:09 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 28 Dec 2022 19:18:25 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v3 4/7] mm/damon/paddr: convert damon_pa_*() to use folios Date: Wed, 28 Dec 2022 19:34:10 +0800 Message-ID: <20221228113413.10329-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221228113413.10329-1-wangkefeng.wang@huawei.com> References: <20221228113413.10329-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 59A3520005 X-Stat-Signature: qgxf17nii3fz7m9g3w1rmmxbryjwyqfp X-HE-Tag: 1672226308-832325 X-HE-Meta: U2FsdGVkX18M4W/zu85X0Ov+PiRudCJ2eNpb6x3zIoJv4pgUs0jVYK9SN+sg0SJdOA1cl/YESxAvVqr83BNH5kuqjK524DsSMM1/PC3XzxQu3t5/B379WQfyuoLdaGk6Nc1lQjx0O2EB7lX0S/mi/tjGuzV9gJEwwtQ3I8sJ1yiXSf+fIMOWjllGHUzn7klnUBere4i5wKjBmaWh5862k2jvgBDtYuzdj83HbPrg+3XQ11ZjQbzcgKNR3Ct8tbZ/AY0E/Np+GbRvRxBjhSjQCp9px43Vc4uqVBYfUZ6XuxW8jfYCddb6GJBACKZRS5H9M7eMiyC/pmAoyj78kjBGcdIht5GcG212mSqQ1Oa1b5apur3Up8FU/UL4fkmNK+7Om59NVbZBnf0AUPOerUPiS8lfvRVfQbBJM7KTCQamUNpDiTA2j4l1bH9EOfr7O24/8Ibdpy59OBvL5eqDENve9auugFVsHGz1w9EZEeOZnSqsy9T3+b5KhInXXi9B5tH7C/LMrZiy0XtDpbOXOP9dJz8qfFYxLXsI+R6vZhIWHVQXYDuD34x+UoRKZpQz2FZdMey3zzyOTtU7iIp74lwYiP/+jbFiCIuAkc/zVPl+B0HEWfhKkqGKM+7dryh49nVK7k24wa+3unWKeKKazcVyCPMhIcf+yqPEIlEuPoZfK4GNPkLKvv875ex3nHd3Yx5f5+K880/3KBOZ749C/Tvr41ZBb6lf3oLFC48jw1pn8q2w2plfUT10QGPr/aX9N4XkFmoKzFvSu4adRWSatCZWGVhTIKk3tieFABjo6sjo66W3D0uP9A1MH0gBQojT2anftSjvHQvV5FkcQpEuWQFHs9J02vMavSYKXf5zCCQsluks4FWfarn7IhaWi3d9m/wYkY6EkDOzDEJ5S4GsNwGuv32BznITumybhN39CY+gdpdrOgLbCgjR5L+tAVx/tCa/T+6HRlYz9OqfSExDWU9 NypNrqYK 9Exai 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: With damon_get_folio(), let's convert all the damon_pa_*() to use folios. Signed-off-by: Kefeng Wang Signed-off-by: Matthew Wilcox (Oracle) --- mm/damon/paddr.c | 58 ++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 6334c99e5152..fbfd66199f3f 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -33,17 +33,15 @@ static bool __damon_pa_mkold(struct folio *folio, struct vm_area_struct *vma, static void damon_pa_mkold(unsigned long paddr) { - struct folio *folio; - struct page *page = damon_get_page(PHYS_PFN(paddr)); + struct folio *folio = damon_get_folio(PHYS_PFN(paddr)); struct rmap_walk_control rwc = { .rmap_one = __damon_pa_mkold, .anon_lock = folio_lock_anon_vma_read, }; bool need_lock; - if (!page) + if (!folio) return; - folio = page_folio(page); if (!folio_mapped(folio) || !folio_raw_mapping(folio)) { folio_set_idle(folio); @@ -122,8 +120,7 @@ static bool __damon_pa_young(struct folio *folio, struct vm_area_struct *vma, static bool damon_pa_young(unsigned long paddr, unsigned long *page_sz) { - struct folio *folio; - struct page *page = damon_get_page(PHYS_PFN(paddr)); + struct folio *folio = damon_get_folio(PHYS_PFN(paddr)); struct damon_pa_access_chk_result result = { .page_sz = PAGE_SIZE, .accessed = false, @@ -135,9 +132,8 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *page_sz) }; bool need_lock; - if (!page) + if (!folio) return false; - folio = page_folio(page); if (!folio_mapped(folio) || !folio_raw_mapping(folio)) { if (folio_test_idle(folio)) @@ -203,18 +199,18 @@ static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx) } static bool __damos_pa_filter_out(struct damos_filter *filter, - struct page *page) + struct folio *folio) { bool matched = false; struct mem_cgroup *memcg; switch (filter->type) { case DAMOS_FILTER_TYPE_ANON: - matched = PageAnon(page); + matched = folio_test_anon(folio); break; case DAMOS_FILTER_TYPE_MEMCG: rcu_read_lock(); - memcg = page_memcg_check(page); + memcg = page_memcg_check(folio_page(folio, 0)); if (!memcg) matched = false; else @@ -231,12 +227,12 @@ static bool __damos_pa_filter_out(struct damos_filter *filter, /* * damos_pa_filter_out - Return true if the page should be filtered out. */ -static bool damos_pa_filter_out(struct damos *scheme, struct page *page) +static bool damos_pa_filter_out(struct damos *scheme, struct folio *folio) { struct damos_filter *filter; damos_for_each_filter(filter, scheme) { - if (__damos_pa_filter_out(filter, page)) + if (__damos_pa_filter_out(filter, folio)) return true; } return false; @@ -245,33 +241,33 @@ static bool damos_pa_filter_out(struct damos *scheme, struct page *page) static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) { unsigned long addr, applied; - LIST_HEAD(page_list); + LIST_HEAD(folio_list); for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) { - struct page *page = damon_get_page(PHYS_PFN(addr)); + struct folio *folio = damon_get_folio(PHYS_PFN(addr)); - if (!page) + if (!folio) continue; - if (damos_pa_filter_out(s, page)) { - put_page(page); + if (damos_pa_filter_out(s, folio)) { + folio_put(folio); continue; } - ClearPageReferenced(page); - test_and_clear_page_young(page); - if (isolate_lru_page(page)) { - put_page(page); + folio_clear_referenced(folio); + folio_test_clear_young(folio); + if (folio_isolate_lru(folio)) { + folio_put(folio); continue; } - if (PageUnevictable(page)) { - putback_lru_page(page); + if (folio_test_unevictable(folio)) { + folio_putback_lru(folio); } else { - list_add(&page->lru, &page_list); - put_page(page); + list_add(&folio->lru, &folio_list); + folio_put(folio); } } - applied = reclaim_pages(&page_list); + applied = reclaim_pages(&folio_list); cond_resched(); return applied * PAGE_SIZE; } @@ -282,14 +278,12 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate( unsigned long addr, applied = 0; for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) { - struct page *page = damon_get_page(PHYS_PFN(addr)); - struct folio *folio; + struct folio *folio = damon_get_folio(PHYS_PFN(addr)); - if (!page) + if (!folio) continue; - folio = page_folio(page); - if (damos_pa_filter_out(s, &folio->page)) { + if (damos_pa_filter_out(s, folio)) { folio_put(folio); continue; } From patchwork Wed Dec 28 11:34:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13082865 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 74A0AC46467 for ; Wed, 28 Dec 2022 11:18:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 641F58E0009; Wed, 28 Dec 2022 06:18:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 43BB18E0008; Wed, 28 Dec 2022 06:18:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B9998E0003; Wed, 28 Dec 2022 06:18:32 -0500 (EST) 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 9907B8E0005 for ; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 71E751C5E57 for ; Wed, 28 Dec 2022 11:18:32 +0000 (UTC) X-FDA: 80291466864.21.4F37F13 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf11.hostedemail.com (Postfix) with ESMTP id 5316C40004 for ; Wed, 28 Dec 2022 11:18:28 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.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=1672226310; 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=rnhzB6T4tsOkxbilNdxJPGRrXwW2//vST41rcZs8s/g=; b=JbfjE3X6DJAHcwTS3ofEfFVjU3njZHTpo7d/IFrVJyVkhHLCMBBIUJ7+op2aPmNRp3U4nA RBiUQNX88x/0P+rKkRUO7mdABVO2nKi5dQYaNw38I7c5F97W1I0dT/rM7uixQcsT4kkhYW zY6i8JVle5sg1duSoqqbRueBO/IwwnY= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.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=1672226310; a=rsa-sha256; cv=none; b=qTS+QtCzsDZdgD7XW9h0ROV+IV6soes+feAzW2sHyrdweGJJVlN6+cU+l0yJvyvu2qUyp7 nyzOI0w08z4IW4KsWfjKqdScs9VIfsDqNqW7BHw7clfANl25A0uwjjl52x0tE/1baD2PPP lpic1CtKn+SCmCmu+0hWyN3S/ej/+E4= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Nhpmx6t8PzkX3w; Wed, 28 Dec 2022 19:13:53 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 28 Dec 2022 19:18:25 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v3 5/7] mm/damon/vaddr: convert damon_young_pmd_entry() to use folio Date: Wed, 28 Dec 2022 19:34:11 +0800 Message-ID: <20221228113413.10329-6-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221228113413.10329-1-wangkefeng.wang@huawei.com> References: <20221228113413.10329-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5316C40004 X-Stat-Signature: 4dm8zq7qs83s4maoxyfqoikj1bnu6kd7 X-HE-Tag: 1672226308-415866 X-HE-Meta: U2FsdGVkX1+35kZwG/NB92QjMUXhupl9sIIlz+k8Cpj+i0V1+bLzH6mCGUAQWrcMJGQOQqQJPYRwceMmh1/aqrflux2dqPXQxMxaGzThDkEvAXAN3dRX9woWhvOicMwuIioZ0UTLkwt6kAbPyyZq0XvBiT98cIlnS3lEY/gyTtwp67H8s/0fGxzONkGpqrEccI0Fcfyl3TebBc1m7cEEuno8RV97ynOnDy5by2AXmREe/M0gFFg4vrR+r8d2MhoZ9K2TuKtEPhQUxpZSKZ51Lqri3kIRJpeNXnrljYxy4FobgN/rtTF6jxtGQi3vXCn0j9mB1CYyaMQwFjZznjZXgDAY8osZ3r7QibotC8czZFRiAGPQj2UX5cDBY2KRod4+kTLOaf66PR6bIJjqgcs87J/SQFbbicKt9aZlDcFl41a9F4p1skXeT/6UhqjoEPp1zxqY1rDt5vUaaMDSs0iMWU0Tdcjlei66CI4GnA8Q19qnMqPwCngurhMt7DIruQMd8v4bZSOpiQJEkM90PK2LBXU821z1xWXLNYK2xddBxMtFTMrV/94YfIggKfYP69jwTGGJwv+AdJuLSlh/yJcTxsPlsZTqhGSrztMcU3vAFHOT7ahDlsv9GSo56TycM8YmXJfj7J6yokAb3vqWAsI6QIRvOiL+TTF1Pbn+VTOs/a9ckZ6cconps8xDIUapOfPz5MqiBdEgTgbkRnnPxA+YgLg+aKs0D3jPubIoAqWYy8U+rmRgOqL+lVzJCqyP6pWYLkRe+YUcK89rZ6S0k4W8P6YTMRB9zuP8mTBEbcCY/wH1QuqdkRrtQ+9H4qwN7mZ24pspNL55ooZgsUhZl3nuARIRoaE1g5rqT1eegJiRWptEqG1ZoC52xCwgJJiv9ZusYMHcTdRcvZupVBSCfLbkzyrVoUsWlZZ9l96E63hze05uUT0v5ELuxxZrN/8WG5hmK8r+DzZy9cd4DJ4BYR7 gPNaIaoE DCDn8GAaszSQJV70= 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: With damon_get_folio(), let's convert damon_young_pmd_entry() to use folios. Signed-off-by: Kefeng Wang --- mm/damon/vaddr.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c index 15f03df66db6..29227b7a6032 100644 --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -431,7 +431,7 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr, { pte_t *pte; spinlock_t *ptl; - struct page *page; + struct folio *folio; struct damon_young_walk_private *priv = walk->private; #ifdef CONFIG_TRANSPARENT_HUGEPAGE @@ -446,16 +446,16 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr, spin_unlock(ptl); goto regular_page; } - page = damon_get_page(pmd_pfn(*pmd)); - if (!page) + folio = damon_get_folio(pmd_pfn(*pmd)); + if (!folio) goto huge_out; - if (pmd_young(*pmd) || !page_is_idle(page) || + if (pmd_young(*pmd) || !folio_test_idle(folio) || mmu_notifier_test_young(walk->mm, addr)) { *priv->page_sz = HPAGE_PMD_SIZE; priv->young = true; } - put_page(page); + folio_put(folio); huge_out: spin_unlock(ptl); return 0; @@ -469,15 +469,15 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr, pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); if (!pte_present(*pte)) goto out; - page = damon_get_page(pte_pfn(*pte)); - if (!page) + folio = damon_get_folio(pte_pfn(*pte)); + if (!folio) goto out; - if (pte_young(*pte) || !page_is_idle(page) || + if (pte_young(*pte) || !folio_test_idle(folio) || mmu_notifier_test_young(walk->mm, addr)) { *priv->page_sz = PAGE_SIZE; priv->young = true; } - put_page(page); + folio_put(folio); out: pte_unmap_unlock(pte, ptl); return 0; From patchwork Wed Dec 28 11:34:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13082864 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 03333C3DA7A for ; Wed, 28 Dec 2022 11:18:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 44A0E8E000B; Wed, 28 Dec 2022 06:18:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 351FC8E0009; Wed, 28 Dec 2022 06:18:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C51638E000B; Wed, 28 Dec 2022 06:18:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6EB278E0007 for ; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3A7E780B3F for ; Wed, 28 Dec 2022 11:18:32 +0000 (UTC) X-FDA: 80291466864.23.938EA98 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf22.hostedemail.com (Postfix) with ESMTP id 19363C0009 for ; Wed, 28 Dec 2022 11:18:29 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672226310; a=rsa-sha256; cv=none; b=zjYf9cEITrIptc2HnqOzc/execLVWumRIngvqmmU2DAp1dZaWBUoRjWelQVAEzrdWAKd26 VmzYheBfraN1gRDd0AxzrDjiQPHufLz7lqTpV/xIh7C3l72HqPCZEvR22DrrTj5Hkpwwwq u621B2XNhO6w1HFzRGlvg8ibYWCI1SI= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672226310; 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=BObB/Ozpoj2T1fBmijWwaUCszymPYr9wh/FHAUAx3gw=; b=pxd9xBWioQElnHqvnYjhy2LYcLO/NbDVxqW5BEjWsF+LWSy/N5epxcro80HPFkmN72qo+A 1eqUQNqjRiu0B6R0mgocZM22Vj6ntXdoARvsEqdU+x9AVhKC8hk1plpZuPgD33pe0cA9hY mYtl5SGidQqGya5DjAvKVqMPU3BnVxs= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Nhprj6rz0z16LsV; Wed, 28 Dec 2022 19:17:09 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 28 Dec 2022 19:18:26 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v3 6/7] mm/damon: remove unneed damon_get_page() Date: Wed, 28 Dec 2022 19:34:12 +0800 Message-ID: <20221228113413.10329-7-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221228113413.10329-1-wangkefeng.wang@huawei.com> References: <20221228113413.10329-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Queue-Id: 19363C0009 X-Rspamd-Server: rspam01 X-Stat-Signature: x11jz5y5to3ge1m3yfpm3iunu99hrzum X-HE-Tag: 1672226309-842516 X-HE-Meta: U2FsdGVkX19wvYHb0Nh2b2weODlDR3qid6ydkqPjuG2ANQ6AGs1FNTWupRdZoBoXVmOxpg9itvTGqYXGoL6BEFITRoS7/yIvHl4ndkW1kASSFYGP5EnSJhj0WPSFxPi7b34XNXyKUrhnEMWivTUjSX4EfofFJTNRpEt7RMq1fAD/DQMMYT3ndCebUAQAm0PhQwqvLk8jpbex1vjlOzHFYYyrCFdaqV7KgZHAHOLRD1zvbsUs4UpuyKmpw1iczWHMiF4iI5mwSkJEF2a+JgMTHB+MUUvRiQb+/famPhilLvBokESDuVIDRY1YPkatloJV2hxjjiescJntQRH1DoLW/CfXPgYSN35OiyoWpy2Yh1e9dmQQ2pcbQ101nEZ+XfQiG3Oihtyv/VhSUpcCMtVLRhIFI+TE459s+vtAZgMRzG66+D6498KSNreoH0NgT7NRLqHqsf4pqwqj4wPNdW6sM0PVTPR2JQ5CmiEOjz/tHuJ59PZon0nLWXSf3dp0+ILhxM59tlnRm9HZqmrqRmAyrARurfbxdeAIkVabPgfWlxf69hYDmOv3YEWsDxxC5c2WsCjcHgwl+vVoCbvTFAGluucYACrc5aljyx1dJSDIIICWeT6AJ6z7WNyJXiDmQXE57QDW/CBfQdxvIvEVv+Fn64IEZJlMKoSUNaD1YEA+ANROvYU2fXkqIDfgURYjDtGg6pbHjkkQhtuClH/uGchNgYRCNgVooaBGlfLkOcADjG2mzpFagJTZiSkJChBMw2Xr2dSr2PezI/LrhsnvOqSWEP255uHBIYId5GOERsh2gQqZqO7xPdaPb4ejgPORgT30LC3M+Ik97xRHSF93xpkmXs2n41ORbYuf3mrXZmjBoXVSAfMplM387g+a7tct/lfxP/1b8rUQcbCKYkPpMjhH4Q+/wwvzF9yplS6kfEvLyH0o15CkceUCiNyT8MC5KcOQ9r7SpJqvXYERBQ3G3Q4 PQrsbA9k 5RHoi 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: After all damon_get_page() callers are converted to damon_get_folio(), remove unneed wrapper damon_get_page(). Signed-off-by: Kefeng Wang Reviewed-by: SeongJae Park --- mm/damon/ops-common.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/mm/damon/ops-common.h b/mm/damon/ops-common.h index 65f290f0a9d6..14f4bc69f29b 100644 --- a/mm/damon/ops-common.h +++ b/mm/damon/ops-common.h @@ -8,13 +8,6 @@ #include struct folio *damon_get_folio(unsigned long pfn); -static inline struct page *damon_get_page(unsigned long pfn) -{ - struct folio *folio = damon_get_folio(pfn); - - /* when folio is NULL, return &(0->page) mean return NULL */ - return &folio->page; -} void damon_ptep_mkold(pte_t *pte, struct mm_struct *mm, unsigned long addr); void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr); From patchwork Wed Dec 28 11:34:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13082861 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 AE650C4332F for ; Wed, 28 Dec 2022 11:18:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A44358E0006; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 992438E000A; Wed, 28 Dec 2022 06:18:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 750938E0006; Wed, 28 Dec 2022 06:18:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4A57F8E0001 for ; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 19BD81402EF for ; Wed, 28 Dec 2022 11:18:32 +0000 (UTC) X-FDA: 80291466864.27.F4670BB Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf27.hostedemail.com (Postfix) with ESMTP id EEB4240005 for ; Wed, 28 Dec 2022 11:18:29 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.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=1672226310; 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=tta+7/oGBxKDm73NTZEGvNoLjVSrzGThVYa6iqTnTLU=; b=qSxV0peRaaK7MPJRiiHCkf7vb8XU8QSo9JenLjsogtS+99Rbk69MzcB++CAw1CD9ObxnQ/ FNTZRGntGWN2DlO8aP0uROqreGP7jyT9VIw9LwI7gv+0HDr6PKZLcAcPtyo2ap1QyBR1NV 2ikJbLPyuoIWkh7KWgTSee5k/wXTs08= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.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=1672226310; a=rsa-sha256; cv=none; b=CXw0TfthJb46dSgerNHuhraXGY81rYLNDcRevN+QI719KK6o7cMhCpgHqOWnggq2bGY3gD TAT5J4qdaohLGT47D5k6IrlLjh6MDZMcjDOE2RFSsN/64cEnIVj+7Zkx8iaFquIoamV//T bvXmJq9oC7qZFDnWUtfyjBHCoviedBc= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Nhprj4QNnzmWqT; Wed, 28 Dec 2022 19:17:09 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 28 Dec 2022 19:18:26 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v3 7/7] mm/damon/vaddr: convert hugetlb related function to use folios Date: Wed, 28 Dec 2022 19:34:13 +0800 Message-ID: <20221228113413.10329-8-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221228113413.10329-1-wangkefeng.wang@huawei.com> References: <20221228113413.10329-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: EEB4240005 X-Stat-Signature: ro9tti9x49mo5o88znzjxf43bcms18f8 X-HE-Tag: 1672226309-364713 X-HE-Meta: U2FsdGVkX18XqbgMiKToQyVEi1RXoUoK/HCRtZcQVOzs93yAAuyLH+ZDR790BUVCYlWAFnlwQWTwKffwheTNtNjL/7eNjAGbUl0z3/654Vks9G+N+ecGjI281lMPFxB0LYHyqUjAseV9Zjl8W8cLnOx2jGbmM5Se8FkS+p5dESrd2HAhqVL2Szepo4DAWCKdB9BmX9aAP5+R4tSA6+Ov1ZCAN0JVHnrNpMVuw6L1kGHg4mLiIjzvtyNorsmoykEtAMbmhOVCQM3DeGSskcsXZQdEDUtE22UCKvj6MkVsdR3vWU2LkMmjFLNtK4RT9IbqnnqNu96i0t9AlbxIM5Ty+BQzXyR5HT0WlLzcQBwQg0uS4KNn8F6k8dq7HngUJkbIPz5dwyYnYqIRGfuCbC3UeJa0lUbVCZJGBl1NKIV+zb6Jhth0LG2wCPbwiHq9xND9YIrYPhp029/7rC3Dt0ELpv+OUpNCQ8SQMU7z9RZduJtWX7MHzLs/f0q5herEqCCymcN8avhbRqdFAbJKlz1S9qM78jIzK5x4brOyQJ/nTD8fAxaf0F3eiaK1MQno5BfwczU83WH0kuJvMqrBuPYKmfSX0WS0BtL9KecYmprO9rIkYnSgGrlpaazdvO4tpmoP1MyWWoLiU4RMWJYx6rmFODgBaR+grSG+RK2cjfVRtKnwWBLLd4UnYMaAeSTuE1LeE7h9/by/SMTADvTGbxYKb0SOViXWcsp/T1dQCNEZCw0xMXH9kKUzWxPAGpksrruAPWZPAqwEgYWpGw2UubblzG1wurQ7HzXPwHBHu0p+LVlX/TaxP6IMTPuKFNcmL6R3Ur/YT3dNCOKx3Ldzs+xUq0nJsS1nl0n4ruzndM66Y8Sr3Cr3NZJoExGRYfIC9APIKyJEAeIFux0TZj9kqKNmoAFDjNb1oLsKaN0iSnjjIxJ1awhMPll2gw== 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: Convert damon_hugetlb_mkold() and damon_young_hugetlb_entry() to use folios. Signed-off-by: Kefeng Wang Reviewed-by: SeongJae Park --- mm/damon/vaddr.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c index 29227b7a6032..9d92c5eb3a1f 100644 --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -335,9 +335,9 @@ static void damon_hugetlb_mkold(pte_t *pte, struct mm_struct *mm, { bool referenced = false; pte_t entry = huge_ptep_get(pte); - struct page *page = pte_page(entry); + struct folio *folio = pfn_folio(pte_pfn(entry)); - get_page(page); + folio_get(folio); if (pte_young(entry)) { referenced = true; @@ -352,10 +352,10 @@ static void damon_hugetlb_mkold(pte_t *pte, struct mm_struct *mm, #endif /* CONFIG_MMU_NOTIFIER */ if (referenced) - set_page_young(page); + folio_set_young(folio); - set_page_idle(page); - put_page(page); + folio_set_idle(folio); + folio_put(folio); } static int damon_mkold_hugetlb_entry(pte_t *pte, unsigned long hmask, @@ -490,7 +490,7 @@ static int damon_young_hugetlb_entry(pte_t *pte, unsigned long hmask, { struct damon_young_walk_private *priv = walk->private; struct hstate *h = hstate_vma(walk->vma); - struct page *page; + struct folio *folio; spinlock_t *ptl; pte_t entry; @@ -499,16 +499,16 @@ static int damon_young_hugetlb_entry(pte_t *pte, unsigned long hmask, if (!pte_present(entry)) goto out; - page = pte_page(entry); - get_page(page); + folio = pfn_folio(pte_pfn(entry)); + folio_get(folio); - if (pte_young(entry) || !page_is_idle(page) || + if (pte_young(entry) || !folio_test_idle(folio) || mmu_notifier_test_young(walk->mm, addr)) { *priv->page_sz = huge_page_size(h); priv->young = true; } - put_page(page); + folio_put(folio); out: spin_unlock(ptl);