From patchwork Tue Apr 2 20:12:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 13614573 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 67FA3CD1292 for ; Tue, 2 Apr 2024 20:13:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F36726B0092; Tue, 2 Apr 2024 16:13:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E95A66B0093; Tue, 2 Apr 2024 16:13:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D37DE6B0095; Tue, 2 Apr 2024 16:13:01 -0400 (EDT) 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 B54006B0092 for ; Tue, 2 Apr 2024 16:13:01 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 819321605B1 for ; Tue, 2 Apr 2024 20:13:01 +0000 (UTC) X-FDA: 81965690562.30.EF366A1 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP id E3E0E1C001B for ; Tue, 2 Apr 2024 20:12:59 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=KFSBRA+D; dmarc=none; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712088780; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aGWyUYT48YDE0Cw8D9rqi8Yjlewy6qzvPlzZEpe8jC4=; b=anI/05ZTwrXeAAgv8U8CA4i+AXylnAH3KUvmaXdz1nAI0NQr5O2i2zmghGonjWjHfPIAYD EEapuBSFZvbllrJ41isi3PWzv4QvKohSUEDvvaYPQsjSq91kAQPhOmfWkE4mzkixImA5wx c8zSM89pOO1Wj5w7f9o6faI3OajTenw= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=KFSBRA+D; dmarc=none; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712088780; a=rsa-sha256; cv=none; b=SrvAuCRRO0VJDSF8EQXUDbKNtb2KBefFY8zq4fLVgznCwS8XN+zqRpF2CM9JP48AoRLuO6 t51lzSkaelClfM/20IApwyyAI0GR73K4Pr4UGXVvGED2KhLtfKadDYfChEJLpaJ0pItcpA T9Co8vvU8jBMvGpkdg+yKKPwkAQUcBw= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=aGWyUYT48YDE0Cw8D9rqi8Yjlewy6qzvPlzZEpe8jC4=; b=KFSBRA+DOIo/e3gn0cB/MqI584 BZhGwMIi1Fbj5QSAzWFE/2KsMjLQ5og1aJBVTsZ+exboTHaAo6wcL9Ruh6gEK5K31iCrFiTLMX9Er uhLmtz2Ihs1MDcf1Gf+XiYBcmfWPGIHf1novrK+wJEI6fOyoE/9PDGH+uiXvulPrlwoM3wUcJdZie MHRZRvVjJmvrwLgGWA+OPJR+SHQE0buExlLRQKzpkxi4Sav2x/cm+qXKq6uCmCpwl+qe9SwzAFILY pX3qXCuCLd+voMTc/1bzLJKKMXdTgSgr6TCQ2ML0yyO9/IhgZc8R6FS0MYqhmSDPog9g0Vc93pH0b CQ4YJoEQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrkV5-00000003qe8-2Ulc; Tue, 02 Apr 2024 20:12:55 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 1/4] proc: Convert clear_refs_pte_range to use a folio Date: Tue, 2 Apr 2024 21:12:48 +0100 Message-ID: <20240402201252.917342-2-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240402201252.917342-1-willy@infradead.org> References: <20240402201252.917342-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E3E0E1C001B X-Stat-Signature: p9xhfrt9maymfbgbta6oxxbwgkzsahan X-HE-Tag: 1712088779-253873 X-HE-Meta: U2FsdGVkX1/u0J9t61abmUNIru0iUQWGs95hap+pYVHLc23nVv0LvBmz+Rij6cpH01l/+Q+O3HYpg58TOYOh9Hhnh1feU0HwgLrzvsFrPrOlZZILCmX8GB2Kk8+rW30A+92AVw8MOHbMAZuCNwc+3nD+2Qtv5wKYpvo4EjAwA7I8QlEpNBm3V6ALS8IpmWSD5Js37F2y1Ehwu2ucGx5eWbDMwLYIHK0DknPIMu1p7AwEiAEu/NEgDjrCF3Ly33hhD9P+XIdu8AGe8IZ4Z7IO+Ztg1M1TQZu3mJmIPzYTVrFQMATThO1dv4QtF+vT4Gh/fp5vX/dfenfmQSvS3XlcGkBb/2qEv2YCch6wN7hSlpRBHDUfA57gzxXZqqhFktiRxJofmd9c6Be8cZX0zzmU+PNAudJFw4VKPdN62okSxpSbLDiVmCbDoJV3wCBFiKsx4ZplBN5KjJyJI62TwLi1Kteq+iBI6dX/cyJ2lNV7+QSE5LZ7GMKLifo7oDyv4yI6dPDTss8GBYkycb/FuiLdQqCnli6WDi0JYPJ0p1V/3SilfhtBcbQiYVoYgpkAkq7U2x6KrTW8ALl9nkUSKrJYV8u015Os3YRJdxESZHwFDyuqXPfywxwnWKYhNvWtqOoKZiNDeHKTIHSWYSYTg3lB5bUpylyzMBtloKmRvDJWjL1pzdRFaaVRfT7Cc1YY0rS1NWvPiuN5QgherkgoWo98tO+6YgW03I5ldoM7bEO4j5FjaRtWLBhIknfoAnJTYQTKotx3n5x6htQGd6ke6iCfUDao9O4q7+TJNz4suETrqbcOQFGfE2VHQW3PQNQlQ+EqjLWaElxV3aOIyXPlBMtYroP25F9aeCbSbJi+vwPrxhf8WN31yK/fxeUnzTMMGv3tYeNFM+vmkNbE3iGqPW17w2+BF9NxlNEygK6FbgrKwJr1r6zjN6NH2/sT6lK61/5gNrQZlPJXU4D/SdMO9vB /1ITyGLS TugcaZ50xXNJCNEwO72VDqe+ncfEaXrHKM2lByi5NSfhfiIIiWS6wFKN5UQizkGmr1EDJH9rwvYJe3caXA5/GBjLUUysgkjFAXVMN/doV06BSocxmze3BhmWI4yQO512IPNGEXPunUx/wk6lHzkiNY8WkzFm7XcfypObp1Vko2bRbObEMeT4d1Ry4Bo5OvWTFIMxNH0MuJWRZx5BFTwm66l+Y0LOZY9JyYvZW 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: List-Subscribe: List-Unsubscribe: Replaces four calls to compound_head() with two. Signed-off-by: Matthew Wilcox (Oracle) --- fs/proc/task_mmu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 23fbab954c20..b94101cd2706 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1161,7 +1161,7 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, struct vm_area_struct *vma = walk->vma; pte_t *pte, ptent; spinlock_t *ptl; - struct page *page; + struct folio *folio; ptl = pmd_trans_huge_lock(pmd, vma); if (ptl) { @@ -1173,12 +1173,12 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, if (!pmd_present(*pmd)) goto out; - page = pmd_page(*pmd); + folio = pmd_folio(*pmd); /* Clear accessed and referenced bits. */ pmdp_test_and_clear_young(vma, addr, pmd); - test_and_clear_page_young(page); - ClearPageReferenced(page); + folio_test_clear_young(folio); + folio_clear_referenced(folio); out: spin_unlock(ptl); return 0; @@ -1200,14 +1200,14 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, if (!pte_present(ptent)) continue; - page = vm_normal_page(vma, addr, ptent); - if (!page) + folio = vm_normal_folio(vma, addr, ptent); + if (!folio) continue; /* Clear accessed and referenced bits. */ ptep_test_and_clear_young(vma, addr, pte); - test_and_clear_page_young(page); - ClearPageReferenced(page); + folio_test_clear_young(folio); + folio_clear_referenced(folio); } pte_unmap_unlock(pte - 1, ptl); cond_resched();