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 */ }