From patchwork Wed Dec 28 11:34: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: 13082861 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 AE650C4332F for ; Wed, 28 Dec 2022 11:18:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A44358E0006; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 992438E000A; 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 750938E0006; Wed, 28 Dec 2022 06:18:32 -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 4A57F8E0001 for ; Wed, 28 Dec 2022 06:18:32 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 19BD81402EF for ; Wed, 28 Dec 2022 11:18:32 +0000 (UTC) X-FDA: 80291466864.27.F4670BB Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf27.hostedemail.com (Postfix) with ESMTP id EEB4240005 for ; Wed, 28 Dec 2022 11:18:29 +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=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=tta+7/oGBxKDm73NTZEGvNoLjVSrzGThVYa6iqTnTLU=; b=qSxV0peRaaK7MPJRiiHCkf7vb8XU8QSo9JenLjsogtS+99Rbk69MzcB++CAw1CD9ObxnQ/ FNTZRGntGWN2DlO8aP0uROqreGP7jyT9VIw9LwI7gv+0HDr6PKZLcAcPtyo2ap1QyBR1NV 2ikJbLPyuoIWkh7KWgTSee5k/wXTs08= 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=1672226310; a=rsa-sha256; cv=none; b=CXw0TfthJb46dSgerNHuhraXGY81rYLNDcRevN+QI719KK6o7cMhCpgHqOWnggq2bGY3gD TAT5J4qdaohLGT47D5k6IrlLjh6MDZMcjDOE2RFSsN/64cEnIVj+7Zkx8iaFquIoamV//T bvXmJq9oC7qZFDnWUtfyjBHCoviedBc= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Nhprj4QNnzmWqT; Wed, 28 Dec 2022 19:17:09 +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:26 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v3 7/7] mm/damon/vaddr: convert hugetlb related function to use folios Date: Wed, 28 Dec 2022 19:34:13 +0800 Message-ID: <20221228113413.10329-8-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: rspam04 X-Rspamd-Queue-Id: EEB4240005 X-Stat-Signature: ro9tti9x49mo5o88znzjxf43bcms18f8 X-HE-Tag: 1672226309-364713 X-HE-Meta: U2FsdGVkX18XqbgMiKToQyVEi1RXoUoK/HCRtZcQVOzs93yAAuyLH+ZDR790BUVCYlWAFnlwQWTwKffwheTNtNjL/7eNjAGbUl0z3/654Vks9G+N+ecGjI281lMPFxB0LYHyqUjAseV9Zjl8W8cLnOx2jGbmM5Se8FkS+p5dESrd2HAhqVL2Szepo4DAWCKdB9BmX9aAP5+R4tSA6+Ov1ZCAN0JVHnrNpMVuw6L1kGHg4mLiIjzvtyNorsmoykEtAMbmhOVCQM3DeGSskcsXZQdEDUtE22UCKvj6MkVsdR3vWU2LkMmjFLNtK4RT9IbqnnqNu96i0t9AlbxIM5Ty+BQzXyR5HT0WlLzcQBwQg0uS4KNn8F6k8dq7HngUJkbIPz5dwyYnYqIRGfuCbC3UeJa0lUbVCZJGBl1NKIV+zb6Jhth0LG2wCPbwiHq9xND9YIrYPhp029/7rC3Dt0ELpv+OUpNCQ8SQMU7z9RZduJtWX7MHzLs/f0q5herEqCCymcN8avhbRqdFAbJKlz1S9qM78jIzK5x4brOyQJ/nTD8fAxaf0F3eiaK1MQno5BfwczU83WH0kuJvMqrBuPYKmfSX0WS0BtL9KecYmprO9rIkYnSgGrlpaazdvO4tpmoP1MyWWoLiU4RMWJYx6rmFODgBaR+grSG+RK2cjfVRtKnwWBLLd4UnYMaAeSTuE1LeE7h9/by/SMTADvTGbxYKb0SOViXWcsp/T1dQCNEZCw0xMXH9kKUzWxPAGpksrruAPWZPAqwEgYWpGw2UubblzG1wurQ7HzXPwHBHu0p+LVlX/TaxP6IMTPuKFNcmL6R3Ur/YT3dNCOKx3Ldzs+xUq0nJsS1nl0n4ruzndM66Y8Sr3Cr3NZJoExGRYfIC9APIKyJEAeIFux0TZj9kqKNmoAFDjNb1oLsKaN0iSnjjIxJ1awhMPll2gw== 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 Reviewed-by: SeongJae Park --- 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);