From patchwork Tue Dec 27 12:27: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: 13082238 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 329F0C4332F for ; Tue, 27 Dec 2022 12:11:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 120E78E0003; Tue, 27 Dec 2022 07:11:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F8F68E0001; Tue, 27 Dec 2022 07:11:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F02AE8E0003; Tue, 27 Dec 2022 07:11:39 -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 E29008E0001 for ; Tue, 27 Dec 2022 07:11:39 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B6522C0B94 for ; Tue, 27 Dec 2022 12:11:39 +0000 (UTC) X-FDA: 80287971918.25.28BAEC4 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf13.hostedemail.com (Postfix) with ESMTP id 3BD6E20007 for ; Tue, 27 Dec 2022 12:11:36 +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=1672143098; 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=pnviYDLvUudL2zhvbAylY9OKHEgYvnvjn7TjmuAsJjw=; b=hRJjGSp73nDB+LQW/vYWrS2w+AQk30dRkn5Oz4vK6htKNupKS69You1D+zYqNSXSTDT6QJ ZxAf69c8PfrOc44++nx3pVFAn4f1P2U1HHnz7BIzMTzFnSN+IU9wCSx3J0hb1L7faK8nHP M4p/sOd+Vxclc5jDCu8kP5kFdFJnjdc= 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=1672143098; a=rsa-sha256; cv=none; b=kzNTWSU9k7nBEdAx/wwLjJjquZ/sYPF6Rd4X8z/4vbCLT/grrXKoNiUgX0PCYamobNjJbu JbOzE+rZUTfC0mUyto1WcozcQ71jNDqyQlfgX3YDfA9oQoW1bMQV3HrhhNXkozMIPR2BRw jzHd4/1NhmYttfiXvtRHDESNIHGN2YQ= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NhD4V05vFz16LrF; Tue, 27 Dec 2022 20:10:18 +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; Tue, 27 Dec 2022 20:11:32 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v2 1/7] mm: page_idle: Convert page idle to use folios Date: Tue, 27 Dec 2022 20:27:08 +0800 Message-ID: <20221227122714.161224-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221227122714.161224-1-wangkefeng.wang@huawei.com> References: <20221227122714.161224-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 dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 3BD6E20007 X-Stat-Signature: sj4ejsdm1pnk1rf6b4ky4r55zaefqkxr X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1672143096-212213 X-HE-Meta: U2FsdGVkX1/fpkckgMOgf8OgeQBTWJqTGPdB3HEtZbti/ufuiWPNQ9+NVy/K4m3nCMFau3mznzdOMYSVBzqA5AlbtFLyKEfAX9/l/+Dzs68fn0YsoSOaFJe8D8DxTg49Ga2bGGDDn7Lsv+sGBcZSoEqcTP2J0SywBY8HjSocFOYHk7hIRwly3hr0z3Hy2kPrbu88OsEanbLzQvCZXmxhNXLXkelcPPpf1aGnDIye7vvCQxWAWL72CeUfoCCvKptv2b60R1/xah+0OQuUMZPu2quVcpgpUFPc7TU0USHQ1QJgN/sdg8GLaxNVg6817heLnSNNXJ/Nv5qfkFPXSOhYiaXsabHsYg1ZItkMFRK6Ppk+ZeQa80uDKV3dXyXgdig/oGaW6SAt7ib2N4x9L4UoOdXgglpvGnSAFH/SsRt88Q162u4QW3FemgZVgeS7AL4y/04Ww5/8WNndMir99cbac2K/cv1FkbRVQkYSAmrG0AQoXc6+fwuvtNvl5hyXlK9OGBPF0qYFw7qKGfopO/TtpxeawpQ+x4bqreGZVF6aGi/byHEYSMUenIGDh5jvRmtATLQmYq/rYIrgh/IJGJkqAoSuBrmXq70vXKvu7+fSwR624BzZIsakIwTyaVfy22KRU8CzG9uzDTqmxZIdfzVuS+0qI6TIu/XMdDPLLwC0ecgH19+qP0UpEjGSqtuwSgO20gdV7mXMF2V8Jt5awM9xK+Q2syo9dCYCO+DmxPQbB3UWtWoSUpbjwgnb3znbQCjKiKA+kNt99/g3mPvAY1Qm+/5kLEm1lvzZyqgQf5ZvC2ct+3aVRe7W4Zgdz7zIcETVOlA15kWjazq2Wfdw1rhHPA9aDT7TZQSMe6wz3y6VYuviKQ7kN9wxMxAu2scaVZadUrXe3ls4DT6N9+G43UwM1JMeGou9Qgd6jWmFa0+XQDhiaA9Rlydeek8+RSFuP/Szg8vq70K2lyT/xZkXvfa +kW++E2M i5ZK9 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 when successfully grab a ref of a page, also rename it page_idle_get_folio(), then, use it to covert page_idle_bitmap_read()/write() functions. Signed-off-by: Kefeng Wang --- mm/page_idle.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/mm/page_idle.c b/mm/page_idle.c index bc08332a609c..4f248e500e08 100644 --- a/mm/page_idle.c +++ b/mm/page_idle.c @@ -31,19 +31,20 @@ * * 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 || !PageLRU(page) || !get_page_unless_zero(page)) return NULL; - if (unlikely(!PageLRU(page))) { - put_page(page); - page = NULL; + folio = page_folio(page); + if (unlikely(!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 +84,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 +114,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 +133,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 +159,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 +177,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 Tue Dec 27 12:27: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: 13082237 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 44663C4167B for ; Tue, 27 Dec 2022 12:11:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A707F8E0002; Tue, 27 Dec 2022 07:11:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A1FC78E0001; Tue, 27 Dec 2022 07:11:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E83E8E0002; Tue, 27 Dec 2022 07:11:39 -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 7B4138E0001 for ; Tue, 27 Dec 2022 07:11:39 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 53A8A140ACA for ; Tue, 27 Dec 2022 12:11:39 +0000 (UTC) X-FDA: 80287971918.28.4DB7AED Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf08.hostedemail.com (Postfix) with ESMTP id 08385160012 for ; Tue, 27 Dec 2022 12:11:36 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.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=1672143097; 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=2fkuctlSodU7Cmk622giu9MrtFu7Rzzp2rLbn7arjxU=; b=leec6MlSmhALeIFPwkUIm7CWVlRrGTfAT0yYqG4rs5E8Hp53bkeWovDQVTR4gYBVoRMJiP BaBQecq9aEfgycdxvldn0fiuNhs8pCuIiBqvl3EhJfCwqjruY/9OixuMxewV48UL437zTq cm7InwOX1V/IAF3pKY9w0l9stYySXGw= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.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=1672143097; a=rsa-sha256; cv=none; b=1JxVTbz0tuSbDN3MCIv9jt1AgLw079wAsg2RaTBKF6DdkTkRaG1yyr1B4NXvVzBZlhB6hH hMI1tmz8XN3udTsDbmS/y+5g8bSiwBpSY/PwoM/u09UEf4oxpZegO9MxAw5gC+lylW5q0l yKKCKT+F9/49n1vS/m2eeQPPix20v8Y= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NhD1T6H1GzJpTG; Tue, 27 Dec 2022 20:07:41 +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; Tue, 27 Dec 2022 20:11:33 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v2 2/7] mm: damon: introduce damon_get_folio() Date: Tue, 27 Dec 2022 20:27:09 +0800 Message-ID: <20221227122714.161224-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221227122714.161224-1-wangkefeng.wang@huawei.com> References: <20221227122714.161224-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 dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 08385160012 X-Stat-Signature: q3mksppzec9bcyxn8wpftt6gqojjehaf X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1672143096-431327 X-HE-Meta: U2FsdGVkX1/dT6Nt45SO+TM/Bb4FuSOXiOl0S+qvmKWYx7KbQEVvYB7MBa5w7tKXg7vNOVkK80VeGdnYaipTRBiAMDOtneipyIBmC2AXlLWdDzOdIh7jbH0L4reXfhc3ArwimBHXPaHeiu2tuyPjbOdKGco7J2hTus+JztQFoeGPcwLM4n4UKrrXMXc0xL4yw95ttidBm6/9cd6M9dXc3ZD9DX2084+CGdhGlSJnZKlxzk6GpXdglWKy1N4vCYBS8HBfp8v4+jB+ZdbPR8o8JboYZwItvbv67YKezGIbLcIaf1cNnYlRPZRhR2hcMBUM0s8mgIAOu6gyqBLtvMd4LTsI1q7p/YvpoNCEf8oya5GxGfHlSPZKmx7sWMGohOa2trmJwSjlNZgRm6LiY2lV0UF5Yv2s9f0NOrWyz/oNONTsbiJTwOEsjKbHw9NkV4BF1NqGmmu9fKNui8zP+/1Ac2gokC7buNGPQwjI1xbEWf4bjmk4qhugN2bHndw6bS0MTTKZGWr3wjsJrQzoGJSO/Q4bV0dTLSEwOgpvlFLCU7ar/bCw8b7ZY4nkgLPtAzejL+fohEf6IO41lqM1hxcJ++g0c3Uq0uFJ/UgFgxl2g5l2We0PcSZ74YkcjPEiKUy1GqKu+83Y519BhPCdSQkA42wJlWFhWzlmHl2ULfF4WIj36Yda9JTd26ESuUOckfgo1wwEtybICkTZVi69Op0E3fhEZuotUOlAX9m2VKRT6SQEWUSFAKgD+4Y+KKUCxsZnNCPvt23JQ3JA6K6HIZ4e9NoYJ5ZpSyh1ZDMuUVvnN9Ao4E9Ly+J/ZC1DUYwl6bpbnRGQnrI4C3NSzlICfCRMXpZ2WQ5i58Ahfs/nIoFg6QnFHj9vyWTWYhctIRVV3hr0HTT/tbP+dBHaPe37n1Bm1EQ/SclO9Y6s33bokfZ6+IFRYV0yl6ta4o/puPEdrK+AHTGrtPfxtFGa8+O7feQ d/CNE45H IRDTx 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 function to use folios, and it will be droped once the conversion is completed. Signed-off-by: Kefeng Wang --- mm/damon/ops-common.c | 14 ++++++++------ mm/damon/ops-common.h | 8 +++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c index 75409601f934..ff38a19aa92e 100644 --- a/mm/damon/ops-common.c +++ b/mm/damon/ops-common.c @@ -16,21 +16,23 @@ * 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)) return NULL; - if (unlikely(!PageLRU(page))) { - put_page(page); - page = NULL; + folio = page_folio(page); + if (unlikely(!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..4ee607813981 100644 --- a/mm/damon/ops-common.h +++ b/mm/damon/ops-common.h @@ -7,7 +7,13 @@ #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); + + 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 Tue Dec 27 12:27: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: 13082241 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 2991BC4167B for ; Tue, 27 Dec 2022 12:11:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 064E38E0008; Tue, 27 Dec 2022 07:11:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE2C68E0001; Tue, 27 Dec 2022 07:11:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC4948E0001; Tue, 27 Dec 2022 07:11:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AB8B38E0001 for ; Tue, 27 Dec 2022 07:11:40 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7C5591A0B71 for ; Tue, 27 Dec 2022 12:11:40 +0000 (UTC) X-FDA: 80287971960.15.95E45B0 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf23.hostedemail.com (Postfix) with ESMTP id 5EA6014001B for ; Tue, 27 Dec 2022 12:11:37 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf23.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=1672143098; 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=BvRApFrxUou7yFmT29Osoh4XT6UKw4ree4Ce/blGx9A=; b=4gegcgLqJLY/0ksqmOsBxkeOtFs476x0q5MicgXupVM80rCVqzaX4vV6lz0hEGe2GZtbu9 XZanTzcprxbZwJ7jiJcWHwSZb/KaXolFl1hCkXrTczx+dL1j2PyaP9X0oy8sU/0dwKx0Z2 zGg9ZNzU09JD2SYo+oIbqeMUG0Ce++Y= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf23.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=1672143098; a=rsa-sha256; cv=none; b=0liM1l/etlGkAWZORbtWF8CFvPLjBhp031Tddrv9zXsfKehbHZO6NLYrz5xLl3pL7eD8Dm WLiI3NmV9Anm5Z/eGvWnEZckuyGTSnF42w0LkLcqroWWhmCK331sY3bZN7/VbJCDC1uOES Gt5+AzXmaDHp+94P2+Sg4VZ+4DwSp2o= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NhD1V2WZzzJpWM; Tue, 27 Dec 2022 20:07:42 +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; Tue, 27 Dec 2022 20:11:33 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v2 3/7] mm: damon: convert damon_ptep/pmdp_mkold() to use folios Date: Tue, 27 Dec 2022 20:27:10 +0800 Message-ID: <20221227122714.161224-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221227122714.161224-1-wangkefeng.wang@huawei.com> References: <20221227122714.161224-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 dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5EA6014001B X-Stat-Signature: h8jqwqfn8bxsy8dcpndyxeysr96p7see X-Rspam-User: X-HE-Tag: 1672143097-570975 X-HE-Meta: U2FsdGVkX18gZagskpHjxWgkzG3xVYwJ2MzqCItDYMXU6a/BZPnXEkUceI7sCFf9Um34SeYSc9psB9IJTudFwIXlvWUvHaadBNRuO0VXU2VTuGAgURbKhQX+Sjy6u3ptLK+ehsBubas1MbW6SUpZ+xYov2VrFUdZu6wFttRUzZ5Vy5Owo2O+xxlHbEgo5qZpqmtuPBawkVmHIs/JX2eAW1zSOgz6wBhZohDk1by5VOogGN+7OtxN36uSXquWlcEMsXx1KGi02G2XUT8kAAADvSFxgsfeNMfMzDa9lIyUiNhauANaW6iOrngWP2WykyhaKWNKJL26y953MO2sWhlovl52619r8kvlVcPHFxYLlb19UcyaAzQ705gXiOAZkM/Paf8aC7QZ+JSLEajUixOJM8epGEge++mbynHITqytgXvruEg7Gg94oelT/ZhTm+C1R3cFGFpljYwIvWYJ36yEStt2IiDOHdLdo6ZsQV7Lz6a9/my/ZRllrJgq4uBgATU9q9rJ/GzJxHIN+2dzPWoDJ8AtN0PtoOsSp1xq4QfUJWNPI5Cg8PIm8LLfo/NKgG97JvcE6tho55DxG+FKpcvn+D1nLjmWlJVRMG/u+4qkRoMQO/XlIhzwzib6C9RiaPOWHZYZZGvkzj2G5eMH2ziChzQv45UhqnmJvvEL+krRIK7I32iwWco87AMgKDDtbbWuKhThSArVTswZJjTNBqU3bX0nGAkIr0tV6YdLTfzFoZt9DdJRMt2cCDh4NWoXIsdS216UKSDWWASX24d+5OkUX6HU/SkD00qIxtMIx8+8fSH0IXRY0OANNxHPSjgphY4/l2Costz3TFBc0vs60u3CcISbwrDpXA3rSmO8o2Vag5lY3cdsxtAAvF8C5ArJmXgwJnlbhE36yZaWIO3Ak1qb97FI3gZnkUF3BRtlQeY1tEd4YVavB35394I4K4VdBb8pB7h8fYxXSHqSCe0yAng 3NdpSoZQ b2tGvgaQgVoACfv0= 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 ff38a19aa92e..6f9ac8750ca6 100644 --- a/mm/damon/ops-common.c +++ b/mm/damon/ops-common.c @@ -38,9 +38,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)) { @@ -54,19 +54,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)) { @@ -80,10 +80,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 Tue Dec 27 12:27: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: 13082242 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 7EB37C4332F for ; Tue, 27 Dec 2022 12:11:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E2C18E0009; Tue, 27 Dec 2022 07:11:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 42EAB8E0001; Tue, 27 Dec 2022 07:11:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 081A88E0009; Tue, 27 Dec 2022 07:11:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id DF8B98E0006 for ; Tue, 27 Dec 2022 07:11:40 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B68F3AB0A4 for ; Tue, 27 Dec 2022 12:11:40 +0000 (UTC) X-FDA: 80287971960.12.D54193B Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf18.hostedemail.com (Postfix) with ESMTP id 55FF61C0008 for ; Tue, 27 Dec 2022 12:11:37 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; spf=pass (imf18.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=1672143099; 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=BKedCFIcZJbnFJGoZRc65JoI0iXStmrLhVHYAPBp4oE=; b=hvPM5DG9Q3D7gAs59w+uFzuLG/YoZgCNWMZenL6vZkLHI0aLBMSgok7PSIHz43Q02c9njK kDHI0jjKl7Ft2/Gx1zyAgYtkgPEx2V73fADSpnJ3UEWup6S2ftPZsZQExoWKJWIyeAS6Cz gtJSVjBqPmA93hYGkLBDtYb3h6UORsE= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; spf=pass (imf18.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=1672143099; a=rsa-sha256; cv=none; b=WirxE2oN614/RaIsanlNogck/8YQmJgiFGonAxis0XxZPIGOSnaBq+Jxa6JpLPAfSsKA5O JOt3SuX/uGmGInO83LArG4zk2/6wpm6XUHTDGNzrB/VmPNjrSuts21EvCIbAZd7uo5wRq6 jsDpYVXGkK4HrRE4n7ZYOpOS+BU4oMY= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NhD0l4NwnzkWs9; Tue, 27 Dec 2022 20:07:03 +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; Tue, 27 Dec 2022 20:11:34 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v2 4/7] mm: damon: paddr: convert damon_pa_*() to use folios Date: Tue, 27 Dec 2022 20:27:11 +0800 Message-ID: <20221227122714.161224-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221227122714.161224-1-wangkefeng.wang@huawei.com> References: <20221227122714.161224-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 dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Stat-Signature: dhndpxepzqaitbmhuncqqnjtc8kgkgrr X-Rspam-User: X-Rspamd-Queue-Id: 55FF61C0008 X-Rspamd-Server: rspam06 X-HE-Tag: 1672143097-506101 X-HE-Meta: U2FsdGVkX1+HyFeyEm/LYUrQFPSbTbQ1a1By5iOb4zIk0k/UTutW6wY34MZHLsIEOhExWVBY8EeESaQj8GLRwytxf7RkSdUVii1dt3SuD7iPgD7Hbok2cVVzUnzwvM8VAdBpHLeDOUoXwmy3j89+rwdOaRuWcyV2BAJZvXst8OIns9z1pJDtAGpPGFV0MdTODwtUfjtFwB9GYUT4x4guu4yeh94A0i20qmz+ZplqhZsIKrDnJHrWepd6aU/y+NYJJ2+NiBf67nua7S7RqDi0crEsW3YA0i5/qEAnlRoXIYbKATx7WizX54lLty5w/c8wXNP9eBJwVS+jlt607fJ4jb+6ZuldcQ5O+EPXyksCzMowy/1y2vVqb5M5iWuO4vrDCT19sfoW1oUIgeqvI0oH+pkhFeV7BbREpWgCu7nefDGDiQvVOHt/wxQVSkV41h/fzyvZ6H/2/x4BJROB0jZUJ2RBQbdH2hoBiuI3iL71rWaI/xMbHZw1pXn4zEGTNQC1HNx28ObjFtKBe7mNrJLRqIyhT8TB1sILsPMXd1oOE5N6wTmAS2N2kU583Y/kce3qdulswoBKw/5Nmfwt/hEtuaRo39MS3dCDyKXWIj9K5hQEeID+DUqjPtfgXXsa5F/J9vkBfuavzrIt2fo8+KEM6VdngRU/lWsO3GhFzbEt7ZtlZwFb3JyMASDWldeq+82Q2qMcW3LijOvaGgdF5ldDkp49mWurqYkpBKMUkRrr0l99tNdJlC0qk2Tm1glHo/QoXSS7G6NvP30fLVC/g4xuGgO8cMF6e34HvKVnEazRw68pBh1pilanYttt4OGyBqWOSINImlpZnYbd1B55cgtmai0FE/FV79js21cn2Zn4M9k1yii8n59Gzqz5n9htnRb3XgNGv/u8NoVBcF9kJqjYcL+OxLuEp9HP+RSmym12WFWBVu2LOTx6JbCqhWyTkMdBssv5BiQoCJJ0BdZm3l0 uSgfIs03 x1KC+quARV6rRebQ= 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 --- mm/damon/paddr.c | 59 +++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 6334c99e5152..728a96c929fc 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); @@ -58,7 +56,6 @@ static void damon_pa_mkold(unsigned long paddr) if (need_lock) folio_unlock(folio); - out: folio_put(folio); } @@ -122,8 +119,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 +131,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 +198,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 +226,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 +240,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 +277,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 Tue Dec 27 12:27: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: 13082240 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 D0F28C4332F for ; Tue, 27 Dec 2022 12:11:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B63C58E0007; Tue, 27 Dec 2022 07:11:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B598D8E0006; Tue, 27 Dec 2022 07:11:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 937408E0007; Tue, 27 Dec 2022 07:11:40 -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 6CD868E0001 for ; Tue, 27 Dec 2022 07:11:40 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3273A160C35 for ; Tue, 27 Dec 2022 12:11:40 +0000 (UTC) X-FDA: 80287971960.19.1558BD3 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf27.hostedemail.com (Postfix) with ESMTP id 0503040005 for ; Tue, 27 Dec 2022 12:11:37 +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=1672143098; 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=pn6x1peu95eM99EW9bxz/oTV1ow9bUqQ1d0bXFzYDlRvhKkwFIowVoxu6pDcTgnwobjFf4 8L047j5j08mI4wez+xY244GQ+pmlyTR9rWiktQTK0im52lyvULfRNjmA7kU0ksqS0VeNSc AvVY0pAFeKpsXgBQAmXYHSk87zet2uw= 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=1672143098; a=rsa-sha256; cv=none; b=vnC4v2wgSwvAwA9Ja86y8qRyEWlMPEeQZamICE1MiII5CE9fhc609+HtKiwxYj12fUl8bS JwcRqMxPENkR/tC2WV6CZAQDf05My/CeChbSdImsVrAjyhpgHulUG9hhbcFYjpjxcQE2fk 83JNl45OVfJrpv6YTHGbXEJI7CH/6I4= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NhD0m0Xr6zkWty; Tue, 27 Dec 2022 20:07:04 +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; Tue, 27 Dec 2022 20:11:34 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v2 5/7] mm: damon: vaddr: convert damon_young_pmd_entry() to use folio Date: Tue, 27 Dec 2022 20:27:12 +0800 Message-ID: <20221227122714.161224-6-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221227122714.161224-1-wangkefeng.wang@huawei.com> References: <20221227122714.161224-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 dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 0503040005 X-Stat-Signature: m8tk6aejmej71dut6n6zhnmzztoqhrsx X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1672143097-674146 X-HE-Meta: U2FsdGVkX18mmyv8Aqebo2G5g3+BHMaxXIzzCLG3QAIGR01h0k/qh/lawF9EC1sYNHueB3uzxcDcylsSHItaYiwn7NVqqyD3S10b+RPBuVRijHIf2GGoWpP9+iomA6n120un+G0cHHB/fLJ3MnZwCk6T3iw8dDUpiL2KYlb8qmzltrQFv7RUqvULmBt7dYs6S7PcGdT9bUhU/HujnF/joCs4kMiCudPNlI9uj8gdAWDkqKj3TFqd5ufmYI7aVpdWVSVbKxXr0TzVUA+YP9THbMvDTbFM+lkkKGdejoQ7oS4a2/VKklS9muVfK8oLz2GjHFoflzROaCk2r1cTYMcCI1eqnXW0tJgV1WrjEn74uMrM+G0Hn4R7eJMju7FO3zaDOJMNf5UsxfBoDkH+6qwGuhlrZ8gvEXlGbTON8LY52UVlmv4+yrZ17XnGzXWUIVDOepqpsBW7OlSxta/bAwxjXgMuKAXFW7eM8E1QGtGV0vYMyGzWFoQXCEcojpmhFp8ooFP/XgDcgxbWrpue6Ji9V0ZjqPKO3pl3FfLn5+uISPowP4Z1xVfVyDI71Mqzr9IJNY2AuoYG+IW7aHUdSKcsZZeODcs35CBX+FLEWg9UgBKU15Uooy/HDy6GqNpmNRJk446GJIb5w9pwjQg8DFr6l1vFmZ/Jo5FW06Qwx2zprOMvXCnNi4d/1A6l6opToxIoVsRkjnxX9ACAFuIdCLIBrLMYNtkAA0DGYwPQjndWPVyQ6YkmOqdEcW1oPaM4I5KjjhQwwK4BZEwgySxmtPGzKmaHDYgHwycRlQznIGBH6yaedRVVTl25uhTCF+Ulp1sB5aS7AikUqGFP8TdAAHJSPlOUHEGQf3sg/25W+GVsIPNunw7NVAOn6l8AkOAeOAXpceGzriKpVyD4QbmVivLae1/iuW3z4e5gvRcJEHFln1AlqxVtpiRLVEoYWslgD+Rub6NOXRdsNW7r2cCFGh7 AlXDLsA0 pqnfNxz3RlY3IqXE= 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 Tue Dec 27 12:27: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: 13082243 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 C1A2EC4167B for ; Tue, 27 Dec 2022 12:11:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B11D8E000A; Tue, 27 Dec 2022 07:11:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 936E18E0006; Tue, 27 Dec 2022 07:11:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6506F8E000A; Tue, 27 Dec 2022 07:11:41 -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 5027E8E0006 for ; Tue, 27 Dec 2022 07:11:41 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 195E0120B64 for ; Tue, 27 Dec 2022 12:11:41 +0000 (UTC) X-FDA: 80287972002.11.1F4C307 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf28.hostedemail.com (Postfix) with ESMTP id E45C1C000A for ; Tue, 27 Dec 2022 12:11:38 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.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=1672143099; 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=SRYm3oBZTHbr/0gRDa1SyKolajHIbe9xvVjo3qwbJPM=; b=MVlmERycN091rHxIx7KPXqQsqlb1ZVr4MUULFW+l3SBpyUNLUBnJDo6S0G7J62QfErzOw1 0uYEDBQbY67Qy84xmpRc4Z56MBZKwXDU65ZG2bB0WBdUNMSmhleKh+lvOGRm6NAl9Osym7 8V+QN9JZgPc2NbAD97uUGOrV4O5Ndoo= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.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=1672143099; a=rsa-sha256; cv=none; b=x6WTd41YhkW46jHnBoTVgZ3mADJY374n1MR7n1X5+JBj46UmvcBBLgXH2aupUz3Nypv1dz jJgyOOE0pyDAvAy63ll3zBwRq1WZKNttFp44DjIdU2Rz7gsvMnebtNX7T0QCtfzGpFesnV BICdGtbvojR4RVt1cR/kszRpNLdDQyA= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NhD4k1BQbzJqfG; Tue, 27 Dec 2022 20:10:30 +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; Tue, 27 Dec 2022 20:11:35 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v2 6/7] mm: damon: remove unneed damon_get_page() Date: Tue, 27 Dec 2022 20:27:13 +0800 Message-ID: <20221227122714.161224-7-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221227122714.161224-1-wangkefeng.wang@huawei.com> References: <20221227122714.161224-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 dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: E45C1C000A X-Stat-Signature: mdy1rw8d4ty7fhy6pr9ios1up8fsxmpq X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1672143098-411060 X-HE-Meta: U2FsdGVkX1/EAu5BWXoRLhgddgcbBF3ABqG6Aiw5/ymssP/GCZA9KUQqlT40CNrxWqckI81mvKO1KKmcrMRxZuvG7FLMn4rGL8kOmYd3Xs5vPoNlASC4fvQYDOeJtwhUH1MfRAt1Ugg8xh7gaX4YaBEc+e1WdLiQ79026yoXQPZRJ5zPNtu7KctRUX4sLZ7STRc8N6qkXxSClzhtQ8ykf/TOh6KTepWTlj3cKhXmVik7mlcqJ3bsJ+93MNtP1SeDE7OLFhRjxxsbc7ELrlkvTA8UcbFYFr778Ge9ZBtV5QEuTGRh4hPSvL5udBssFuD3Ft9QCqYusJnOVeNNgYRIRQcHXuHQDOkG2e6qvZB2SxBbdwppK7WBlwKSPaQXpaQJPfEALbwh7GZBmOmxIyD24NDKTsBKHOeUVb+8WKf38GwRd49svnwzrb3fjk5IuLjiGPotUYFA/KSV2LFXiUnplFk7Vh+FQ0xxbHAxiMvzMP8WpHpwp6jrnsen9fyo+xmoF/EAyOnhrbswomgyR5TlzMfYcP1kE5LX8IA5AeobQNQ3yLATDNYOHWjDJiV8h/DbtnhQqZ/oxXbq+36TMaFzBu9wk66OOPLTquplpqP4R0tyzgZARQf4L3QcCnt1Axf2z1TQujmiy7K9j7kqiLqDuTU0QkTIowyb5Y8a8klzhjve2j/1EtTQ8rTk0OD/FwlUt1kmj12w8LbOdhx+YG5cIEFUJmBXicsigRDn5ktOiYfndOJNb2BpuylHMT4iggj02/O34d+tUc5N8VENRhQNVdbaQewyWaryKwXP2XM14Kt2RtYFmeCDEIDGeoqr+TMbF1zbbZTBh8IdEPwB6xEeshSTMG5NeJP9ebIwHf3ISIYrmD+yDmIBnBsDsqZse4Sn2KksLFoYoUK/nftAliDqV1nwkYzr6Bntt/KkbznIClfJtWS50ABm6lf38dRrTnTAZgnY0Dl8UCqXc6WYRI7 11q1qoaV kU5PU45MJnX1fbz4= 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 --- mm/damon/ops-common.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mm/damon/ops-common.h b/mm/damon/ops-common.h index 4ee607813981..14f4bc69f29b 100644 --- a/mm/damon/ops-common.h +++ b/mm/damon/ops-common.h @@ -8,12 +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); - - 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 Tue Dec 27 12:27:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13082244 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 0554BC4332F for ; Tue, 27 Dec 2022 12:11:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DCDBC8E0006; Tue, 27 Dec 2022 07:11:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D7CC88E0001; Tue, 27 Dec 2022 07:11:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C40FA8E000B; Tue, 27 Dec 2022 07:11:41 -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 8F3F38E0001 for ; Tue, 27 Dec 2022 07:11:41 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 643CCC0891 for ; Tue, 27 Dec 2022 12:11:41 +0000 (UTC) X-FDA: 80287972002.09.D2F2239 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf17.hostedemail.com (Postfix) with ESMTP id 510BE40016 for ; Tue, 27 Dec 2022 12:11:38 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.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=1672143099; 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=2Hha6BF5eaECystHYybSDrPD2w7OobzAQcsMGALn7sNbRKiTRt50iKzm6E7L4Q5nupttw+ ky5O1TvZkqHRCsb5XKkPRBJXPphlKrEEgUQep5RvDlLC6dc6QxGxv7DysBbmHab/Xlpzg3 k7kHKtXivJBs6xiKgg5bk0eH2cn7LUg= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.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=1672143099; a=rsa-sha256; cv=none; b=V67ac9XHXG8JYAv5P/uytMR0l7dH0NgpIouOEYdAA6Y20d8iFblD4o1lHZpPv6VJNdCQUk AGoXk3Qe0J1JPpGqYFAhPgnHcCSMUg+H18+Z/sB3gvFd94eE/mHkqcAh2NJ7l46oA0gmL9 RbqPlRBdx6lv1M+/sLxeZAtEPXcc2uc= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NhD0m722MzkWv6; Tue, 27 Dec 2022 20:07:04 +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; Tue, 27 Dec 2022 20:11:35 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v2 7/7] mm: damon: vaddr: convert hugetlb related function to use folios Date: Tue, 27 Dec 2022 20:27:14 +0800 Message-ID: <20221227122714.161224-8-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221227122714.161224-1-wangkefeng.wang@huawei.com> References: <20221227122714.161224-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 dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 510BE40016 X-Stat-Signature: nqcrtnigkokwsh7psk3sq8t1buep4m3u X-Rspam-User: X-HE-Tag: 1672143098-401267 X-HE-Meta: U2FsdGVkX1+pttqIUaNQMVipu+ilo/r68WqZtRt5RLiOgUIU4QGa39AKPEMoAkwpDWV5xD1GdkLSY/NCJKX4HTNmvCGnxBtaMXcKp5DHSEhIHsSdVYwlDVQQQGLet01Uhjhs4ZnLfmq2io0cmHcs4QXi5eFTTlLCUEoi5JG8gVpB465oprsmGVWpDmGZo0SyY4dZh4fzlpiFWfCjsrGFAfg5ktujqLoKCvNBiDxB6psyJ4Sgg9zZA36Y8oiyXmWxMeiV2+I0lqJ6taLXnkgagIGB164jS3uHmRkKl5+bn2DlhGgO+G1/GenHnv3lTgjzt2HvuHQRlDPMltBr4D0V0OOpEZ56XzUKVSiR8q+hvjPNc3CJ68GrLkRymdNMBaDnU6bLjHZQ2Cek41hpaa1h/WEar7U2a6pg6+xPqCV6X5Gfigt5+o+b3Oe5OeQr7SfhbLJAQCkjmmmNS3h+/OO/ThEpHfR2cKH8H1CUWe2Cfe5elVcgmpynv+GMN3fRUts0yDuI66L3b9i7PbJhbjcyEjS6i39lwv228Drtvt33WbarmllZOZnJ2/pu0lE8zNT4SDCvSnA0qDsI9kjcPgyH93bOB1Opzawe0/7psH0yJkZIp+6s5y/GEcsEQwAgJMOWfWt/9C81at7ZpyDKhF2Rcm5Hw91T+09NpcX4Nb9K8gpLLtAFKjQm+TYwy1MX/UFfo6axDW1VTJgiygWVQVQY2GpGhQKSG1EkDSTrNcvN0IZjh5YuyzsQD1ax/Klx46LCCeogcvBkdp1rKSjyM+poDYznBjHybyHKdT+dAzihdszFzGXfxw3t3w7D1PpYfI3ZQpwRpjogxN8cA7+ohSsGTTz6+VteB1U8tQP6kxC2ihUqExS0hW55PTSXBEzHFSclBs5iEWC8tzFlZdujn1YgLsvVyQskteEwzNklYhkY1OZNkx6ZlIv/jg== 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 --- 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);