From patchwork Fri Dec 30 07:08:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13084131 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 0E60AC3DA7C for ; Fri, 30 Dec 2022 06:53:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 809198E0005; Fri, 30 Dec 2022 01:53:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 790AC8E0001; Fri, 30 Dec 2022 01:53:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 632368E0003; Fri, 30 Dec 2022 01:53:10 -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 531E58E0001 for ; Fri, 30 Dec 2022 01:53:10 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1BAB780516 for ; Fri, 30 Dec 2022 06:53:10 +0000 (UTC) X-FDA: 80298055740.21.6576BC1 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf10.hostedemail.com (Postfix) with ESMTP id F2038C0004 for ; Fri, 30 Dec 2022 06:53:07 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf10.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=1672383188; 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=Vb0zaefvbfLK4A9norVrKs2w+Zvbed9ZpF7wKUoOSDc=; b=e4b2+2rm2L3XciLkqJ+MxUSYMbg19pq9NlaQtJ1GsxJxW5qY6J/w70mwc75vQBIy03Rm7r JwLjgoo1y6iNSlBwJ+3zAw28DmP2kyTNKUqEeixYKeG5gFNFh9rqCmCx/QoKQhGpTRXteJ f+cD5I8HJz/qB/2FsEzGMXl9JZOUJOc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf10.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=1672383188; a=rsa-sha256; cv=none; b=RiPkAbTmCKJ429Xvh9amJbayMGwmkgZ/W2o7RyzNar8pg3OR0TkALCGdbLUgW0KHu0jByt NOg7uLCGtStVQFHmxAqOg9dw9/SGDGEOU4FabnkSMiGx/5gLHiIV/0Dac2k1/BAlHoH41f Yx+z5Cez1Cj/vwGa4DMFSTGN/ZTc1Ik= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NjwsS1PtjzRqPf; Fri, 30 Dec 2022 14:51:40 +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; Fri, 30 Dec 2022 14:53:04 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v4 4/8] mm/damon: convert damon_ptep/pmdp_mkold() to use a folio Date: Fri, 30 Dec 2022 15:08:45 +0800 Message-ID: <20221230070849.63358-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221230070849.63358-1-wangkefeng.wang@huawei.com> References: <20221230070849.63358-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: F2038C0004 X-Stat-Signature: ytxitkxprhqjccmwuc3iu9ked5nruihj X-HE-Tag: 1672383187-954769 X-HE-Meta: U2FsdGVkX1/sR9CaUxM3OQ44Ay9l5rfCtra4wprypvEBvgK8NCHkcNfCkqHBkIMtnfnndzZ8AZGNy2E8lFEemdSDP/RHzHf5+c1P2hu5MUWsk5HtYK6OE2XsvYuKU9SNmUWl/kYqzl4GvR3iw0goLUeX7npXEirLW8/w9YXdGmOv+Il6FCmtgyRjo3K+0Y7kznMfsFDlsi1FYkTr/HRKUMl5N+8zY5W2gMKmbnG/WOOV7qKSW+XNKQ3Gm7F/CSVf0j45ouZ9xcTGwanALxM1WFDOreBA/HhWwaxV2+DjgJED17nZmWlNhy/6KRADD529Ox6QhQCRPC05PaQ9LKYZVg3LbfYBcRHXKgQwqKxfvYlruB6YL54pRn49A1G/6IgpEqJnsSQHU+qVAAl4Qz2O/hoCg+hUoZ4E7RwC+wwn46MFPYBMUY2lCRS7EY5xtr9ylnrYb1FTNLp4ecqI6oyvzd16ltLlWcXGZGO3THKUU+pAbL4BZ1TC5a+Vu4gVzgN8wDJhEBHBmh+F0UlcxwVJD8+1t6X0qYButb9Wrst8QKCBp45jFS9G4NP40H2u6Tkk5l7CrAb8Ie/bTamzaz4MGA3eBAnk2SXjYmNcQMtuwZP2X8LTkrvveQ4EieobABvdlV7yGWtJ3pyGCYvWN1Ln6KHDNSdSwKTny8jr9F7S37ZQ2LeEJYyVBKD827IwYA5i2N2xt7BHaQdb7nD9KKxFO2GzO7LpZMvs4H7TFDzc/zQd9sSgroVm7rf56bsdRagogSifE87MJaNwzdqbbq/VJGH05bimbV49VC4N5ahQpQOAaqXSne4fqIT8cNYmM93b+LxDYo9zc0s08XooSdGD0GadcEaTnvtH45y82ioPlJ6E5gtd8uUkztzti0YlIkkHO5zzNwiWUNZpirR5uamuPJOgOiKKSGSWC7K8x4CzoWuw6SoV/zbdQTjzV4qkAVR1wE54Q/K0RELcqTL4su/ nf646FBF 4eglv 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 a folio. Reviewed-by: SeongJae Park 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 */ }