From patchwork Fri Dec 30 07:08:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13084132 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 1C24FC4332F for ; Fri, 30 Dec 2022 06:53:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C9C4C8E0001; Fri, 30 Dec 2022 01:53:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C4B398E0003; 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 AEC398E0001; Fri, 30 Dec 2022 01:53:10 -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 7D17D8E0003 for ; Fri, 30 Dec 2022 01:53:10 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4E9AF140281 for ; Fri, 30 Dec 2022 06:53:10 +0000 (UTC) X-FDA: 80298055740.19.9DC827A Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf29.hostedemail.com (Postfix) with ESMTP id 407D3120002 for ; Fri, 30 Dec 2022 06:53:07 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf29.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=yqxiBDVC+BCWFKGtm3LDCpfc9k4s2e0GuMa/SOb0qGU=; b=cPeXq2nR153npBKgrHMbDIeV0a5kOU+0IwrzCRqFh9XR3RmiPhVO2UH2eYiJOfIo6mgJeU RtK0yeHmQapIEUJnjxAOE5dAoZWdvtj7PutmCl/Mmk/85RXRAJrk0pQI2Tbb1sGXum1cOA lGfUPyes5cdg4Lct1+7mGKne5fwhMQY= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf29.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=v8ymcAzRBd1v8yolOHMJYMMAoIIYYiN46+pIVWwmW+cEEv8RH3pGAoda5HYx/+gdv5RZY/ d/eW6q8jKwc/4fOY4Cd9ny5NScOcPIuCpTDpfBz8d5tuFR7X4GZrE15x/P95lyVXn85rq3 WhwrSlYjbgy3P9FvKKhtzelcIhMThWc= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NjwsT0wpTzRqP7; Fri, 30 Dec 2022 14:51: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; Fri, 30 Dec 2022 14:53:04 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v4 6/8] mm/damon/vaddr: convert damon_young_pmd_entry() to use a folio Date: Fri, 30 Dec 2022 15:08:47 +0800 Message-ID: <20221230070849.63358-7-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-Rspamd-Queue-Id: 407D3120002 X-Stat-Signature: kxmnbepk87uzqkpgt1crm4qikwmriqxr X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1672383187-892220 X-HE-Meta: U2FsdGVkX18r8D9tE/oNuSURL3BG1ZLyeRQERhh+toHC7PQQRhP1b3R03p+/HHWevltjRIrvSEgjImkrYsa0+WfLvIVTINv9W+p//ewgmKMVNBX3kXJYTA8GLuLv+EDBad9E1JYhJ2bQ5hJAmBzr1RdYBBfB7u0qKepw/sXcKfhFpPy3D/IBZ0ss5SEPMb/iEq5lmnoaX08TemQO11n0UGVWVoEPfrpnUXvYeq5VRfUHyzTJ7EXb+2eG1b4pka3ifWAv4szDcruk6DHDmUSUkfc03t1kkdH3zBI7ofB9Bn7yaHAVfmAayaxld/NuaLTpdbD9LL7UukRkwpNM3Qi00GJDYmVipm5vgj4giw1Z8luAV9oHsQzAzrqdnrs/jjHLBABmsPrETFxqgOATBExkhwCmjU5UHWD9f1Xwuay61HilA2t2cuMb+0FLY6phT9c2ndmfI+aQSSwO5xFBIckC36MHrq48Xl1yopU3DCNiShATY1G0qf+L68LEOn+y05vTZkSAek1WKJwdoc5NkN6F/SiYUp9hkB0M21/FdoKQQMImwRISu1IcXPBl7TqWKHHclXFWQGX/ATBt65Z2B/4NSWA+cZWvw/CmgYpucXlIIGWdVvzaNOtbkDoz3tKsRk1jTqCZwqe0QT5v635afwrm7IkjV5WJRsLrZMwRZMn9IUmrEbIE7aj2frzJ2mL/OCLbH/ZiJ8gqjTZcXdVE2hIMY6kwREz+l1wn3ACBIWm9Cs+4u7kbUkAP2c1NYRgOHynIy8N3XzAMtWtsnJVgwXle7CbyaGHpxOg8Ovtx1xmO6G/mXw3HaI1PO7gwCODUGVJXRS8P3X0CY61e3T2aQ57TUeTHCK3p+6VQKZDbDWT4Xv5xbV1Qn69a8ujtUS9RfPLp8iX08rthXNDTG9fvAol5FB0U2RBMl26f00AAfA0s5TKLfrfZW/Oni4KZwqUUzGSab+qhUAxMpcps6JW4HBM MOnXM1ba yQ3GL7bKGHLrHHFo= 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 a folio. Reviewed-by: SeongJae Park 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;