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 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(); From patchwork Tue Apr 2 20:12:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13614574 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 82449C6FD1F for ; Tue, 2 Apr 2024 20:13:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 39A2C6B0093; Tue, 2 Apr 2024 16:13:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 349DB6B0095; Tue, 2 Apr 2024 16:13:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 211B56B0098; Tue, 2 Apr 2024 16:13:05 -0400 (EDT) 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 007E76B0093 for ; Tue, 2 Apr 2024 16:13:04 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8DB891A05EC for ; Tue, 2 Apr 2024 20:13:04 +0000 (UTC) X-FDA: 81965690688.30.98490F8 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP id E6EC2C0002 for ; Tue, 2 Apr 2024 20:13:02 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Ql+wRWJ1; dmarc=none; spf=none (imf10.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=1712088783; 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=e1hlJ7o2gk3mHAyuSZ6004f3QEoMdjwYdrk3GsoxpIc=; b=t5zWHHNNm2KNC6n2FKgkgkmzyodR2YW0Kr88I8gJ553oa0v9ZEj+yUTFOG5bTx1x7v1hoQ 4apVYqwzDHO7Brh10oI/R8Sy0vBfrmlcbyS/MkZry7esUvnZNCZraiM5sLHSQecfhGhNFT vpg6mo56+olbADmry0l8ZUvu6G1hRBQ= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Ql+wRWJ1; dmarc=none; spf=none (imf10.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=1712088783; a=rsa-sha256; cv=none; b=J2UaqcIq9w3Ab+R4Mig3nsRDrSseTzMSIJiH3hUsN85FHqbCZ5D5BeiE+pEg2f9tsd+G2+ F7e7IuIgJsK7u7isafAIO3yXUuKpmADIQ/DvYEyDnLriXQRj/lh5hiXvAEjlfvJUExR8Uh B1ZHaB+Ap3Z7Mu+A5b5vBToq23rbVdc= 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=e1hlJ7o2gk3mHAyuSZ6004f3QEoMdjwYdrk3GsoxpIc=; b=Ql+wRWJ1lLCueTZ/gqy0LLsh9P VENcmG/hSpXabmYcNpyTYxFrLaTiSTgK7jzG2aaK0SXqBDcOwVfWmvsmVQYNTEogzCsrVYK8XfCCa UVSkzLLTLL8NkPVR90FEyD4ADHSQgEmKwizHj0/T/OoyUUzjarKpAmXfPdgPhoHWSAtpURlqUUJbq WmhiKSLWQ1PhmyF9jM18aRlV3dwxm+Pq/C7YN5PGt1L4ZbC8KToC/ScCjyQmiIYOmLFy01ky+iDNw XNiwVg4udRFGvoUEhbSXbR7Sg8CMHJ8jF4Qh6vV4COchA3r7v2B0lexLgx3/wZOspm1BugZoTMYt6 PtCRHUHQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrkV5-00000003qeB-2mET; 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 2/4] proc: Convert smaps_account() to use a folio Date: Tue, 2 Apr 2024 21:12:49 +0100 Message-ID: <20240402201252.917342-3-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-Rspamd-Queue-Id: E6EC2C0002 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 61qcyan9qfaki45uaueqxoke48we8f6a X-HE-Tag: 1712088782-587243 X-HE-Meta: U2FsdGVkX1+hFyZKg2E/yQKb3Pvib33faOQXm5xzOwwjYNYMIt5cFqgWSeKfcQvsqMsz2IpftpJvwyzgsjeUjfFsYwlbvuAHUT00lZD+YGCHHw4om42kjimMGTYvcwkmAbZawBK+gu6LEM6Z4WsIt9raAAum+WtOJW1Gp1JL0blKk+2U1GpRO5rQqb3yK4M7eTOcHvm/NwKHPciis2XKAwqXwxKtRzec6Y6Ahf9sU4S/3WFZuh5ultxPl+gWsY5CWfhUBDtpGRGVPYgLJbNz8BvIBFp+W0UuxUtyWqQf8Up7+XtdEiVA6RmO+gTlmUyiMU2hMby9POYSDfbT9wE4o0qGCnuQkCYyCP5leGxvANRSgM6p1IxJou/g1Xlrx1GsU0r8ya8Mse2j9MbGZBKNZY70mAF53Y8zXsFTZsqSWf+PCA+AvbuJpku8JqvVLntEsj9+LW8jFMVY/wDCNnF5GYKLtqPJ4CF3au8WyQ/AY6U0m7Wu327B4pq3HunR8w1DJOV+wcBbhFZ5IVJBU8QRuqqOy+SccDFoaTnsTDvmXAqyKvXonnxra++TfIEvvLrDsI00wObAV5+/+DCbm+q6YGgO1T0EPrlV1fwGyIZsfOuL3yH/GhoTH0/F1HjS/B++H58NPuMXL5Br0OLMKWbEprO6HaFWh4zxaQ0k7RpyK10PLXsDQNlsb28WptRM5ojvs0xQXUYIZvLm1r86uFeEFkDynPgxOaE9VBZFCRnCGSnqpE+RuAPX/GR6f+SGGKqDhdJ147U+4yh5BcvHZSJzLSn7UaeQ3OR5bNhb+n+er1/HuYINhJc5F+EXMb7M1J3hrZzpmyal9pDP00XiSLsfQRA0lO9LnVGfrWWY5tgjaUBrpsCeKV6S+GI4acfJIMJBEYvK+/qlG0+UaDADT6nKGJgCm/nQshZSmLufeWujg+s4gNAQBTamXEK/Ok74AMxTFId3vlnUriW4EmMhPGh mWAg1ISc 1QGbN1b/1WNeyaMJ9f+L3WZKtAQLpPE5RXqeJ442n88XS2Zv+0G7UgSxr+VGKGJ1yxNAtf2ZNDjLBa6gP8RkKSHE+1Scv4wS6e8vXHuUXuecjUyC8NZywqNUOuUKSUg5gcOVV2Z0ZT3cmncGSC0ddD0hV7t9fUTX60EzTIAjWYE8yFl42O/ZgvyZ5opqpMVOGThGOKoAincpojKvzAQo5WJDy+M296aoBJhT8 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: Replace seven calls to compound_head() with one. Signed-off-by: Matthew Wilcox (Oracle) --- fs/proc/task_mmu.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index b94101cd2706..e8d1008a838d 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -444,6 +444,7 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, bool compound, bool young, bool dirty, bool locked, bool migration) { + struct folio *folio = page_folio(page); int i, nr = compound ? compound_nr(page) : 1; unsigned long size = nr * PAGE_SIZE; @@ -451,27 +452,28 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, * First accumulate quantities that depend only on |size| and the type * of the compound page. */ - if (PageAnon(page)) { + if (folio_test_anon(folio)) { mss->anonymous += size; - if (!PageSwapBacked(page) && !dirty && !PageDirty(page)) + if (!folio_test_swapbacked(folio) && !dirty && + !folio_test_dirty(folio)) mss->lazyfree += size; } - if (PageKsm(page)) + if (folio_test_ksm(folio)) mss->ksm += size; mss->resident += size; /* Accumulate the size in pages that have been accessed. */ - if (young || page_is_young(page) || PageReferenced(page)) + if (young || folio_test_young(folio) || folio_test_referenced(folio)) mss->referenced += size; /* * Then accumulate quantities that may depend on sharing, or that may * differ page-by-page. * - * page_count(page) == 1 guarantees the page is mapped exactly once. + * refcount == 1 guarantees the page is mapped exactly once. * If any subpage of the compound page mapped with PTE it would elevate - * page_count(). + * the refcount. * * The page_mapcount() is called to get a snapshot of the mapcount. * Without holding the page lock this snapshot can be slightly wrong as @@ -480,7 +482,7 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, * especially for migration entries. Treat regular migration entries * as mapcount == 1. */ - if ((page_count(page) == 1) || migration) { + if ((folio_ref_count(folio) == 1) || migration) { smaps_page_accumulate(mss, page, size, size << PSS_SHIFT, dirty, locked, true); return; From patchwork Tue Apr 2 20:12:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13614572 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 342DFC6FD1F for ; Tue, 2 Apr 2024 20:13:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 016976B008A; Tue, 2 Apr 2024 16:13:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F32E06B0092; Tue, 2 Apr 2024 16:12:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D34176B0093; Tue, 2 Apr 2024 16:12:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id ACDCF6B008A for ; Tue, 2 Apr 2024 16:12:59 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7409A12048A for ; Tue, 2 Apr 2024 20:12:59 +0000 (UTC) X-FDA: 81965690478.06.E0DFD48 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id CBD8CA000B for ; Tue, 2 Apr 2024 20:12:57 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hHgsV95r; dmarc=none; spf=none (imf25.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=1712088777; 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=XgHhtlpvJ49Xweosp373tZJsyvHxh++z1AM8v71Pnes=; b=ol26zoxbfBL/lZGTC7grypXcudJ4Y+XpeU2ty/EqJlPPctSkbhmxgIiDFhsaTNqmdtltQk bYhxaEEAS9SeuxZg3jdMUd+dwLyMwmd0eElIHrkj+jsg5yGt4TilMsjzh0ts1BZDlO8b+y rZL5fBTnz3G+QFak6jQwLv+WnZyzPGM= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hHgsV95r; dmarc=none; spf=none (imf25.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=1712088777; a=rsa-sha256; cv=none; b=aIMFbWZUPMKMPR8kylncz5Qcn9r/gPbVyNGRC57D9ppJfxW+Fd5GWNnDJjk5138mxwSecq cFwy1Iv4ubJEB7QhMHUzeGyS1bBizT11B8VegjSPkr+OFMtrkU7JqZAwz4YtP4oEJgSmRY i0e8f0Nuh8P0Mf0/WMhcdUiOjc/ecOQ= 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=XgHhtlpvJ49Xweosp373tZJsyvHxh++z1AM8v71Pnes=; b=hHgsV95re1YND5Pn+Vd6K76jiD 0JSEzVWXDoAxskW7k5TUtQE8pr1/EyqcnIjIW9mbirxrDeD2VzKD37AeUl4+kutzYrNvSfqQ8MPr3 B5p3dcaBk6f8EJTUoG7GM/XP9nwnNVh2G6/7qayZXzH/9gwjXYHHUUp7PuCk1pagf9WY/a2ZChrL8 ZESIJsjFR+mq9R7TT3KNCKihnHAAUie61zErnCeJ4uAgbcmZRGS953T57sU7k1/nPAtVcngZe3K+E kmFz28kgYOofRQn0a3IVbKvAnhnfS5nC57zpGZba4wj5vWG2AC/0CxuaXiL/bYiv9tYCTwL4VqGbI ByUM+yyw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrkV5-00000003qeF-33C2; 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 3/4] mm: Remove page_idle and page_young wrappers Date: Tue, 2 Apr 2024 21:12:50 +0100 Message-ID: <20240402201252.917342-4-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-Rspamd-Queue-Id: CBD8CA000B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 46w1p8k6pjifrhaxn1dwjswnimzu9b4p X-HE-Tag: 1712088777-886230 X-HE-Meta: U2FsdGVkX1+ZYi1X77YpB3NC+71sbSwjdk3DClYJS6LcKRW3hSDi4wU/5tvwjs9QI5JwF+RvkU+fSBQOIFU7+/ja9OANI2xz+S7yvtplcFoCT5+qatEGk5ODdJEgQOWBEEtxg0FRLQobrXxvx3XVaV+8m5o+Cqs2xlYOO+QoSTkBddMc3I8jat78XmfMPVHg7TPWbEJZNIYu+D2QV4uuYM8XK1hBmSO8rYlMvbYsk3zACya7QUY5sM0YehwinhfWfGTXgcUYCOv01MoT5ywfO7ufLty3xRB6oNDNtoUeh1O4FyIYujIkExWL+YK4AXnHE2WSQjsyezKSGLvtbSt53LNxmq/X+oow07eZDpxxH8EuIVxz+3PhwXXKJm5pFrJjorbTV3p2YlzFFTjAYgO7k0gWWDpzlQg4oIOB1/LNvEICIjDNO07swRVltLw3Xi9c7GwDmw/qDW8DW8QUBDe5gVTBEUDrRmhSklAPNCMXkC2gLxXFvUQVMQrn1SGpXWRWgRW5vv1pTu1CoIkh5nsIWVvKdmm0oYuITPT8fx5mbyfewr8BIa0uDwSVb5Vj4iRPh+q5LAFFPSomyow17YPFTCf5JBfLBiu6i5J29GHWgdjylpeDRBo/Pv1UzqGORK/ygWJtc6TQOXveDIVoDtU+YLDGnJqtOKLR7cIPvUOjTphfR2GqW0KizQ/ckcp65Vm3JsoVjLT1DWHhOVIN5Sknw7k65o8mT3t9Fw3cAyVgXYO1E/KsRscnMtrCdZqAwo1icp4UQAs8jDrh5lz9HbufUNvc8tiCfp7nTBbEYW4faEKjAjHS6FW/cUKg8ZVJzqW1JxJPhJTribQCcJadRif06xj4z3tS+kT2qAsraStD82eRQJ+exMrO2P4JWVKjY/qXtZPghjoetw2MSGNSAgUhQw1nEF0HhE+nQlV4uxVnPM5E2p7HMUfUKKk++ZkRO925KnH7XEFfVhIHS/rvnYR 8GSLiYga 3qHmzXztvaMPp4VhgyocYv+xYuaC08RM3M2tf5O0P+hbn1rWuVAGO5J43BDUYfqgDBJD8ALZ1npRbuIBwc9GFedI39CwvNh4ov2OieixIPDLp5pGP/SBI0DLlVfReKC/fRfdS0GtjXuKe1EwW0iHviEziwY46zBFeKraMUARF+8lid5Fd6QPvPweEtwseJpMaJhPWMAPtJj53gVFCQqfb1q8cPZS7wRw+bdFT 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: All users have now been converted to the folio equivalents, so remove the page wrappers. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/page_idle.h | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/include/linux/page_idle.h b/include/linux/page_idle.h index 511e22ef459f..6357f1e7918a 100644 --- a/include/linux/page_idle.h +++ b/include/linux/page_idle.h @@ -119,29 +119,4 @@ static inline void folio_clear_idle(struct folio *folio) } #endif /* CONFIG_PAGE_IDLE_FLAG */ - -static inline bool page_is_young(struct page *page) -{ - return folio_test_young(page_folio(page)); -} - -static inline void set_page_young(struct page *page) -{ - folio_set_young(page_folio(page)); -} - -static inline bool test_and_clear_page_young(struct page *page) -{ - return folio_test_clear_young(page_folio(page)); -} - -static inline bool page_is_idle(struct page *page) -{ - return folio_test_idle(page_folio(page)); -} - -static inline void set_page_idle(struct page *page) -{ - folio_set_idle(page_folio(page)); -} #endif /* _LINUX_MM_PAGE_IDLE_H */ From patchwork Tue Apr 2 20:12:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13614571 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 A15E9CD1292 for ; Tue, 2 Apr 2024 20:13:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A296F6B0089; Tue, 2 Apr 2024 16:12:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D90D6B0092; Tue, 2 Apr 2024 16:12:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8864F6B0089; Tue, 2 Apr 2024 16:12:59 -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 6C4136B0089 for ; Tue, 2 Apr 2024 16:12:59 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 33E03140447 for ; Tue, 2 Apr 2024 20:12:59 +0000 (UTC) X-FDA: 81965690478.02.6125ADD Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf24.hostedemail.com (Postfix) with ESMTP id 9D35B180017 for ; Tue, 2 Apr 2024 20:12:57 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=dJw40H3t; dmarc=none; spf=none (imf24.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=1712088777; 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=QwLgf2EYj+juUDGhuHAn9rfAj5hC3bzzsJxsabP0fBQ=; b=qEPMg1e5m9l+dxGXPbY8J1gPymmSFBKV7AI6AIWYUrbodOKamGDrJmy/PCJ5fB33cdMw9W R2byzsQqYT+TFQT6ZWrLIuhGx+BQEYuIxUxSIYAVZ6VSJvnp1c2pf7q+w42iBZ+aEToEzE 10YgnYw8EEcKCWPT4ntJDznqyS2wDA4= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=dJw40H3t; dmarc=none; spf=none (imf24.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=1712088777; a=rsa-sha256; cv=none; b=J/ZIPoN9gEA+HMU3PM8D3ItOdHbOnr6IwTlzwdqX7KXqyVU0atTeiZBHDQX5KTGjYlzxuI pKMQk2HuhdEatO/awWW6f/j1JGFQabZFOMddY+MvoqFvmpCq3YHK97tyHTWo1xEmN5EVol PSROh16Hf92Tp43IoKjyZWTN8TpEP8Q= 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=QwLgf2EYj+juUDGhuHAn9rfAj5hC3bzzsJxsabP0fBQ=; b=dJw40H3tN3hNRovf1r8NCLPJ2f eB16leQKR+jHC7/IoLHhW8S3puuGssGFOJxDOsA6f3E5A6GtSj8egTzso2O/M0Xmh/hr6vRvV7udp bAtsgOq9wAbnenEbFp5pRxE7d2C/ou5scvJuy24Aat1E3iEppZG4Ptwg8e68I/naY6AWMdHYZIPxz mtgnvJBxqrN9DB/pjTGkEGqMs3F+/A+oY2hj5vatkdlXTKB63UatHsoJgCGGaCyEeE3YYkOEreHM8 W0Ge/vmkJMT9p5k/ZvLgg8O0n3+30FuX1j4wWe45QxZ09zYCklVkNGHR91z5Ldw2pAc/LQLRAC5po E/l9FeMg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrkV5-00000003qeM-3Y1u; 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 4/4] mm: Generate PAGE_IDLE_FLAG definitions Date: Tue, 2 Apr 2024 21:12:51 +0100 Message-ID: <20240402201252.917342-5-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-Stat-Signature: woneozmbp7qzggjxefg4oae4prrkuznh X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9D35B180017 X-HE-Tag: 1712088777-846453 X-HE-Meta: U2FsdGVkX18f9nLWmmSo3Plo+svbo7tgpZfM9IrAs2FkqChWR5wRqyjC9iopKeAcl6e1EzJEfe7e3V5VhrIe6N/T+Bj7Z8NaJQT1/dI3HS/GQwxIpayt07MWlupbhWFDF8wT9JaAAVuUnszhz5xZNkF3VqzNP9x0D6yghSR4utUVQWIfxCbvsp3s9lF4tShIfCINsUmcHuQ+ogLa3qU9M4mjo7JGFVr8a4PZ2ywtkFNkgz/xKgbKs14IzNzLGxc997shPeBenZMMjJ5Gj63DaAyIgQFDTLilrKoDRl82YCm3WeeBboFfVPcJwTA2keru6Q5O8DdxY8AvwG4xIK44Iu2ics/zM3gSpwk7UVk8V9pgoYqb/j6PoNEb/2mPXsq1DAh2QgIm6GedieTLPQu7GSE1MnVbvToXbzzCbWCUpumS3JLzf/RIh30nq07E69fp7SM2oJd20G72BQ11ox5wsPMGvNt55ezeXWMyjjxyVws+RBGmFgyY56QPkkRdHJGeEzIOtR2uC26HliZOgTU8u+Q6XlLBjhqVnZgAVtEZwJf/967nLoqN5kPT2lN30P5af36AavV0Pq76n9ZNsZ0urKdbeVO/DUz+FE8DGU+GWrpgMzVg9VmLOpYopZP+Q8/MYI70zsz8PHi2VnPSitlfp739v41Pt7MHcEqy+XJUT5peUOMoD7Ez3J1Y7Q1BuUw2qOoVnweyohII60PaZ+QU6hgUFZCGPuHqWx2ql7rxrF43KPhJwsrGnW2HpcDnlIL02OVqFDJ0D0w1e9z6yuEV8S3BaWMt8pqbnTDHaLE175MzbGkTazAj2A375oFbHPlj8ftNwiV1RUmpYr3SbOd88d0Z5XM33MfFFU8ejXhaOYc3ibhAE2PJ0C5JHlqE3K1+iQsBeLbRSQeN5ENtYpn7YJSq6B7C23Mi2LaJDkMa9SmOl4kup3oqrl1zkQhkojAI4gedUkc6yB6T3PhFEPn iBzwp6iy xpBKd5B6riDB2iin5Y6jUqr16sfpV6d2Sfbo0qDgiZivgo0OmCRqO5de+JedjBhdbH2lF783rpFU16AB6asz13PRbPiJl3s68lyvWHg8NP3OAJh4qlECIHowCzvx45WhmIUhcJ/0hqY+yVcDeyVdpvi+vWkSFF1+1SPykGj62WeLCvPTylmslDEyrNWhL6/zL49NsAs8W+tIOmYjWvbzhrNmaz7DGaZgpMXV0 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: If CONFIG_PAGE_IDLE_FLAG is not set, we can use FOLIO_FLAG_FALSE() to generate these definitions. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/page-flags.h | 9 ++++++++- include/linux/page_idle.h | 37 ++----------------------------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 888353c209c0..a49739a67005 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -626,12 +626,19 @@ PAGEFLAG_FALSE(HWPoison, hwpoison) #define __PG_HWPOISON 0 #endif -#if defined(CONFIG_PAGE_IDLE_FLAG) && defined(CONFIG_64BIT) +#ifdef CONFIG_PAGE_IDLE_FLAG +#ifdef CONFIG_64BIT FOLIO_TEST_FLAG(young, FOLIO_HEAD_PAGE) FOLIO_SET_FLAG(young, FOLIO_HEAD_PAGE) FOLIO_TEST_CLEAR_FLAG(young, FOLIO_HEAD_PAGE) FOLIO_FLAG(idle, FOLIO_HEAD_PAGE) #endif +/* See page_idle.h for !64BIT workaround */ +#else /* !CONFIG_PAGE_IDLE_FLAG */ +FOLIO_FLAG_FALSE(young) +FOLIO_TEST_CLEAR_FLAG_FALSE(young) +FOLIO_FLAG_FALSE(idle) +#endif /* * PageReported() is used to track reported free pages within the Buddy diff --git a/include/linux/page_idle.h b/include/linux/page_idle.h index 6357f1e7918a..89ca0d5dc1e7 100644 --- a/include/linux/page_idle.h +++ b/include/linux/page_idle.h @@ -6,9 +6,7 @@ #include #include -#ifdef CONFIG_PAGE_IDLE_FLAG - -#ifndef CONFIG_64BIT +#if defined(CONFIG_PAGE_IDLE_FLAG) && !defined(CONFIG_64BIT) /* * If there is not enough space to store Idle and Young bits in page flags, use * page ext flags instead. @@ -87,36 +85,5 @@ static inline void folio_clear_idle(struct folio *folio) clear_bit(PAGE_EXT_IDLE, &page_ext->flags); page_ext_put(page_ext); } -#endif /* !CONFIG_64BIT */ - -#else /* !CONFIG_PAGE_IDLE_FLAG */ - -static inline bool folio_test_young(const struct folio *folio) -{ - return false; -} - -static inline void folio_set_young(struct folio *folio) -{ -} - -static inline bool folio_test_clear_young(struct folio *folio) -{ - return false; -} - -static inline bool folio_test_idle(const struct folio *folio) -{ - return false; -} - -static inline void folio_set_idle(struct folio *folio) -{ -} - -static inline void folio_clear_idle(struct folio *folio) -{ -} - -#endif /* CONFIG_PAGE_IDLE_FLAG */ +#endif /* CONFIG_PAGE_IDLE_FLAG && !64BIT */ #endif /* _LINUX_MM_PAGE_IDLE_H */