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