From patchwork Tue Jul 25 04:20:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325714 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 416ACC00528 for ; Tue, 25 Jul 2023 04:21:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5C4C6B0075; Tue, 25 Jul 2023 00:21:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B0C79900002; Tue, 25 Jul 2023 00:21:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9858A6B007B; Tue, 25 Jul 2023 00:21:11 -0400 (EDT) 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 8BC926B0075 for ; Tue, 25 Jul 2023 00:21:11 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5189C40CD8 for ; Tue, 25 Jul 2023 04:21:11 +0000 (UTC) X-FDA: 81048834342.11.7E8BBB5 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf21.hostedemail.com (Postfix) with ESMTP id 8195C1C0017 for ; Tue, 25 Jul 2023 04:21:09 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=NIGVZvXp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf21.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258869; 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=DXYENedStYVsFXpaqy8X3+wmlabVR1q8JHyD5+dxFj0=; b=HLBFS386FbSmQgU2qXPALD33VDPpbxcAf9vGUK40zcYaM9TmXrd6FO8jgxMQ7RDe3UFlhT NTvN0vcsko/XZvr6Zu7Is2o/Oaj95UQiZYgpEt/qxslaTlvz1gS3XYHVEe+tiZhRFIyjWX xxCM2Zs4BCZWK/jSD8EPZXjsMykXZi0= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=NIGVZvXp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf21.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258869; a=rsa-sha256; cv=none; b=pGs3FD5HwnuBWTCkmMfDR7RXJJ7gZzRung0lTWD/khT6LuO+uyKLaVl+SItE2JpnvV7qcZ GxMTqQXCZk3gTBuqjk2dWlHhp9Y0F3DpxhMomwsYoaVK6dZfJ0nKpfltpnEk0fCJbJ0b63 Nc9JHDPwUjc9F9FVgQWxvFcOxbiTPrE= Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-cf284f4d7afso5663483276.3 for ; Mon, 24 Jul 2023 21:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258868; x=1690863668; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DXYENedStYVsFXpaqy8X3+wmlabVR1q8JHyD5+dxFj0=; b=NIGVZvXp4f6PI/DiyEOXr4f5A6/bm955BIOhiZOHaf2xh+RIldWqkGVwj9eR6s7h/D u8onvMaEHJrYU/HCUYvuGCCHfNRwQcrgAf2DqnNwPmYZKfV6oX/8zUa5Ig2Q+OQW0ypq XPjKaW0SZdhI5qLkWxfkcfI+eeyw8wOays1ttc+jYPlhsNlhP4uKwb+dfDR5nCYKuXl2 +XMxk/OSmgfJy9dL/mFwEgWIg+fhMPrVsdF2dCpA0ebzWdyAhRP+4N95J6UWvMmJ+uKs yf/le1oPMyKhHzKGvzlCs3EuPlXqwgoKoHDer5fRkFbOxeVLftXul8Z+3F07FK5C3JFa Y2Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258868; x=1690863668; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DXYENedStYVsFXpaqy8X3+wmlabVR1q8JHyD5+dxFj0=; b=VRRB2gjQrMWIBNUDR+hpgnP+K/r2IrCUWLB7evLh7k16P58ByIk9ax4xBcPZmwqfA4 e2KoWTYn2gdNd5+lDz0tydAGaR2ge4VElQ5W8ZYEiloRvLHt7psKqGLKBOLlXlkf/jF4 r8/7sKLgIjrMq97YmBS30PxSmP1pMkgET8s7LRElssJOanHXn+VgJEwmId0OMant6kYW rvmGlNdCGLF0n995s+KU9aDKqqLkhDX9kdInPI0A1QYwP6euIT/JMBrQlqBAPM7cP1jN 9IMdEsxFMdDGVpnjuJ82T/u1BTjG5hSHUGCAnHs6HA/sGV7Eb6eDrxUBBE2TNj5B2Dgb YeDA== X-Gm-Message-State: ABy/qLYXklYLK+H6qUmkquZcfjBr9cMm3qDwS3wp4DakEXkURXLm1JoM Vjof/PHJz7KQpqDDi28pbEw= X-Google-Smtp-Source: APBJJlFMeQGxec1oJDVWQUYg3sII69ysVmGK3iC6jxP+dksIpqg/98z6796G6YK9NBoYSePtafE2Ug== X-Received: by 2002:a25:7ac6:0:b0:c5e:d3af:35cb with SMTP id v189-20020a257ac6000000b00c5ed3af35cbmr8904739ybc.42.1690258868599; Mon, 24 Jul 2023 21:21:08 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:08 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 01/31] mm: Add PAGE_TYPE_OP folio functions Date: Mon, 24 Jul 2023 21:20:21 -0700 Message-Id: <20230725042051.36691-2-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 8195C1C0017 X-Stat-Signature: qu9tydij67gps3skjcm57b1xs7ay1qdz X-Rspam-User: X-HE-Tag: 1690258869-594196 X-HE-Meta: U2FsdGVkX1+vR8AY8SJNm1ArzmOgXja1NBMzJz6jfF6r42VB+jD/ePxVe/WS4QZF3ZAEHSreWOnq2Ftoz3nbUXC6b7iY9tPnLOm5NIk+TpYULC3efkE8u8jOF8H5QHHoiBNKHQwD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HvBsVgB19HrAh2XH/shajq2GkNcnmqh/vaTraLvHESZ8ucMZrYSIm/en/yzwU5IpM9TWYkpHIRjyg2XMHAZe1ScXTz50cPfeXtwIhuchPZU33j+NahpfMSsBXnKPk6gl5nAnzDxlJZNOKgG/pfME+Wr+70WcRH9T2bTSYrRoHN2eUy2s8G/Iucqj/ssB8DNJv1M7DeluL3/r3Y/pUN3uccSj45aokzSyvd+uziQ3xwBmF21J12/v0bieohiY+X0caGncipL/scfpUwhGP18Nmq0p2AfzWaw6egBsjY/Nwff0NfJd2L4B6hgindaPPbKqGZ8xzcpvWAiKuzE0gzrVJbgRR99RX2ZF+YqzhvZCrWiXrPUiFlY84xPHXq0iuGNYox2h6BYbbxBoEvPNa8MhhBfORaTyMkbp10ea3Mf4RiQsIJ43Ias5SICLNlj8= 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: No folio equivalents for page type operations have been defined, so define them for later folio conversions. Also changes the Page##uname macros to take in const struct page* since we only read the memory here. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/page-flags.h | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 92a2063a0a23..9218028caf33 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -908,6 +908,8 @@ static inline bool is_page_hwpoison(struct page *page) #define PageType(page, flag) \ ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) +#define folio_test_type(folio, flag) \ + ((folio->page.page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) static inline int page_type_has_type(unsigned int page_type) { @@ -919,27 +921,41 @@ static inline int page_has_type(struct page *page) return page_type_has_type(page->page_type); } -#define PAGE_TYPE_OPS(uname, lname) \ -static __always_inline int Page##uname(struct page *page) \ +#define PAGE_TYPE_OPS(uname, lname, fname) \ +static __always_inline int Page##uname(const struct page *page) \ { \ return PageType(page, PG_##lname); \ } \ +static __always_inline int folio_test_##fname(const struct folio *folio)\ +{ \ + return folio_test_type(folio, PG_##lname); \ +} \ static __always_inline void __SetPage##uname(struct page *page) \ { \ VM_BUG_ON_PAGE(!PageType(page, 0), page); \ page->page_type &= ~PG_##lname; \ } \ +static __always_inline void __folio_set_##fname(struct folio *folio) \ +{ \ + VM_BUG_ON_FOLIO(!folio_test_type(folio, 0), folio); \ + folio->page.page_type &= ~PG_##lname; \ +} \ static __always_inline void __ClearPage##uname(struct page *page) \ { \ VM_BUG_ON_PAGE(!Page##uname(page), page); \ page->page_type |= PG_##lname; \ -} +} \ +static __always_inline void __folio_clear_##fname(struct folio *folio) \ +{ \ + VM_BUG_ON_FOLIO(!folio_test_##fname(folio), folio); \ + folio->page.page_type |= PG_##lname; \ +} \ /* * PageBuddy() indicates that the page is free and in the buddy system * (see mm/page_alloc.c). */ -PAGE_TYPE_OPS(Buddy, buddy) +PAGE_TYPE_OPS(Buddy, buddy, buddy) /* * PageOffline() indicates that the page is logically offline although the @@ -963,7 +979,7 @@ PAGE_TYPE_OPS(Buddy, buddy) * pages should check PageOffline() and synchronize with such drivers using * page_offline_freeze()/page_offline_thaw(). */ -PAGE_TYPE_OPS(Offline, offline) +PAGE_TYPE_OPS(Offline, offline, offline) extern void page_offline_freeze(void); extern void page_offline_thaw(void); @@ -973,12 +989,12 @@ extern void page_offline_end(void); /* * Marks pages in use as page tables. */ -PAGE_TYPE_OPS(Table, table) +PAGE_TYPE_OPS(Table, table, pgtable) /* * Marks guardpages used with debug_pagealloc. */ -PAGE_TYPE_OPS(Guard, guard) +PAGE_TYPE_OPS(Guard, guard, guard) extern bool is_free_buddy_page(struct page *page); From patchwork Tue Jul 25 04:20:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325715 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 B1602EB64DD for ; Tue, 25 Jul 2023 04:21:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F3526B0078; Tue, 25 Jul 2023 00:21:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A37D6B007B; Tue, 25 Jul 2023 00:21:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F5796B007D; Tue, 25 Jul 2023 00:21:14 -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 202226B0078 for ; Tue, 25 Jul 2023 00:21:14 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CC702120C67 for ; Tue, 25 Jul 2023 04:21:13 +0000 (UTC) X-FDA: 81048834426.02.6AD7E47 Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) by imf10.hostedemail.com (Postfix) with ESMTP id 04099C000C for ; Tue, 25 Jul 2023 04:21:11 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=nfSBxZc3; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258872; 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=Z39OytypuZQhWkFCV+z6u8l5O5ZgTP/vsQXKA5JsO6g=; b=bjsK2olX700J2f2B5eryjDRTYrJxAYEHRco4UKo/KSmUkEu6oNahSJRAafs7RDZOF81axO md+8IgztFcEMhV6QGQSy0od/xGwTbsTOh/t2Tgtxsyq/ttRuiYswhu/PHWp9U/AZEQ4C/L snJaQwuUjOsmwTlPxeFsioq0jZ4Wtew= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258872; a=rsa-sha256; cv=none; b=ww2D2IPaVqLs/cAipMRjOE6JanroMarCHENfIPlkIzAReIrCyXxxlb4uGde78EkzSJdLrI c1tsQ662ddaXPjVC+z82rvd04Oq4529OoMAqZPb1oifeMwsJiQHV2skANFEitsUhwelzam JWO4+ZzDV1UHW+QEMMEhYRISolhqVQ8= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=nfSBxZc3; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-d13e0bfbbcfso1761624276.0 for ; Mon, 24 Jul 2023 21:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258871; x=1690863671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z39OytypuZQhWkFCV+z6u8l5O5ZgTP/vsQXKA5JsO6g=; b=nfSBxZc3bItW8IdMBLL+dSGF/sScmKpt0AcwakiFztIyJApvwUouFBq2QYNw8J0rTh aGOyeE8+hHOVNRFF4WnJZ/JBfvYsJ6/Oqtf1pd4yYE50HlUq0kH3gRbnZoqyUUw5UiUt 9BiNVm/Jcmu4oBRAf0Ghv+POnWAvJRL2FAU4oS0kRbRMToMj9LqJMWXwLu8fKfr8IAjj wOqfUiwKX3V5nYlU7QswO3bA3PxVILROT4IFFlX3tqCczMBU5TNT3JSvKElDhd9S0f0I IVPRDxFnKb0Q83Ir8UwSfLZr1e3Lc2Zl/QQj5qJvJK7JbaWdiWhNWfmCQ7brLh/spl2P pUgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258871; x=1690863671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z39OytypuZQhWkFCV+z6u8l5O5ZgTP/vsQXKA5JsO6g=; b=Q5XsANfXs8JLNe+6tCHtiBVT5+HoDD9EPtrV3drfdhJhEYV/EJoBTG4/PMH7z0gIc1 UBYd2gmDvfD7R8XbYawneWCQ95uufvyRBWvtOk6Z9D0NaOUdX9k188yLPX04F7rtuTcs Ky68CLc/9nkLZ3AqW6S2gwhzY5PgysKfQH078nwOjSdjDPFFPhLRrf9wkUzrp4olGDre O5XgG6OB16QpSuRs8g2VHnUL1vYZYP4LuWpK/1RIgu1K6lgfp1TheuGNxWA4ZewKuo8P hkitNtr/+pcFtlQc94dVwcKBGKmv2c6ckyyqacnrsNdbVC5bytfHlG8HGmtb9KbS2JTw Z2SA== X-Gm-Message-State: ABy/qLaMRBsUvp9uwXa3MoYl98mV3oN0IqlpznGmw64RtLekiyw+QX5o 3roOX4X9NbSINQvqR57BngA= X-Google-Smtp-Source: APBJJlH3lH39robuGI5LChDr8WX6p02zic6DdoBpY//WhDEwtiPShXvAKethMDx9GI6ybtlOyIPsYw== X-Received: by 2002:a25:b4c:0:b0:cb7:a41e:be58 with SMTP id 73-20020a250b4c000000b00cb7a41ebe58mr1296053ybl.23.1690258870978; Mon, 24 Jul 2023 21:21:10 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:10 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 02/31] pgtable: Create struct ptdesc Date: Mon, 24 Jul 2023 21:20:22 -0700 Message-Id: <20230725042051.36691-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: jpjtuoukajuwsarfs5cbj4r4m1cxe8y3 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 04099C000C X-Rspam-User: X-HE-Tag: 1690258871-552603 X-HE-Meta: U2FsdGVkX1+5H8u7cAr9/HPc8u7fu8yt9vRXJC8xu5x3gTiJO1jsIMHrCKEJVEkWqdxUkks1b/hHdYBSGarK9MJiSSf/eZzzYEZqyC3j+g4YGLKdxDh++MK6V9O/IHPzBckWuk8EWjFc1tWIGFRzrbJSbnAAbA0i2j0ffG1BQ8HLGJIgzewA9HOZfoAanmHCgESbiBoB0gdb6mC/ga6Qqqx4PhqJe6EuRAsA3k7s6gsq2Fkqlh8P4qmatzEBiW6Oko13I07ikGk0xYk+Qeubn53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JOCQfScMxWugjTdFb4IICrLbUteM2hnGacRh3RBEjVxxx61Kfr8m1CY29Ou+6q6xMPp2hBwXDxcczOjbROM32sM9L2sxy6vgy2Yq2TOGEU6x8i9I/ngRVd4ouX+z8LXGYWpNldiTbprR1zpjdSwE1s2E1a9DMbatF6UERZvmXjejFWQfLNfy2q66AT9q9gR63tWnSro/ZyAEIkJtsOQP9NkV198TrLhuaXw+KrjJv4P4X5NAl+g== 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: Currently, page table information is stored within struct page. As part of simplifying struct page, create struct ptdesc for page table information. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/pgtable.h | 71 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 5f36c055794b..1f92514d54b0 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -993,6 +993,77 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma, #endif /* __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION */ #endif /* CONFIG_MMU */ + +/** + * struct ptdesc - Memory descriptor for page tables. + * @__page_flags: Same as page flags. Unused for page tables. + * @pt_rcu_head: For freeing page table pages. + * @pt_list: List of used page tables. Used for s390 and x86. + * @_pt_pad_1: Padding that aliases with page's compound head. + * @pmd_huge_pte: Protected by ptdesc->ptl, used for THPs. + * @__page_mapping: Aliases with page->mapping. Unused for page tables. + * @pt_mm: Used for x86 pgds. + * @pt_frag_refcount: For fragmented page table tracking. Powerpc and s390 only. + * @_pt_pad_2: Padding to ensure proper alignment. + * @ptl: Lock for the page table. + * @__page_type: Same as page->page_type. Unused for page tables. + * @_refcount: Same as page refcount. Used for s390 page tables. + * @pt_memcg_data: Memcg data. Tracked for page tables here. + * + * This struct overlays struct page for now. Do not modify without a good + * understanding of the issues. + */ +struct ptdesc { + unsigned long __page_flags; + + union { + struct rcu_head pt_rcu_head; + struct list_head pt_list; + struct { + unsigned long _pt_pad_1; + pgtable_t pmd_huge_pte; + }; + }; + unsigned long __page_mapping; + + union { + struct mm_struct *pt_mm; + atomic_t pt_frag_refcount; + }; + + union { + unsigned long _pt_pad_2; +#if ALLOC_SPLIT_PTLOCKS + spinlock_t *ptl; +#else + spinlock_t ptl; +#endif + }; + unsigned int __page_type; + atomic_t _refcount; +#ifdef CONFIG_MEMCG + unsigned long pt_memcg_data; +#endif +}; + +#define TABLE_MATCH(pg, pt) \ + static_assert(offsetof(struct page, pg) == offsetof(struct ptdesc, pt)) +TABLE_MATCH(flags, __page_flags); +TABLE_MATCH(compound_head, pt_list); +TABLE_MATCH(compound_head, _pt_pad_1); +TABLE_MATCH(pmd_huge_pte, pmd_huge_pte); +TABLE_MATCH(mapping, __page_mapping); +TABLE_MATCH(pt_mm, pt_mm); +TABLE_MATCH(ptl, ptl); +TABLE_MATCH(rcu_head, pt_rcu_head); +TABLE_MATCH(page_type, __page_type); +TABLE_MATCH(_refcount, _refcount); +#ifdef CONFIG_MEMCG +TABLE_MATCH(memcg_data, pt_memcg_data); +#endif +#undef TABLE_MATCH +static_assert(sizeof(struct ptdesc) <= sizeof(struct page)); + /* * No-op macros that just return the current protection value. Defined here * because these macros can be used even if CONFIG_MMU is not defined. From patchwork Tue Jul 25 04:20:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325716 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 DD20BC41513 for ; Tue, 25 Jul 2023 04:21:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 656236B007B; Tue, 25 Jul 2023 00:21:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 603F76B007D; Tue, 25 Jul 2023 00:21:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42E9C900002; Tue, 25 Jul 2023 00:21:16 -0400 (EDT) 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 358296B007B for ; Tue, 25 Jul 2023 00:21:16 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id F04FF40CE3 for ; Tue, 25 Jul 2023 04:21:15 +0000 (UTC) X-FDA: 81048834510.21.E10CEA1 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf28.hostedemail.com (Postfix) with ESMTP id 0D307C0009 for ; Tue, 25 Jul 2023 04:21:13 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=s2BAwwv8; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258874; 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=VFdcrIV5fIYEpRddOkWey4lp7uyipkLol3FVSysO4BI=; b=CU8gGBetRi80A/qxTwViFtdINq6FLm0iRnPlC4iY1GL+kD5QZTXdRAsG7EVBo3qhb3wBZQ QxM/+xHetCiO2fiU0iZY/lJKZ2c9xoJaUSgwZjNClE9pbNu6jq6SiEB+3ojtJEIqDFk1yX yC/64UaqRg342kSTwUjhdF2kJVP4qrM= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=s2BAwwv8; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258874; a=rsa-sha256; cv=none; b=pk24pzIzSgQywX+tiR8xLNZPabhmzVDMOBxckRAkHsuBcs0JjLiJZRYZYR5No6mDg8Gq/6 IhzjAfWJJf+RL7ovkjcmflojf1cahwwzipoF641BRkFofxDBV0m94CPxfnhPuWq054wGLr Om5EIXDnlWnlbjzrqqwm/FJ1Mhms0Zo= Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-ccc462deca6so5718694276.0 for ; Mon, 24 Jul 2023 21:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258873; x=1690863673; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VFdcrIV5fIYEpRddOkWey4lp7uyipkLol3FVSysO4BI=; b=s2BAwwv8oUl+Hs1v7tcLJQyKdVwJshh+4MpeNVgW1JpMCfNsHy0yAipjGg5nDC4TQ3 JkHdARTanKtpCG9rN/oS8YzJfpPRNx6XW3JcMNzfdGZFEFJtnvS7vhAwLgXYeaHpX4H5 NJaLuVvVp94MScMO0B9PaYwNUr2ulC3xrBpZ+CyDbAB9PpgdPgDL4PRuM4CqBe7/ffTt TmfnC+ju4A6ouW55J0uzsReFyd+IYIWUEILsrpu+20SnVPwPWzbnSxYO46LPY8/Yv8hj xJ022X/2C2f6wqhTFayqxrRvwC61r0RZYX59fEcwS+AuUkwZ6FlssTAYS5BT87g2jU8h 4qTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258873; x=1690863673; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VFdcrIV5fIYEpRddOkWey4lp7uyipkLol3FVSysO4BI=; b=MiFDrqhWMShi1kMyd5s9PHPLQ62TL6fX9oYCLTGfxHk0PJ+KjE4XtDoSPfibrBFj1S +bFeIlyKyrxUSGTs0kegRdDkftsAn/mSKJNaS03jWQqv1xfudZj07OFKuPfGEET/4+MF vnVMkuQ+RU8oMVMemtKle6utrna2B7R7+daBCXx9SDRVadzp4PHCciZ6G5tHlb33x0ot DzM6SUG942Wrw3iSzcsmk6CvksmmOGw/vmjUa7E8lx28qwar4xkf3H2dMm19DNdOZEC0 RZXSDbnj6PweU6qoVSwCUCC1UsDhfKA9H5k5mD28YuhAgBDQ7uDbunOi4Yc+HcdmSBDT ydaw== X-Gm-Message-State: ABy/qLYm0AaufxWF8s0rpurc/2jjXoIJU4TVF4hWMEXNF4Xan+IY7GFp 6F47T0Ff/oq1FeNmSaayzsI= X-Google-Smtp-Source: APBJJlEljmstle/55h2Wn4YBOHbmslxxkZ+0xzy95w3akZzqV4BQHNPNvPKRyocnj15MdoqDrOBO8w== X-Received: by 2002:a25:1e09:0:b0:d05:2b13:aec9 with SMTP id e9-20020a251e09000000b00d052b13aec9mr8919211ybe.23.1690258873123; Mon, 24 Jul 2023 21:21:13 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:12 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" Subject: [PATCH mm-unstable v7 03/31] mm: add utility functions for ptdesc Date: Mon, 24 Jul 2023 21:20:23 -0700 Message-Id: <20230725042051.36691-4-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 0D307C0009 X-Stat-Signature: n5sbnfdaih946i1s6j5k9fam9qeneizp X-Rspam-User: X-HE-Tag: 1690258873-64144 X-HE-Meta: U2FsdGVkX1+FZSweqdiGI/8kQ6oEWcPGpYESCUOvaQUeslS/VCaq9pE9ssqFGVogI1XlgmjKL7NKDazlj5VknYABZLYmZv5O+omy2WZ4/JBJEZ8wMuu10V0+EZlFWQaeGAZ2DLpQ/y+WRl+RemJWd4CrkXHOTtul58ODBxNSprRwuToVRrRqGL+c9+FlWEIF280GkpAKVPqxqo3+ol1jtqWres9nUrN4xdUXOIH1G6cFGQfKeMZqgB2FQQUNoJfluWq0bW0WGl93jAQ5yp/xrJ9OT2vnmJc6IrJl6ItiI88zjAIcjMPOKxDMSM8kM/Cni1hGOKIQxcszIpOaSDuIW7HxYJ+QnMP0T+tNqw/jZZw5ky4omMD4u0A/60LH0sA+s3zQ2XoPc5LOwrQc8jZgozsynwRdkxVqD1uFj9/GengZK6jLLjHf0uTz7fm2hfaZrtRN1U+1qtQggQ91lzij/u178XA6av8ZWVTxjhBNU0Pqh4RPaNKlGidk7ftxOKln6WazzrG7dxUSH+WkK/veN1CveQ1vmU3SANScHwLHSocBTTlSa3BmlkMk9WzOpGfDuZTot5aVGKAfj54GfUQCeEq4DCAJasbU8hiiU0SLPc6MMQeY3WeF2/cS05XzzZyA+ZLoh78AwnOlk9mCVaLnSRQvAzbuORw8l5m7e9YvXfjKbRuh7te4EH627H8BA6KAZ3A/jinbI9m5OWm1R7DJ9GfShz1TXUpBW65w2CEsHEQXZaOQ8YZ5ChKLlNW1r0+V75sUWQn8Btfj76muQypk8fGYIFkAodDltyTdzMohTIRjXQcxH0hwKtlphIwa49XUBU+oMTCzMXlK0LipNU04Jk7z6LKQkcL+xyK7M+TJQtWw5b9cb4MOI/4zzwGOLbU3VjQAGpkWyuOtvTwvfXjwR9D7DT02oR81TlvyuIE60OiWhHRNKywloV7M/YoKn5xnR/TPzVkeoKwA4pefJqM yaoy2H4r +bqLiK5o4B1QhML4gAdS2BnquIITzAUDOE/znW1cEDyVKhTtYNIHo0hyytVqVfo7uBLKjcVgJ0EnIYjnIT5sSC1dmwPAOfI6EwiHCU6FE9Ltu529b+l2aouonycFb/5z/bzXYBMv1ggO5KAkjNx3zMWT+Vy3Rz0B2xMMBQA2rGH/4kC7dpsW+vVCO0IGipzO5hY74WZRDi5w++aOAQe83VBVFpIFEMKI49IxuZMUIIwiXvcAkvn/Dw4CbQk8UxBUzcdHmbGoE0B1FMLzdxDMp4ymtqYiVRzTbUSPqnIE+XQqxA7qL17dn42gsTfcECWtyHPf95kV8g3T55hugISS9mYTgxx04HEx5y37UelkaNsrlSQUqQZA6QHnQXs0+hdFkGGWpvnnodemmfYJULSxMGxdq9Fbnv4S8q22/ySf+0v3tppUOOrS5hFw2Kk8hDOhyxxifFuyzGGsGA12LLTvPTRYfzRJPKxlrsrn/dgH6jXQl3/mFkn9FWj+mo4GCC81uaA5R9aDI0tT/4SF6gKTTQ1H3yQ== 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: Introduce utility functions setting the foundation for ptdescs. These will also assist in the splitting out of ptdesc from struct page. Functions that focus on the descriptor are prefixed with ptdesc_* while functions that focus on the pagetable are prefixed with pagetable_*. pagetable_alloc() is defined to allocate new ptdesc pages as compound pages. This is to standardize ptdescs by allowing for one allocation and one free function, in contrast to 2 allocation and 2 free functions. Signed-off-by: Vishal Moola (Oracle) --- include/asm-generic/tlb.h | 11 +++++++ include/linux/mm.h | 61 +++++++++++++++++++++++++++++++++++++++ include/linux/pgtable.h | 12 ++++++++ 3 files changed, 84 insertions(+) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index bc32a2284c56..129a3a759976 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -480,6 +480,17 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) return tlb_remove_page_size(tlb, page, PAGE_SIZE); } +static inline void tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt) +{ + tlb_remove_table(tlb, pt); +} + +/* Like tlb_remove_ptdesc, but for page-like page directories. */ +static inline void tlb_remove_page_ptdesc(struct mmu_gather *tlb, struct ptdesc *pt) +{ + tlb_remove_page(tlb, ptdesc_page(pt)); +} + static inline void tlb_change_page_size(struct mmu_gather *tlb, unsigned int page_size) { diff --git a/include/linux/mm.h b/include/linux/mm.h index 2ba73f09ae4a..3fda0ad41cf2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2787,6 +2787,57 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a } #endif /* CONFIG_MMU */ +static inline struct ptdesc *virt_to_ptdesc(const void *x) +{ + return page_ptdesc(virt_to_page(x)); +} + +static inline void *ptdesc_to_virt(const struct ptdesc *pt) +{ + return page_to_virt(ptdesc_page(pt)); +} + +static inline void *ptdesc_address(const struct ptdesc *pt) +{ + return folio_address(ptdesc_folio(pt)); +} + +static inline bool pagetable_is_reserved(struct ptdesc *pt) +{ + return folio_test_reserved(ptdesc_folio(pt)); +} + +/** + * pagetable_alloc - Allocate pagetables + * @gfp: GFP flags + * @order: desired pagetable order + * + * pagetable_alloc allocates memory for page tables as well as a page table + * descriptor to describe that memory. + * + * Return: The ptdesc describing the allocated page tables. + */ +static inline struct ptdesc *pagetable_alloc(gfp_t gfp, unsigned int order) +{ + struct page *page = alloc_pages(gfp | __GFP_COMP, order); + + return page_ptdesc(page); +} + +/** + * pagetable_free - Free pagetables + * @pt: The page table descriptor + * + * pagetable_free frees the memory of all page tables described by a page + * table descriptor and the memory for the descriptor itself. + */ +static inline void pagetable_free(struct ptdesc *pt) +{ + struct page *page = ptdesc_page(pt); + + __free_pages(page, compound_order(page)); +} + #if USE_SPLIT_PTE_PTLOCKS #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); @@ -2913,6 +2964,11 @@ static inline struct page *pmd_pgtable_page(pmd_t *pmd) return virt_to_page((void *)((unsigned long) pmd & mask)); } +static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) +{ + return page_ptdesc(pmd_pgtable_page(pmd)); +} + static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { return ptlock_ptr(pmd_pgtable_page(pmd)); @@ -3025,6 +3081,11 @@ static inline void mark_page_reserved(struct page *page) adjust_managed_page_count(page, -1); } +static inline void free_reserved_ptdesc(struct ptdesc *pt) +{ + free_reserved_page(ptdesc_page(pt)); +} + /* * Default method to free all the __init memory into the buddy system. * The freed pages will be poisoned with pattern "poison" if it's within diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 1f92514d54b0..250fdeba68f3 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1064,6 +1064,18 @@ TABLE_MATCH(memcg_data, pt_memcg_data); #undef TABLE_MATCH static_assert(sizeof(struct ptdesc) <= sizeof(struct page)); +#define ptdesc_page(pt) (_Generic((pt), \ + const struct ptdesc *: (const struct page *)(pt), \ + struct ptdesc *: (struct page *)(pt))) + +#define ptdesc_folio(pt) (_Generic((pt), \ + const struct ptdesc *: (const struct folio *)(pt), \ + struct ptdesc *: (struct folio *)(pt))) + +#define page_ptdesc(p) (_Generic((p), \ + const struct page *: (const struct ptdesc *)(p), \ + struct page *: (struct ptdesc *)(p))) + /* * No-op macros that just return the current protection value. Defined here * because these macros can be used even if CONFIG_MMU is not defined. From patchwork Tue Jul 25 04:20:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325717 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 C917CC001DF for ; Tue, 25 Jul 2023 04:21:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 590726B007D; Tue, 25 Jul 2023 00:21:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 51938900002; Tue, 25 Jul 2023 00:21:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BAD06B0080; Tue, 25 Jul 2023 00:21:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2DDE26B007D for ; Tue, 25 Jul 2023 00:21:18 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EA7E5C0C4F for ; Tue, 25 Jul 2023 04:21:17 +0000 (UTC) X-FDA: 81048834594.14.33A56ED Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf10.hostedemail.com (Postfix) with ESMTP id 282B9C000C for ; Tue, 25 Jul 2023 04:21:15 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=p9s9prTX; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258876; 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=IUMUqbW/uAIHfn0G4toP3JCuPKsaNgXF+JjYaBSaBaw=; b=EwEhFv1u/gkdOTy52+FYX2bQobdNITF7bYfd/fDu7I4mw7JXLtb47sRKUABW+NssU3Xlve pBHg3rugBwrn9ZBR+csZBzXsUIxjWTmVo7ZPcED/QW8TicdSMBdE6WAuv4tiGGDgXJ4XrL 7zDD7ACJtBFEWxdsj3QiKv+uoxkz608= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=p9s9prTX; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258876; a=rsa-sha256; cv=none; b=p2HeYlS805BhnnTDXWlla3CKb3gQxmJ1k8he33SWbusnnIF4NeRvVFTFsjLnnO9YlmxTJM MBJXEfHzuLknaFcLh9jL+EScXi17aJzu7jmlCggr4hn1OrJGn/xFG7cmWXrJ/2cBnRrRJ/ IC6VRSSs1VVKb7pkA1qUalzKcb4pQDc= Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-c5cf26e9669so4296594276.0 for ; Mon, 24 Jul 2023 21:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258875; x=1690863675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IUMUqbW/uAIHfn0G4toP3JCuPKsaNgXF+JjYaBSaBaw=; b=p9s9prTX9rn/wpC0IRJR9+orYvMKxIQqYiO/2qc1ucIOxNaOErt5vfdpNKxEU6T/vv +2unp610u7/KZK91WoTQLcBH/VtkD3XUQxHC44CLkqpLaHmHFzgBPOO6uWyO/3jX9Xgf 76GcUW4UU7BHeMr+SY/V25wW6PaanozuCo4EhC7wsdhYIlQKIrWatw16Z/wgKznB+Orn ruoMSNrGoRWxyM/OJxGteQSORJl7RZHeZVq6QR7pMySplhmG3+tZ02+FH1KXAFJgXdGU XCaHvNOv6BykhfTtnLqNaZvGHZmQ1vFu3nRlDk8gtK37Li+LTW7MffEEWNWOsyB37y52 60nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258875; x=1690863675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IUMUqbW/uAIHfn0G4toP3JCuPKsaNgXF+JjYaBSaBaw=; b=GBsq5YDmWcqBlE11wHwfVlrSeNaCAzNAW7xu2Szmo8vw4tN29u+iWZAzpo0m66hZHU ouNJH3VgMaBp5iAk5WUGifTaa72pjkGb3u6oLPQInoIywvTo+5DkKko9862C+6Ewg0V2 nMvmUTV07ZSRmooTtuYkeXAfcMUjecu++GR1OKchnDMBvFjhq7IwKf3Shz3UZfHefxMr Pofhk/3kBUyEtIlrRdUc/IGV0Wc3/GZQAYB8a8h2/yh74cNkSE95ry7P7tUzZakU5Zpq a6QRljgy6DEnX3Dfaef+DZDrulx0L3rEQ3o9Wv0uvh5LrHKN+wCTaOZjNiKU+HeLGx08 24qg== X-Gm-Message-State: ABy/qLaIAaEmr3fmPTPJHzLDxNCIr8u+A0qB9IXB8lmpAr7dn/vhpBqJ LQrS36D681th89AVmW1kgss= X-Google-Smtp-Source: APBJJlEMSP0J8OF6O819F/tTFVo5KNWedtuWn+u3qsGgdRhWZk0PUYcaZVFlVCsLViSNb2GRnqh20Q== X-Received: by 2002:a25:6b45:0:b0:d10:68c5:233e with SMTP id o5-20020a256b45000000b00d1068c5233emr4343866ybm.60.1690258875202; Mon, 24 Jul 2023 21:21:15 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:14 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 04/31] mm: Convert pmd_pgtable_page() callers to use pmd_ptdesc() Date: Mon, 24 Jul 2023 21:20:24 -0700 Message-Id: <20230725042051.36691-5-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 282B9C000C X-Stat-Signature: r3annyre7za1fpop3fmda8jy6xbbezbf X-Rspam-User: X-HE-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L18eEhE8akPvu3Vttgtj67fCxMpAPBXZn4MmlWuvu8hgwEBdieuyxdU5bc/pV9e0lKCEBthqQkHJ3/PNBH9K/iWslSLfiVjFseiYbYI45TRqgqB/aPIPesbsbAHIpAebLQHwlu8tbRbzxjErIllQmY6zjpc5TqKTTqUjQXfANJvyUswCqnad4AXic1sER6WIKg/+rSL499Vj+dCWbbm4F7L91rAeb1gcbplsCKr8zLfdO5Dkv8le6yjcQkc0cNpaU8GSt+W3KE6tgBH0awNzVyTQaIGwjAD4hnCMs2eZKnZxL5t6HTr2qFGeuWejn3s3zwzKWkHMpDm/i3MB+ubiRFL2dN7bUpOhIFKE8m8kkBTr8o61J/e+WV39QXiH/hT9S5klXdXBzJVg5VqguRAmptFD/rSW+GynJdyOSAY9s+NsHkVin2Za+WoUH9wiVl1WoSVST/jtOC2bcnHZAgohM61fQfumOEROVVYqYY6CGBGnOTSNAs5GlvAWYKXGHmsLT/pwRbE9HGWP8/3X4JBwMDW+1E9gKM1tpthbbnTk/Wy4xqVAhOuOF/KiCuVtUwODVhDjNzzCHkgWbeEOkQCpnxpM= 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: Converts internal pmd_pgtable_page() callers to use pmd_ptdesc(). This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 3fda0ad41cf2..bf552a106e4a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2971,7 +2971,7 @@ static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(pmd_pgtable_page(pmd)); + return ptlock_ptr(ptdesc_page(pmd_ptdesc(pmd))); } static inline bool pmd_ptlock_init(struct page *page) @@ -2990,7 +2990,7 @@ static inline void pmd_ptlock_free(struct page *page) ptlock_free(page); } -#define pmd_huge_pte(mm, pmd) (pmd_pgtable_page(pmd)->pmd_huge_pte) +#define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) #else From patchwork Tue Jul 25 04:20:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325718 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 BE1F2C04A6A for ; Tue, 25 Jul 2023 04:21:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 51B5B6B007E; Tue, 25 Jul 2023 00:21:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4CBC66B0080; Tue, 25 Jul 2023 00:21:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31DC76B0081; Tue, 25 Jul 2023 00:21:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 21ED76B007E for ; Tue, 25 Jul 2023 00:21:20 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id EAB3FA038A for ; Tue, 25 Jul 2023 04:21:19 +0000 (UTC) X-FDA: 81048834678.03.2CFEE5C Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf09.hostedemail.com (Postfix) with ESMTP id 29789140009 for ; Tue, 25 Jul 2023 04:21:17 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="gPFq/JoY"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258878; 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=hLtCJBysrabsGyMeKlbK2lKTjEzHhmjaMpElw0hOQuQ=; b=0GblmfU5nZnpdrqUAOnj9sc1evkSPbXmltyHr2jVWb8hxwaJSFab06CY6yHMX8ty0Jb+Yo NV2DJ9TIZKSMH6t8k2kzUM1YD3Cj6Xiz8XzGdi1yEThLjWYDtDEupNzwH/4v9cGaGRtc6F WeOxYt4Z9GNJkv+xvhAnOv1WWiYXW8M= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="gPFq/JoY"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258878; a=rsa-sha256; cv=none; b=IwZb3b2URh+sd8DUGbHBF82DMCfiBH3z5rBL9XeX89eqgXNlFI3zRmxNZRtuxlYWEiTYF6 M/Xpi/vSGZpBXlbt2ZyE0ezXSRSIOxXoHvAOuHOLYVbRj7g0pngZeT6sbK75rrf0hag9L8 6WeZ1aV1MU5QGDfYZ5Qka3dbwjlrazY= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-d124309864dso1372603276.3 for ; Mon, 24 Jul 2023 21:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258877; x=1690863677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hLtCJBysrabsGyMeKlbK2lKTjEzHhmjaMpElw0hOQuQ=; b=gPFq/JoYwJjLf9rVCoB8Lw8LOssqafkFQKm1MRAos7/YFfmCVQ5zZtnC0rhhBdQCXk N7cP2rb2Gc3I1sIFDEA6WDVqpFvuzV9g0ksMwxcFOLrW1SrVCbGbF2JEMKH7iGrlo6kh szCDqr3K9qHITaCMG+6I4Bv2DGuidVlNjZotb70C80Hqf3ER0SLHbbdax/uMFjYuJbcP w5E647QIdwTWza0fMIXSMCOI01eppzdj1zv2JddPFf9pPmBUxHnIhf/jhE5I9HeeHTOn pGU0qrcAaECYa9O8B/YJzvoVn8SSXjyAEPRTA5PEQfVza6O4EJzAJ9koweASwJRx6Tml xocw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258877; x=1690863677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hLtCJBysrabsGyMeKlbK2lKTjEzHhmjaMpElw0hOQuQ=; b=FzsnGXdKTx3oISPjIItwBFl8BNQ/5XP43LLl1LtQR0VwMJRtseS12qKnXB6Stq46Ac D6bLvezxFj7/WN1/rgxMdg6U6npZWEjhreuLLMhoWq2X0s44ql/4A7t+e0SB7iQI/vxn I1AljAft2pyjzw+8jwTE+oQiTKQ+BWzPtHRHwU5MwmiSrm2/kgImzyR2PZhNNfhYVbR6 xHLuDJ7vqmz4wiXdCg44lcTjMpvmWxu9ruxlTKM069kk/4jUHjiEJH08Bk/Kqc5AxO1g 0L1JxoLtU42xEXC2y4Dw1eK/ZWAAgTwOiRDMw8bbDaHkh8t1Cu0F0yjxKnVSzqVO5vq4 1vzg== X-Gm-Message-State: ABy/qLbBdl0iDTzwW0KFWsFA/cTGcGX5fjtiORVx56l8n9ZR15PxjPxz Y5B6hnZIy0xwaZlc8gRJfWM= X-Google-Smtp-Source: APBJJlHyqmJ7X8HSspT6LddsJqdqN9Il/WFvcTF4BUwycttfbECYy8j8wA/EIsdExukzdWEa0jT4RQ== X-Received: by 2002:a25:4cca:0:b0:d01:52da:9625 with SMTP id z193-20020a254cca000000b00d0152da9625mr7877273yba.13.1690258877265; Mon, 24 Jul 2023 21:21:17 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:16 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 05/31] mm: Convert ptlock_alloc() to use ptdescs Date: Mon, 24 Jul 2023 21:20:25 -0700 Message-Id: <20230725042051.36691-6-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 29789140009 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 6pi3nxdam31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wnc8rtgrMZhq+ZU12YEeutzM1pd3cOWb8/iWNUjQJSNfwTrgrqbfqlH8P/yj1Py1mX1+Mms4DlEZKKwP1PCEGluH61FrM+aZIKGq+lBm8FXf5yqbDSUEUrv6Ack0ACVQUjQ98sIovzC1WQieORKfeuEn3EjkacERsQNa2d9cp8hgdrTzs05A/USEMSu/OcA13a1iMno6OFkd4kG/LYFBX0fJhVvJlFMJzheTHWWxJZw3S6JdUhig1YwMjTk7U37lD2RcmfZaWzP6cwvdJdo8rWvcn8ms4W80mjKYnG38CNnVPfVd2awagWlHtscqbYj/Tu8+Sg+v5HsmeiZDt6OCsQ3vDaHvmUV6P1AaFSxJxFmnO23/CpANjfyjFTX/TwGQubKVRWd7hN0e0ADzSnq8tuX8HOBGJx94Ai06vHEpQ0jidMiSYBpm4ra1RAiZ7LuWdQTAFmqL7fa817FRWLHYTKY9ui03yeXndB5THQTa8vTCaHnATOA+X6B2POeClAb/fP+f9Uy6XpSY90WC+VP1FYJELX8fmCFDS45VUh4p/4+2U0VDn8ceM93VV6eHPWjajDWuWhXQPVoE3NtkDm4L1XewSMWLwp/yQcArQD+T4RoxMCw= 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 6 +++--- mm/memory.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index bf552a106e4a..b3fce0bfe201 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2841,7 +2841,7 @@ static inline void pagetable_free(struct ptdesc *pt) #if USE_SPLIT_PTE_PTLOCKS #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); -extern bool ptlock_alloc(struct page *page); +bool ptlock_alloc(struct ptdesc *ptdesc); extern void ptlock_free(struct page *page); static inline spinlock_t *ptlock_ptr(struct page *page) @@ -2853,7 +2853,7 @@ static inline void ptlock_cache_init(void) { } -static inline bool ptlock_alloc(struct page *page) +static inline bool ptlock_alloc(struct ptdesc *ptdesc) { return true; } @@ -2883,7 +2883,7 @@ static inline bool ptlock_init(struct page *page) * slab code uses page->slab_cache, which share storage with page->ptl. */ VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); - if (!ptlock_alloc(page)) + if (!ptlock_alloc(page_ptdesc(page))) return false; spin_lock_init(ptlock_ptr(page)); return true; diff --git a/mm/memory.c b/mm/memory.c index 2130bad76eb1..4fee273595e2 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -6231,14 +6231,14 @@ void __init ptlock_cache_init(void) SLAB_PANIC, NULL); } -bool ptlock_alloc(struct page *page) +bool ptlock_alloc(struct ptdesc *ptdesc) { spinlock_t *ptl; ptl = kmem_cache_alloc(page_ptl_cachep, GFP_KERNEL); if (!ptl) return false; - page->ptl = ptl; + ptdesc->ptl = ptl; return true; } From patchwork Tue Jul 25 04:20:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325719 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 E4621C07E8F for ; Tue, 25 Jul 2023 04:21:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 765596B0080; Tue, 25 Jul 2023 00:21:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C6816B0081; Tue, 25 Jul 2023 00:21:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 519016B0082; Tue, 25 Jul 2023 00:21:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3F17E6B0080 for ; Tue, 25 Jul 2023 00:21:22 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E86FA1A0B8D for ; Tue, 25 Jul 2023 04:21:21 +0000 (UTC) X-FDA: 81048834762.22.5579EEC Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf30.hostedemail.com (Postfix) with ESMTP id 236E98000A for ; Tue, 25 Jul 2023 04:21:19 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KDYHcYEd; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258880; a=rsa-sha256; cv=none; b=oK0Ou32BLOK6wgSATKn58B4OU2kYNsUqyRpYPoDyKbyFrjOE7EIgqTUOG+sMvfn6nastKw +5msLIpz/Safj5Iks4NG2rXGWY7TVXREdzF6xk+ei/Xy3OroRpJuHdm5uKGRlu24lL69w7 E8EPX2xNOjuwHIbsAJwzDrAR6NKmOOI= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KDYHcYEd; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258880; 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=uNVCmnQN0ufsotHop6mLPsVoSXSsgvYy2QMaIqEOqi4=; b=U4vWh6MvvxyvRPzeSmVVDOC/6Y43oS76QdtwYkrLZFSLO1/7E7h7F+LIFSnwa9VRieN5vI 3a4ZjBAaIV341oJuYhlYWvbQv9Q8WcpzJqcmbOTQnhzDgx9H2nmQGNXu3loeGpDOY8OorL MwigYfbVaAlEKuReGsRcksqJsADnmo4= Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-d16889b3e93so620351276.0 for ; Mon, 24 Jul 2023 21:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258879; x=1690863679; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uNVCmnQN0ufsotHop6mLPsVoSXSsgvYy2QMaIqEOqi4=; b=KDYHcYEdfvpzUEFX0lNkksdcmQYTfb1isarY0fEljmc2IAYrJ5nDDg/7JZU04JTP3L c1QFP/HGIvTwW+tPYnlNpNTf+bNvT4Orf2hELyP6ANZ15n2MuBFPHNYtsv0S4hi5lotS plPoF0Qd+eEXR5m8DnmPEfjKpZQYq5r/wJZjYdNGeMiNfjBcVsPF+85ffm8Hp1058zGf E5mhpdv5sROIr4fRE4AWEGFCJJhFOSPgScin1k95zzp/7dsKEN0qwGECqGpXVDa6nTcU k6so3Cygyv6WxOWRYm0T8muDY8KTb9y3edYXGJvaWKcZYnoxLAplBnufWrEfQhIBMbq5 IGpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258879; x=1690863679; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uNVCmnQN0ufsotHop6mLPsVoSXSsgvYy2QMaIqEOqi4=; b=PRHMRQIvDg6ItY6rxN41+3hgFip/Bj80oW15C4+k0jGKrGbxWdsC8Zj8H4adY92O6j GjLK9nKOXMAvqgirMqLpMZCq9aPXETRRrAQDcygKcbxG1CiLHePR+CEmlPp9xCCfS0SA xLiR848Jyz9qC6oHgG33wDNWjT9PyZ1kqGt1792XpucAG+ud4i0qf9lL/kNif4qc9h3L pgFzFmp4XyVHztkUoe3i7/8YGHqG3WR1p5BgMgC/QCjgNvks0c4Y82154vX/SyaptXQt 5bMXEwOX+f1LsJxGFvyQaoAUwlKlmA42uPHGa1kwXtBTV7HTpFh4HAF7SnvruAIYHqX4 zg8Q== X-Gm-Message-State: ABy/qLbXJ/S6y/gKCK81Puu+evKXswupEAmq6/aqhwsocF+nSlVtlYs2 b1fKc2sfOMkd/PbOX40iVes= X-Google-Smtp-Source: APBJJlEiFrFEbevAO9Lv8rv0gB/m4nTd0LDSBWnZ0KZCrLtO0+gMBzxp+Bweq5U88z1Cb1Q1T0NNwg== X-Received: by 2002:a5b:cd2:0:b0:c1b:d362:4b49 with SMTP id e18-20020a5b0cd2000000b00c1bd3624b49mr9588966ybr.50.1690258879241; Mon, 24 Jul 2023 21:21:19 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:18 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 06/31] mm: Convert ptlock_ptr() to use ptdescs Date: Mon, 24 Jul 2023 21:20:26 -0700 Message-Id: <20230725042051.36691-7-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 236E98000A X-Stat-Signature: bo11pmad6uzfrkuoc5qzcakmjug7r1rx X-Rspam-User: X-HE-Tag: 1690258879-649339 X-HE-Meta: U2FsdGVkX18u6ruupqFa3upMM5LDzdKkkkObvBX1dQHKx7QuB8A1AzqAXgTSWHw90i5qCcJPHF47gTonKhCEf4uYlCilRnc+bpEnCl1k9FXlrBjnXcrF5M5/H3EmbvNfgyPYAyUKQizTeDORXM8H/9cy72ox+KNR06Ka2EACUJS1z2kZeu7xvmpt0CqKjA8fhsh9VCnAIzxcKQdMjpM2fhTk41hiZ5cro+IDGVxxRYemQa40uxaITt2KLAkRZeR4LBtk8vnAsTjYg0xAaJUSspSzOnu3kVRuMOh0dimiSwNd1QrnsGxP9volOj7XqKuU4i6Vli5cNxu0guaKzHEMC30d+DhTNJS/lK4dHXfd3t+Inz4QdPAezSQ9g+dFLCMD4vO1eejW4pm69RTOKYBRZ+xd+PCIDIpay6JQxUdEza8btHSmnp/526kvGFy4hefaLsP5hFfXftXEcm2IAo2+6VKVD7OD6ayNETBP2TqTrEuLV9EGeRv+poLSQukcSeA7n078kp97Z/7cViq827jd/R+8wiOK5dDc4WacAPQL+iLHUMLqoanSeZ2ekoEnhRZ0NpKXCtzjtG9kpuwroHSYgYnUE/MsgINHu06Ow7WKgoZIBMGCm3ShS4eyYv/FDRGGZTM7FKQiXDwG003t2+TNo9ixeKOGmoEhKDAVKNuK4K8pUz+g84aWiUgHgUTVdoYmBYR7451DO7aQPjx8UrrqJcBEC7fJo1XNawb6/o066RS8mUlnXYfrMzepc1JJiTTCLV3vrguNJsxn6W5IdgE5t/uJPzVxKIrwGryvcoMyyAfr/6u6jr5BJ0ZVtg8xjWhgeNXTwCBSTXrlaHt436YPEz+qLeoHRUHELmI3Ev0H5FLXMnqEkL3z03uxXI7383MKBE+cdlE0cVe9og+b6YkmzznPLI9uA+Akkjix5rt8ibK4CXOM6xGCfeWV85nFkJJwOxowBeAPnHJug51hRbM eTkiJ1n6 wO/gu2SY7BmGmXNIvzkaN7kNu//MiXFxWyO0hxPpHJO7rSiW1GBkyqO3C/7GBZivZ5tghvJoCxvxbhCnG6qidyrzGMxajjqv0cMIFoGQA4bDi/M8n3B4yW1vTsxvfN9fUZ7UjwIZStRVvPTa4sogR5nhEPsruceuZo/juoXWxdH50ZznGyOl6eJWMQszV1qOK3ALiboIQyJom6WCLPevd8Af5wCb7OB/8/b2WjHZed5RtssIdQur15T1eOaqZJVF9q9s5WC7Q5pGSvaDVAjLLOQg1uWBXFJDdgYJt79rhcx1hzj24vFC79oNUQbdiaqzVSf32wervWRA8xkBC5nXhHYQGhcYUmjoxfi2Jk+4THb+CYnfcM4zRiC3V8AW8oRPZB4Urwln/0mp5nRdcSgOxEzzdk5aNiT7fXb1MO9MVro8WavXyu4BHilsZQ+vt8rAPv8eMb1Ao9/Srg5VMhCQuPpry7NFK7Eabzmt/F+hHNyy6ZEEE7AbI+QMlDLESfkr5d1GZY9Chu4LHU79sW58dw9l1gXlGTD8B87LatVHH972rK56PaEnoYIPAn/bX8QRsTiALzaOFHRx5M4AphMaTsi7Wox356FFB/lmo/L7YoxTZhXP89vFStssHFQ9sSJAFp5qCACoDD2ZSRQs= 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/x86/xen/mmu_pv.c | 2 +- include/linux/mm.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index e0a975165de7..8796ec310483 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -667,7 +667,7 @@ static spinlock_t *xen_pte_lock(struct page *page, struct mm_struct *mm) spinlock_t *ptl = NULL; #if USE_SPLIT_PTE_PTLOCKS - ptl = ptlock_ptr(page); + ptl = ptlock_ptr(page_ptdesc(page)); spin_lock_nest_lock(ptl, &mm->page_table_lock); #endif diff --git a/include/linux/mm.h b/include/linux/mm.h index b3fce0bfe201..c155f82dd2cc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2844,9 +2844,9 @@ void __init ptlock_cache_init(void); bool ptlock_alloc(struct ptdesc *ptdesc); extern void ptlock_free(struct page *page); -static inline spinlock_t *ptlock_ptr(struct page *page) +static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { - return page->ptl; + return ptdesc->ptl; } #else /* ALLOC_SPLIT_PTLOCKS */ static inline void ptlock_cache_init(void) @@ -2862,15 +2862,15 @@ static inline void ptlock_free(struct page *page) { } -static inline spinlock_t *ptlock_ptr(struct page *page) +static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { - return &page->ptl; + return &ptdesc->ptl; } #endif /* ALLOC_SPLIT_PTLOCKS */ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(pmd_page(*pmd)); + return ptlock_ptr(page_ptdesc(pmd_page(*pmd))); } static inline bool ptlock_init(struct page *page) @@ -2885,7 +2885,7 @@ static inline bool ptlock_init(struct page *page) VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); if (!ptlock_alloc(page_ptdesc(page))) return false; - spin_lock_init(ptlock_ptr(page)); + spin_lock_init(ptlock_ptr(page_ptdesc(page))); return true; } @@ -2971,7 +2971,7 @@ static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(ptdesc_page(pmd_ptdesc(pmd))); + return ptlock_ptr(pmd_ptdesc(pmd)); } static inline bool pmd_ptlock_init(struct page *page) From patchwork Tue Jul 25 04:20:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325720 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 112F0C10F00 for ; Tue, 25 Jul 2023 04:21:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F8CB6B0081; Tue, 25 Jul 2023 00:21:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A7E66B0082; Tue, 25 Jul 2023 00:21:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1493F900002; Tue, 25 Jul 2023 00:21:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 027686B0081 for ; Tue, 25 Jul 2023 00:21:24 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C7B1F1C9BEB for ; Tue, 25 Jul 2023 04:21:23 +0000 (UTC) X-FDA: 81048834846.14.1EDE273 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by imf07.hostedemail.com (Postfix) with ESMTP id 0FA1F40006 for ; Tue, 25 Jul 2023 04:21:21 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=jYui+PKK; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258882; 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=d0E0BACLvXh2vpBt6imfUOZqEuzu1odD4oW+AaIJCus=; b=uljBv44sB3+ptJFzPTEvnvWh7o5So+tMplmg7pQrYlrsd2Zo9vU8P3chBSlYKPWJb9TYin tR+kv0zXA/fq/o69WaqHqbfT2JmrCltkhe1ZgSVXmDBg8C4tpN3vZvqxKbWGKQ8C391SRY SeaR7rCkD5UXx8i1hD3lBiVWZY5kbx8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258882; a=rsa-sha256; cv=none; b=TlNMz0spiXhARZ8BgbM2yyJJLDrcG9QyiN/oREgUTu3KRi1d234LmufoOjCU1xSe+sb1m9 Qk0fuyDJ/DmvGoL4vblDS1XJ2R45KV1f3vKlZ6kJ+R9CXhVFYR3+4h+v/a0YOCR8pCnqTU vLTxea8KLCblq8qSogE9gmGQz24H3sg= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=jYui+PKK; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-d05a63946e0so4083538276.1 for ; Mon, 24 Jul 2023 21:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258881; x=1690863681; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=d0E0BACLvXh2vpBt6imfUOZqEuzu1odD4oW+AaIJCus=; b=jYui+PKKLrYwW/9bkeBCxZuH30ZLFCfjk6k83i08YHGZs5qBvg098warmUkrhehPA7 w4YGyti6UCNUragO2itKU02HUpV/ViBpQF9TFUZFW/NNv47MTUMBLJ+3J2/znigqsRJs QhHBOUaU/0pdlJBDEn1DtnKR6Jjb52zcMeUqfdcetzMdFupe+5WkVJfD4fN5fJJOsgL0 e1lfCQXQItA0Ro7t73ofq2YB2adhnzcCWoT2HIbviNcoaPhOqdkOZB4a44aYijkjfd8z BHV0Z8ytCVZzLV7QMejslcSqJexW00RaRFmpSqinl2bowLcrU0F1887NS/OPVowYeO94 sAOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258881; x=1690863681; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d0E0BACLvXh2vpBt6imfUOZqEuzu1odD4oW+AaIJCus=; b=IuYH4rv3xb5bpeciRAoYP15sGd0feACUSGI69aYILs37ysDlrESgeF63F4fZPjj2at ahZkTv16G6BgF8JLedQQxRa+xqB67DJsPebbLgz3l5Vvb4RIUI+qE7OM6z6dnojcfSA8 4Y+/At3TdwCoOkkxLzowEi2HBeuz/GSLDwzDDCiz5fHVaJCcuJrf4QgqHTnHVCIdRRYw 9t6FLAUX8aQ+P1OfoQJFE6ewQLUWoU/Dk6z4UDUKJsAr+SB8bMpgQojJxO3lvkypWYu2 sQ1Ie3HZSwAppA7VJnyDbVfPHWo0OrzSYT/2m82oG5myn50uif1ra17vj4O7P/o4DzPq bYcw== X-Gm-Message-State: ABy/qLbLTd36c/UyOO/z7Pd8IyMJf2INQ1F2ZP99qYGmtabYoouhvuvW ewZT83sRKiOYZQmyFIJRPBA= X-Google-Smtp-Source: APBJJlGCGmZmbOTlDUcCFEi74mEzBDVKNi9w9+0D8ZZZqBiNJxZc6NQL85g34qQbwNZIlG7Tv+r/mA== X-Received: by 2002:a25:356:0:b0:d0b:ed07:7f56 with SMTP id 83-20020a250356000000b00d0bed077f56mr5325321ybd.18.1690258881187; Mon, 24 Jul 2023 21:21:21 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:20 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 07/31] mm: Convert pmd_ptlock_init() to use ptdescs Date: Mon, 24 Jul 2023 21:20:27 -0700 Message-Id: <20230725042051.36691-8-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: mda5r639e3btjntfnsnnq71ytkoujtbj X-Rspamd-Server: rspam10 X-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YMc1G0Ge3C8NnYoaSHqqFv3SFM4wzZehA1co78DeFXYpQ7YnHir+vOSN9TXyC9eIwbbEnNnHMy8QmEHZhhTg5jgVjWFZdXZfdx+aMmn8cvxSu2MEzS028kTjk5qb3fq3KoZw2IQHUScQio36zxreLZv7jIShLmNYa7yI8vT7TMKmgy8s4rK1vIhi52PuT74facLfdhE+2B+fWbLGtfhJBWp1cpGhAkiwt8y2NY/iuSQ5eXxVmDIE95TO+xaHARCrjMjhJlGKmgZ4T722bLP9QUR0adtVNfWmT7sUKDGqOUMe3XMIw0dYVBqNPrJwXV6YrnqhW7ZLoyYlBu1gb//DPLdNSRpKrVwiJQ5BrK15vY88k34IiNzAL6ThHSBvop6qGpy4vy5jwySZR6NzQF20GNVXDXQogLQvExgoXRj9rhVWLz0YkVcXUD9bynl9R4gaA3RXRrTrWkdtELnOYycjmlLzmH4HT1ZCv5iHE18dFjxMp/gQeeg7EFky+qcBEA1sMbW4G84EHGIPR8omRVaqvCKAaLMkH1fHRRk6LVoZ2fyeZBXB2BuOi4mngWIEtruSQhfsSRtXCa9f0ByCq2Mzxc4QhDhRKW/t9aZEXThOqfNWVjzZ4Ny8S9qhNm2SpAxbboyjqA= 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index c155f82dd2cc..52ef09c100a2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2974,12 +2974,12 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) return ptlock_ptr(pmd_ptdesc(pmd)); } -static inline bool pmd_ptlock_init(struct page *page) +static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE - page->pmd_huge_pte = NULL; + ptdesc->pmd_huge_pte = NULL; #endif - return ptlock_init(page); + return ptlock_init(ptdesc_page(ptdesc)); } static inline void pmd_ptlock_free(struct page *page) @@ -2999,7 +2999,7 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) return &mm->page_table_lock; } -static inline bool pmd_ptlock_init(struct page *page) { return true; } +static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) { return true; } static inline void pmd_ptlock_free(struct page *page) {} #define pmd_huge_pte(mm, pmd) ((mm)->pmd_huge_pte) @@ -3015,7 +3015,7 @@ static inline spinlock_t *pmd_lock(struct mm_struct *mm, pmd_t *pmd) static inline bool pgtable_pmd_page_ctor(struct page *page) { - if (!pmd_ptlock_init(page)) + if (!pmd_ptlock_init(page_ptdesc(page))) return false; __SetPageTable(page); inc_lruvec_page_state(page, NR_PAGETABLE); From patchwork Tue Jul 25 04:20:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325721 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 E61B9C04FE2 for ; Tue, 25 Jul 2023 04:21:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B76F6B0082; Tue, 25 Jul 2023 00:21:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 51A166B0083; Tue, 25 Jul 2023 00:21:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36B936B0085; Tue, 25 Jul 2023 00:21:26 -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 28F976B0082 for ; Tue, 25 Jul 2023 00:21:26 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E59EFB2439 for ; Tue, 25 Jul 2023 04:21:25 +0000 (UTC) X-FDA: 81048834930.03.16D6BB6 Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) by imf19.hostedemail.com (Postfix) with ESMTP id 16D2D1A0004 for ; Tue, 25 Jul 2023 04:21:23 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DwndbpJ6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258884; 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=iy/rMhqpUcv/05FOZn+4srvOxwPFLEA5us+pK4Rb6lw=; b=sBTDFaymudGGG2HXN+0E9XtFdrV22B8skMuTuRX9aJH9XJcwNCa1EtWMvHr6ceC7RNrfy1 Opb5XrpQs+FGPkCNHtxFsviEG0AB05ZUtf4aE119d69FIdVSxRN42IhZBpRu2amstJCxyU 8H1Gy95Q+bVqxf1gQiTYvnsojGVXgCc= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DwndbpJ6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258884; a=rsa-sha256; cv=none; b=7eSo8o5AIuDOrL2BERyqYkIJsq7ZoUUqC25b4yFqHZL8Hm1pSE78hOlA8DvcjPsrzG3z9A 8TQi9xS6IHa9SoTcJVSklwg0LYX97S/ZoFR0IoOpC0t53QFUM6ySj1Bk+DaW4iRN2xHKFu AxYv+eB1RzaaeCGUi6Fs8O+0Smk0X0o= Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-d13e0bfbbcfso1761724276.0 for ; Mon, 24 Jul 2023 21:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258883; x=1690863683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iy/rMhqpUcv/05FOZn+4srvOxwPFLEA5us+pK4Rb6lw=; b=DwndbpJ6ZJrYKMHpG4xKikBhk7x+krWdi68yaEUskEkiop40SD81D3SbVY3seOkRYX /kBw1kbEHeLJuAWxODh8wznz3CeaeUpUO4YYOfw0VBoc804gVI4mMhkv5lDO7g/hc/Ox TXEzhNof0Ms0qo0Det2yGSzvCCxAKXVShq3qZYqhwj2d67+5rTird7vmREAL8b8Si8Ac tOq0IFFx/OCdHFNMMX58/9jGd+Cn0j6BluiHfy+sp+cwHgX7LWNmOOEbAbHaR8hHlJNg plgZtGI8EoaWjuEjbu+IQ9bgYRh88XsoYPHoE7Qno7Yp+zMkk++OeXafcS4wt+s+lSyS wNUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258883; x=1690863683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iy/rMhqpUcv/05FOZn+4srvOxwPFLEA5us+pK4Rb6lw=; b=IUlTFprhnWjZ4l1H301kYnaMq6obI3ciMRBaQ0Zt0+Ln7wII5qZyEgWZKexKE94lIH f7iSQhJ+bAUmtC8Lgyz5JWk1XOcQba1Htkd7BnBCw8OgIV8sAn+NIuGcsMVjzy3w+SS6 f+T9hfJbG12FXEvvn8bu9/KO0Z7oqiBTkDwbXXz3ksqgd0lm0P0TCfYjHgE+ZAqYxARi /xlhiBw6Rriyre5dj8xNxF/zNQsjpDCEAPXWg/vqRnBBsNvPQT1eQEbGFejTBU38KvEh zc+aPNzgsGvQUoyoHoFskLSv/Xl2jmmGTCveNMw4QryX3OkmP5p4nWLNlCFnf5XP2qbT gBlA== X-Gm-Message-State: ABy/qLbFuH+vXGQpamtBhCepNQNS+MXkRVm5VzrVzCGMR8+gicJvzlfl 0eW8lO7nhwiup0mnv18opUU= X-Google-Smtp-Source: APBJJlF+SF4cjauiYcGzSv/LhxAh6sYfbdxhzn585BID5O/OlI17XEMKbBKdqUp1OW6pVPf/RqCKZQ== X-Received: by 2002:a25:908e:0:b0:d07:b677:3349 with SMTP id t14-20020a25908e000000b00d07b6773349mr1259438ybl.25.1690258883131; Mon, 24 Jul 2023 21:21:23 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:22 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 08/31] mm: Convert ptlock_init() to use ptdescs Date: Mon, 24 Jul 2023 21:20:28 -0700 Message-Id: <20230725042051.36691-9-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: m3geqk4counuiqfhn3m1n8swp6iobf8g X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 16D2D1A0004 X-HE-Tag: 1690258883-798659 X-HE-Meta: U2FsdGVkX18AdiQ+PpYFg9122Vned1CYDxBS9onAj9FGDQhhcFgtIBt3E/BHClEIFaS8QYqLXBhP8uS8T53RQmq/QhETLJLlafVPmzlNz6Nw8sbqaI1bEFLshUHehul030jsYP9WfgmxCZNP2aenh160GtY3kuaAsKGD+gGcKAG7Fj+RId1IXbr4yTzOJVZjX1kqh+mOZvjacdvJuyISNebJj7A+x64GJoVn/XK28zfCCRBWuenLIRT9nszu1Ru5Onb6xtyi3u5ftUVa8Wyj4zpJcL3XESi3fWJu7JyJ1qdIUiDtoInkXOtjA7knmb+DBozgNJzgQF9VWnWCmSrAJ+IrO0eQQcoN0lBJ50taKj0ryFbjspPH+GtaV8FF7eeT3NzADJ5n1TLpUYsetCDyIuVqtlDSqoEv6+Cr2Alt6nBpEDOc0Abo2EkOcaxPrV5tyhTIQPR+XPirlufwDTYNyzR/0Wt94JXFBKykzepGR4lDKbPwqESWeMJDH6sJ9Or+rktL11pOGKdkR38/pkIZjtw6l9bV0c9xqNayg17NIG3f9qJb+8nal9fUXTdy7fYTn9beNHBVSEOIKH8THGBj9pkuuZYGjdtfv/RmlOlpQy0r4nAu6JaYAnyqxradYxcODGHeeiSUc2HGHdDFSdCF+SF2BzkBuUxH2goEmHtEfyFhtTiKFvkmyElkUKyCqlWhICZy2TqDqclm1pu6IVhdHvwKsOulcpNYrXeeOTYx9YWWcrf3fg7YTLRwifmy5ipnf4Rxa8wOxZNlMlxdrdr/jteKVfpa+hw+2l8bRKv19h5xS9XjqKGS736FvFBxeyEv2resvMz0tXCRLxutLkQGif9iWzgkcUxQo/WOBeo0cGLfPPqk2PXQUP8dhofD03HHfva2ogiQcxW0oSHNamz0I1UfvKkH3Cx+qfL1PmYeBUlP+RvJJF6NBmYvzRuIUmevhdxf3ElMVsTKP3Tj3KN OsSQ+yNp XrsBMePLJG63+eTxVth7B6T/haqILsslxeVq8a50KwdC/wqBF3wTwU1AOIBUlZLcB0HPgSkQQ82Zz9ZUMRa7+XhtFfA/C6gY59mRnGFJ/8DtFEfqgaovaD6z1UPWqJwyvP5EZmrTYL8+CR3n40rO0nU1Rkolc7nzq+h/r549U324GXd+q9/2LGmNgy+dBOjpOcbM8uSh2o4NInM49rKlxOZkdbgRAD1KBpWNuMfZsKT8j4IOIC6VAo+3jLG2EWisJAa8+NKiK+Eb8HBnnsybDRIy/vm4jh8PTNotidjoaWYWmhmkepb/GY9egdtGw3yJECV+zx0IjvdMLWsPHcxZ8b8LgYvCkTuYeOwjniZe75IgGt8C5ImOnEJbi0rVkUPE+J6vqIC/mVbU2DybhD+gcx2xM4bZTetjUOB9yE/8dnjq7iRTN6aW17w/lDmNxuqZUT3m+nbbJQfvlRqzZ2qyweV10ZQBjxiDeh7oeCn9wBa6x6Fzpm65DPhF/PWw5bTwS7N8u4hQRcqGV9avgGdkW019jGJoPAvDU3vxFZs5M6HMFphI4JwdfmZcFmPjvHpohVNuqYm/fy1zhyPqAsy376dUs0esZyq1Xt+kZRY2c4xI2KURRn9L7wEq0kpEXqQRchrfAEr9BONLC1ro= 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 52ef09c100a2..675972d3f7e4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2873,7 +2873,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) return ptlock_ptr(page_ptdesc(pmd_page(*pmd))); } -static inline bool ptlock_init(struct page *page) +static inline bool ptlock_init(struct ptdesc *ptdesc) { /* * prep_new_page() initialize page->private (and therefore page->ptl) @@ -2882,10 +2882,10 @@ static inline bool ptlock_init(struct page *page) * It can happen if arch try to use slab for page table allocation: * slab code uses page->slab_cache, which share storage with page->ptl. */ - VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); - if (!ptlock_alloc(page_ptdesc(page))) + VM_BUG_ON_PAGE(*(unsigned long *)&ptdesc->ptl, ptdesc_page(ptdesc)); + if (!ptlock_alloc(ptdesc)) return false; - spin_lock_init(ptlock_ptr(page_ptdesc(page))); + spin_lock_init(ptlock_ptr(ptdesc)); return true; } @@ -2898,13 +2898,13 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) return &mm->page_table_lock; } static inline void ptlock_cache_init(void) {} -static inline bool ptlock_init(struct page *page) { return true; } +static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } static inline void ptlock_free(struct page *page) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ static inline bool pgtable_pte_page_ctor(struct page *page) { - if (!ptlock_init(page)) + if (!ptlock_init(page_ptdesc(page))) return false; __SetPageTable(page); inc_lruvec_page_state(page, NR_PAGETABLE); @@ -2979,7 +2979,7 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) #ifdef CONFIG_TRANSPARENT_HUGEPAGE ptdesc->pmd_huge_pte = NULL; #endif - return ptlock_init(ptdesc_page(ptdesc)); + return ptlock_init(ptdesc); } static inline void pmd_ptlock_free(struct page *page) From patchwork Tue Jul 25 04:20:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325722 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 07F13C25B5F for ; Tue, 25 Jul 2023 04:21:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60A586B0083; Tue, 25 Jul 2023 00:21:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 590DA6B0085; Tue, 25 Jul 2023 00:21:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42ECC6B0087; Tue, 25 Jul 2023 00:21:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 336DB6B0083 for ; Tue, 25 Jul 2023 00:21:28 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0D71E802BC for ; Tue, 25 Jul 2023 04:21:28 +0000 (UTC) X-FDA: 81048835056.28.FC3CBA3 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by imf02.hostedemail.com (Postfix) with ESMTP id 440D980004 for ; Tue, 25 Jul 2023 04:21:26 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=gPlpDfbg; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258886; a=rsa-sha256; cv=none; b=JHNk13i7WjrdDzDKCXxu8gnA3YyW/HOUDCXLfQRdms8sRVTZu89AitS6EGQVP57quL4eoo FhMMDc7R7V7gbhWwUX8o8ka5Op57Zpj8BOy8soToUhTuHq2ay2hm3WQPuuZ6spWOOos7fo Dmro9k/yrt82KNs9z0Maaqz+/IQXYiw= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=gPlpDfbg; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258886; 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=iZ7ozcISUSGoixC5UzzNE5tJz0+L18C1Imj6XmV/DYM=; b=7+YkZ/FgCsHyITBhjN6ibF+3BDuAkVqfDzR/N8BCUK3lmJnoEq8M3O87/6MI3WCA9CxkeX j10MocOGexMjOdmyG0Iw91CzGVPOmRfSRr/wbWcmywcfi5Q2vQ/spFWyIxwjM+AN1/O+EK iCpbS58JONPHmgfzR14u/pGwntlftQw= Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-d05a63946e0so4083561276.1 for ; Mon, 24 Jul 2023 21:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258885; x=1690863685; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iZ7ozcISUSGoixC5UzzNE5tJz0+L18C1Imj6XmV/DYM=; b=gPlpDfbgQUaDh17nMUuxk8LJn1nYdgEAVfSMEcDpmwNJCwXKDaomTlh0BY+xZkFMKd tFRmLrBoE1Vp0IzzPSrF8bgPZVxB+9aP3VrUcSHjKLr+y7jNlD4PpyjtmGaGnI3Rciw5 xPEUpzqKKaVrLEfBMw5DD9c3Ng9G9PKL+n4eQ6Zcvb2wmVEKnYUeBmB54WntK+cvg6UK QgMdLEB/drGqPOPjrgcd99xnUW0qMuGMWDmaVMRTFx92PXfEsSeKT6B4JdtVKY4BOuL7 QKWH8kGjoeg6j0VlgnYB4AI/+z50XhZH+jdg01QIwrxx7GkpXjxyDTkcgrBZeXNJtHxg DmIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258885; x=1690863685; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iZ7ozcISUSGoixC5UzzNE5tJz0+L18C1Imj6XmV/DYM=; b=EkfDxPxC2shCwMilsFQtIZwj72tcRoTS/Dbr2EvFKc7uzmoj1PmepdMO/7GiU2d/zx 2mKiqdu0+CnqG9BY5PjqhQXKidlrERHcZzmSqQ2ir4P6yFmD56MCaBvSdf4kaxQXz3OZ jJrPEtSKo4nPX8I0z9WB46VGvalG6OKlwzgMcc2NRnv5Y4PLNoi86hB4Bt5tCuBld9Qo HLmMvM/Vvs2nQvVk0xSFHf2v/ckXbG5aFUi0OW0gIMApLcE9Q2k00DoGnEIIBeNmoW8H m9u8QLjya9HTO5OFZha/Ts0QO0+UbSkrO2ubLAQgNDiPCmxUcpnWwkfp5AvCwWxN3uWM 1xNw== X-Gm-Message-State: ABy/qLYqPJ2947gOYWYD3E8PoiETDnEjW/lu08zLPLaWcte9p9k/TjBQ 4NQhfyrkS0zUxGwt5P1U2WI= X-Google-Smtp-Source: APBJJlEU2X68Ojav0w5cqMxtXa5ryZpYlhi5g+xNY8vonB7Weqi80FZO/gUhwzOoBC/kjqTB4Zo1Gw== X-Received: by 2002:a25:f827:0:b0:d0e:794f:64ef with SMTP id u39-20020a25f827000000b00d0e794f64efmr4552557ybd.0.1690258885213; Mon, 24 Jul 2023 21:21:25 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:24 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 09/31] mm: Convert pmd_ptlock_free() to use ptdescs Date: Mon, 24 Jul 2023 21:20:29 -0700 Message-Id: <20230725042051.36691-10-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 440D980004 X-Stat-Signature: 51dkdaitmdezanoifi9c3944hphjysj3 X-Rspam-User: X-HE-Tag: 1690258886-521342 X-HE-Meta: U2FsdGVkX1/9ViWT5C/edERQTzudaN0tpXyGFu1wRptAi/B3F4oAJ+Hiyhvrw0j/7N4K/w6zJoojNsrhr1tNm3Q6I17C++g7T0dwuD+7MktQ+9mBI5W3xVx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7DAyXDBgpKXMsmiNz7eKKtyfEk+Sm63Q6+hTFBL5lnmCUcvRntPNzAj4AAqB6nn0qlE8UTLfFw8LZHo/LAHMMO+oB8iek7KjjX6Nug02h9y2JCUXJpSFxrcCqvyhC1G2Ef4xBIhrqhL9z7nEXqR+2cBViZV3xYpm35szSTSU+PvxaIgcA3Xt0hZNWP3P8yiHK+vqT2XsMz7bamiRaCefFsDxUmKOzb8W8TuPvvsvKmfM7fwaaN36ej8Y4ZuQFZ3ocav7Gl1NL9eVtGatBIJpCz6Cm0c4nn5eRZKzQ1C4CxvLteYzO8xyIUW2X1YU0+E3ywP52akU0KvIjxNtjyP96gj0G4YkSGIa8lGKBjjFidOhPCSsGjcgq16W8GWJZjhCA9jE4h+WiL5MxiRd7pMdRq2qK3qexCg1ek= 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 675972d3f7e4..774fe83c0c16 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2982,12 +2982,12 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) return ptlock_init(ptdesc); } -static inline void pmd_ptlock_free(struct page *page) +static inline void pmd_ptlock_free(struct ptdesc *ptdesc) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE - VM_BUG_ON_PAGE(page->pmd_huge_pte, page); + VM_BUG_ON_PAGE(ptdesc->pmd_huge_pte, ptdesc_page(ptdesc)); #endif - ptlock_free(page); + ptlock_free(ptdesc_page(ptdesc)); } #define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) @@ -3000,7 +3000,7 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) } static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) { return true; } -static inline void pmd_ptlock_free(struct page *page) {} +static inline void pmd_ptlock_free(struct ptdesc *ptdesc) {} #define pmd_huge_pte(mm, pmd) ((mm)->pmd_huge_pte) @@ -3024,7 +3024,7 @@ static inline bool pgtable_pmd_page_ctor(struct page *page) static inline void pgtable_pmd_page_dtor(struct page *page) { - pmd_ptlock_free(page); + pmd_ptlock_free(page_ptdesc(page)); __ClearPageTable(page); dec_lruvec_page_state(page, NR_PAGETABLE); } From patchwork Tue Jul 25 04:20:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325723 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 3B859C04A94 for ; Tue, 25 Jul 2023 04:21:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C9356B0085; Tue, 25 Jul 2023 00:21:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6520A6B0087; Tue, 25 Jul 2023 00:21:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47C98900002; Tue, 25 Jul 2023 00:21:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 39F276B0085 for ; Tue, 25 Jul 2023 00:21:30 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1044C1A059C for ; Tue, 25 Jul 2023 04:21:30 +0000 (UTC) X-FDA: 81048835140.11.0F8E724 Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) by imf01.hostedemail.com (Postfix) with ESMTP id 2FB6E40008 for ; Tue, 25 Jul 2023 04:21:27 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=RYLJ+HHh; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258888; a=rsa-sha256; cv=none; b=Vnv0Rt3g0egIidxIhqPq+pprLM7jsfHQkeCW0asisgLeKigUywGEyg1wLS075lBBtsFlYI 3OnGbVpvKBS1r68VadK/2PTEHAHvEJjxThTE2Y3zWb0bC4eDgM6guP/LlDHKfkKaTYVmFj Nh+Rr2aEin8Dhz65PB45GrXRJA3dB+Q= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=RYLJ+HHh; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258888; 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=7EZnRhm4Fj3KaK4sFjI+P1mIVDNOtVXSgVauozi7/LE=; b=6rgimd/5orgpLsudbioHcGDiYUucnoBU3+YXdro7sQ5fYeqJepqb7PAMFXM+sNw6VMMYWe T5o0WPPZXSngN4kkGPrT4Z0yPU3PeHs6gCPEmTPs6cvH0JRAH0ZjdG8Gw0zvW6tZfs7TI7 sBPz3/71BUnfSSHlCTAmaGGD2JG94YY= Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-d0a8ae5f8a6so2876637276.0 for ; Mon, 24 Jul 2023 21:21:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258887; x=1690863687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7EZnRhm4Fj3KaK4sFjI+P1mIVDNOtVXSgVauozi7/LE=; b=RYLJ+HHhZ3SW3XdvMN1AzT9gPBErVqrhuCtcU9fNt2oY7ALxgSJoFkBn6Vm9nhRIfL WiTjjdSQLpNPnjH/5n9WBm6wJTnH8dJRd1NltGEZ286BUnLn7Q2MMvQIs7uIZqTwGdGS eL9nBqdaNLlYe8KWVzFFhBRvhsKclpu6/YA+4Q97+gqJ/tvmMP0hkmlN965zL32r5aWq lGDtyvV+tLl+Z/pogbSTjxnJu1qRtO3WfiwXTUnVp3YPllt2BfK2Izz7z0ivGxPYpzFU UjwvvFWDj18TjEMiWj89EXU3QbdGQMvzZCK7ByPk/vtnFluG2/Q0k/42+A+1E3bms/jl vfTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258887; x=1690863687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7EZnRhm4Fj3KaK4sFjI+P1mIVDNOtVXSgVauozi7/LE=; b=SKr3XaaGxAevZ9A2dymh2Ff6pHNS4ep/m366spGuh+HkdYB8pE+65hAHHE6cDPXlz9 PJZI9iIKfV43rKzVtrVC6juJT4tAbQ4qgvNVE76/yRlHq4K1kQlaOQRRlanIvWfpXkHn 8zQjt3j/tsOW5nuWBmnWk/9Yx0s2Odmixrd4sfZ3phadNnCl8o+dWLa/hGAjqWpExD1n lC+ww196mLpOvuvx33HwrcJ3Ev2rGpJ83lMGjXWqWdqYt1HCbSLdoGCYokvySrH2u3S0 /2TGR/ZuQ5JXocJGxpIX7RpZgLAwl6BJWWVo2ztGYRRzfHJ5Ek/N82sZAlhA5aSOBJwp D1pw== X-Gm-Message-State: ABy/qLbBL0Kt905GGEs1QWld4m0LHmKuV+g6bf1Xcytbpp5CJwEolRet NCOxQOhMPxS7nA1v9j0Vlak= X-Google-Smtp-Source: APBJJlEDrySQ7FY0Or7EcCMVmcmwbMMbiMSaZShCmPSyL8HtQQZFeTHHFjIo1cF+xzs4edAkc8Gy+Q== X-Received: by 2002:a5b:782:0:b0:c91:cc0e:1aef with SMTP id b2-20020a5b0782000000b00c91cc0e1aefmr9011877ybq.58.1690258887257; Mon, 24 Jul 2023 21:21:27 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:27 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 10/31] mm: Convert ptlock_free() to use ptdescs Date: Mon, 24 Jul 2023 21:20:30 -0700 Message-Id: <20230725042051.36691-11-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2FB6E40008 X-Stat-Signature: ojkg3jne4yxt9iirc9bubquj3biokiyb X-Rspam-User: X-HE-Tag: 1690258887-541717 X-HE-Meta: U2FsdGVkX1989ot28f3eJivWIZWNt5cY+rGeqbe3axjeMr7bTMC+mtTnLRXa2gMU/SK1qcrt8dHYYjg2ooPJmddHXXDLGEzBD+4kk8C66P4dpN3kSwfGrQ1riRcAUlIngdSIoGjNdzR9d+NsY2vx/BbFUV1VCoCqZpPK+rD8F9k58sbEUCkcmdpufOTQNB6ohgIDOSWXDmWN5ft9jemSiGuDrPOvBQwwu8nzuwbKat9wRLgn/SRsJr8RCQeTu+guYSgCglSvGMEDHnyMOEQ/3o8Z0+n7nc2omREvLRDFJgolDAreznjJyIMJdD44GA53dshglWDAaz5ZBrYOLVvPI47C8MPhzKoCotUTjwX5iwVJx6Tp7tkDXmSMjTbZ51aWS3HYR6qi/cHt8KRq/EEXQXELaVvtV92kzqrxtrVsbWkZwfvuR6qCEacm+K6xgpGgDkg37FDStkDk3r0WMJhSqTV6uDFYF9qdR7ESCwB7VnDBGtBwqroMRB487SwHXnie7kZ10NLUfin55KQZu453InQKCS6SrWTHBLmbPp7D4OItHCyFzGrpmrc8kaQKrVT3/33Bw+htumIB6dJkFezUN0XHrbqYfDoZQ0zzw0VlAypmebPoxxDPiJPElhUwtQs1bNVd2CXR+lNp7wf6G+Sz6BQ/nrW6+FvSNz/yil+8SwuBbhSBrl8IQsik2dbV7j7aCW7FcjEB9df6VESKu/UjM2sFexJy3dD9EVAHrS0UD0+S6cZBdEHJcuA4n3ZZ2tqu6o6kW2vK40BHFTVmhpuwJ5/dOVMIHQxmzXRe5XA7KK5l3X47AanuMFnejV1HRXPt/QYkQAE/F4n3U5YRC1yQL+8GCb3xFMg9lWH/HSLOpFxpedAlUK//0LMJwqR4unQyBBt1ZOORhb8mr6DLn+8ov4Zqr9PZDAONMOlcCnD3Q4I6vStkgvQJBoN+zNtmKoVapQGIhMrpihRK+F9/W4a 1FhIvKU0 n5b+hkLQVRghD8ssOZg51pRJyh9pJFc62pt8PmUmnVCA+gcNsf8QNK8LRkdQfr4t2EfJW4mGzRB347XJgrohbiUKtmvKUAxJC4CStxakA4JkbylRvThbta0tMznHm/IqUBJdT7wsrOCacMVCDgkaqtJf5srnRFkTvkWBDnK2BVncYbKcfLWKJueJoANTeWisuB/vKeHUIMSdQWLmunExZJsr9tmmU1lVEXdkxc0cUJv8+MA2xMfLZumP/pK9JX8J+vMaCjWR+IFIwMvzHDSUtU5MNRWrXZmXEhXE4d9SWXwy+R+sob2PCJKSS2NPq3GFoyOvceeaurSjTjKmQXhdp5ZlPLD0TUgrHwBXt8bPoJFx88CVeb+MT+EzG6cue2XpKVZTmZikDiMNWGEAK05XHyolgKKeHkgBPl+kX2Ly3VvuGIBWlDe1nUyZQvnOPKLEJZcEEi4mYUp/g9uMxiSY6+kE9lYATZZEH0MA+sriXQ/bXjYkW9OE3LvceGqDWi3qW0rO6eeEHCGV0TqGEbZRRtry2RGWk8fNWCQrlH+aO8SfqeGwlpE7AGP2W9MKTw0DQYUsktbOyJGea8eX4ZMvQV8kq8/wxO852yDGFO3qCGNZQlB6pIhYxlQjcAFvLBPGe8lfHv4NPze7z8rM= 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: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 10 +++++----- mm/memory.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 774fe83c0c16..ffddae95af78 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2842,7 +2842,7 @@ static inline void pagetable_free(struct ptdesc *pt) #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); bool ptlock_alloc(struct ptdesc *ptdesc); -extern void ptlock_free(struct page *page); +void ptlock_free(struct ptdesc *ptdesc); static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { @@ -2858,7 +2858,7 @@ static inline bool ptlock_alloc(struct ptdesc *ptdesc) return true; } -static inline void ptlock_free(struct page *page) +static inline void ptlock_free(struct ptdesc *ptdesc) { } @@ -2899,7 +2899,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) } static inline void ptlock_cache_init(void) {} static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } -static inline void ptlock_free(struct page *page) {} +static inline void ptlock_free(struct ptdesc *ptdesc) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ static inline bool pgtable_pte_page_ctor(struct page *page) @@ -2913,7 +2913,7 @@ static inline bool pgtable_pte_page_ctor(struct page *page) static inline void pgtable_pte_page_dtor(struct page *page) { - ptlock_free(page); + ptlock_free(page_ptdesc(page)); __ClearPageTable(page); dec_lruvec_page_state(page, NR_PAGETABLE); } @@ -2987,7 +2987,7 @@ static inline void pmd_ptlock_free(struct ptdesc *ptdesc) #ifdef CONFIG_TRANSPARENT_HUGEPAGE VM_BUG_ON_PAGE(ptdesc->pmd_huge_pte, ptdesc_page(ptdesc)); #endif - ptlock_free(ptdesc_page(ptdesc)); + ptlock_free(ptdesc); } #define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) diff --git a/mm/memory.c b/mm/memory.c index 4fee273595e2..e5e370cdac23 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -6242,8 +6242,8 @@ bool ptlock_alloc(struct ptdesc *ptdesc) return true; } -void ptlock_free(struct page *page) +void ptlock_free(struct ptdesc *ptdesc) { - kmem_cache_free(page_ptl_cachep, page->ptl); + kmem_cache_free(page_ptl_cachep, ptdesc->ptl); } #endif From patchwork Tue Jul 25 04:20:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325724 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 1DC95C25B79 for ; Tue, 25 Jul 2023 04:21:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9AFA56B0087; Tue, 25 Jul 2023 00:21:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8EB72900002; Tue, 25 Jul 2023 00:21:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 715EC6B0089; Tue, 25 Jul 2023 00:21:32 -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 574C56B0087 for ; Tue, 25 Jul 2023 00:21:32 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 320A840CD4 for ; Tue, 25 Jul 2023 04:21:32 +0000 (UTC) X-FDA: 81048835224.04.FEC399E Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 555B0160008 for ; Tue, 25 Jul 2023 04:21:30 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pRtFn4s2; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258890; 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=GM8s3dDlKIn9bcZ3Rv1fAyQJ11tvy15JiujAITQGQIU=; b=gM9t18/ilA9PHbzdgMiFj4C2Dapq51mSe9J3LIMUMMnrFEbjorvKPFQy5+ZpiSgqpSQSGM 2AVY2TWfB4XMGXU3F6fh7+xZRUo3cBo/Hngk/cYf9VzZ7/o6eV87i7ACwXNAjW0n7VIeiN MyD90MsvR/aQ2FRKrRNceGaPRKmh2aM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pRtFn4s2; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258890; a=rsa-sha256; cv=none; b=KIdXyNHJfGqbLowAPORTS15YNC23NVifSxUzu9ysB9kPHWVYdgs1Ve8bxOM+J9WS7C87OA X2hvM1fm5puOsCTdxKrABcicXhdN1jBlEnc4ozkgFiWk0zgp+SpWLzvMpRWkp7ADQjpmx4 huov0wsiTKtYy4gyFnONbc2+iUrByVk= Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-d18566dc0c1so252023276.0 for ; Mon, 24 Jul 2023 21:21:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258889; x=1690863689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GM8s3dDlKIn9bcZ3Rv1fAyQJ11tvy15JiujAITQGQIU=; b=pRtFn4s2PbyDqF0TT2ROPqoi8Nf6cO+mjT/PpAibpqoGu7RVl319pUbQzpwGcemW6v ycybLo0TEnNIsKIUBDodgJqfY6SleEYizvK1Vc9btvfMS46S3rfljXuaAJYnljAU7sG7 7jK+G5eyuE1KaJYyjxnJ03BoenaidsCYPCkwIEGR1Hhy/zJz4Ys+XX9GMOuKC1FJDNY4 VtftN6v4wiLKMbMCHR3bjB9E/ZrVvmPIO3VQbX7+L4Iqn5VeUa8q9xhONTfTBRh7Kux2 Tj/BOzEarK1RhsZfJqN5Pnf19w+jQvRB3VZLmWb0D0GCMPtXp8othTQIXw79eSgdX3zV QV6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258889; x=1690863689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GM8s3dDlKIn9bcZ3Rv1fAyQJ11tvy15JiujAITQGQIU=; b=egBVmEHLGlk1t2UV5PSPeeXGb1B83YfndsptgmE/Nmbe0Td/C6f0I/BdZakU2zN/BD Olzj67YO4mIe1YwoK5aTV9jU/jU7sUDCvQK5bQRuxMOJ4WSRRbYFgHj3S80X0CjdHWQL bDUWUynNHN/CQ9ZC8YrtuUQdLdehc9JJluYw0ScLrzfQUJVdeIcwCBah7vvNNI1kTter b25SIspD0oZ5E0E3M1vHncCX2sz8yfWetxW8gxRutStERFBiY8+MRR7jAOXO17t7m5iW 4YJZwc3K7eS9dVRIh1DtApb5R6w8Ag82zoEXw0l+Vf93Fw1scGvDfewiQQXtO0mBXgYR gk2Q== X-Gm-Message-State: ABy/qLYHqyA9YNySHfqBqMnmgRqyI+QCbfacTsWlGYMwvGKmTre85lao 1brFubLyP2MsqTdd0f2T7Cc= X-Google-Smtp-Source: APBJJlG8/pyNsL5c65VV2FWW2n+kp6iwz/O9EJhcRKijOyOwqeNWpfh6eCenLgaMZnYc3nueG5tQ5Q== X-Received: by 2002:a25:e7d8:0:b0:d0e:b5c8:6359 with SMTP id e207-20020a25e7d8000000b00d0eb5c86359mr4890639ybh.55.1690258889345; Mon, 24 Jul 2023 21:21:29 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:29 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 11/31] mm: Create ptdesc equivalents for pgtable_{pte,pmd}_page_{ctor,dtor} Date: Mon, 24 Jul 2023 21:20:31 -0700 Message-Id: <20230725042051.36691-12-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 555B0160008 X-Rspam-User: X-Stat-Signature: atg588ya34osjjo5rp1akn8byi554icz X-Rspamd-Server: rspam01 X-HE-Tag: 1690258890-804547 X-HE-Meta: U2FsdGVkX1/CvvCKuUTtgtWtQeryPkmLK/fhgcYRKyu5BQDqu+SDbvjA3ec3n69ltN5KdK2Uy/dp663fsnh7xcXkXD7sDAQUvdfS7ZxfKKhxhY2hhT+KIGtM/ztJh2mm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oUX4PDA6vyZTKE7AKDhqG8MZinKmM5OIBKCjaWsyS5HRAjHvzYTWWSXG9MY4Wy8apiHTa0p4WqX86kBI7QarPq9uoJsYotn/Ib9jNzTF5dRH1DteXOtu1u0+V2RB79p2LnulOAWmwM3gGO8ec2/yR9Ne0LhL/d2kSNivZKAY5HhowrSjLkst8PIoFO7k1q/Ywy5/FysbIC4zlGg3ru8Hm8RIm/Symdk5BojC+6Kr2WIdQuTctdPYCHMCZx1G/S7IMRyY4kMaH/kHCbDmrDo9mg0oFfv1ay7qqOxkE1KLz/Kq0Yl8TrzC43k6NhAvvs0zjo1Lk0UHB0HJfL2SOJwVXELfdoJJG/8JCIvuEnu3Sv9NPARlQd35WhYZCW3mYx0sRWh0dAdMFmoVrQtQ9Cn3/oowuPKrxWABbg= 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: Create pagetable_pte_ctor(), pagetable_pmd_ctor(), pagetable_pte_dtor(), and pagetable_pmd_dtor() and make the original pgtable constructor/destructors wrappers. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 56 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ffddae95af78..bd3d99d81984 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2902,20 +2902,34 @@ static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } static inline void ptlock_free(struct ptdesc *ptdesc) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ -static inline bool pgtable_pte_page_ctor(struct page *page) +static inline bool pagetable_pte_ctor(struct ptdesc *ptdesc) { - if (!ptlock_init(page_ptdesc(page))) + struct folio *folio = ptdesc_folio(ptdesc); + + if (!ptlock_init(ptdesc)) return false; - __SetPageTable(page); - inc_lruvec_page_state(page, NR_PAGETABLE); + __folio_set_pgtable(folio); + lruvec_stat_add_folio(folio, NR_PAGETABLE); return true; } +static inline bool pgtable_pte_page_ctor(struct page *page) +{ + return pagetable_pte_ctor(page_ptdesc(page)); +} + +static inline void pagetable_pte_dtor(struct ptdesc *ptdesc) +{ + struct folio *folio = ptdesc_folio(ptdesc); + + ptlock_free(ptdesc); + __folio_clear_pgtable(folio); + lruvec_stat_sub_folio(folio, NR_PAGETABLE); +} + static inline void pgtable_pte_page_dtor(struct page *page) { - ptlock_free(page_ptdesc(page)); - __ClearPageTable(page); - dec_lruvec_page_state(page, NR_PAGETABLE); + pagetable_pte_dtor(page_ptdesc(page)); } pte_t *__pte_offset_map(pmd_t *pmd, unsigned long addr, pmd_t *pmdvalp); @@ -3013,20 +3027,34 @@ static inline spinlock_t *pmd_lock(struct mm_struct *mm, pmd_t *pmd) return ptl; } -static inline bool pgtable_pmd_page_ctor(struct page *page) +static inline bool pagetable_pmd_ctor(struct ptdesc *ptdesc) { - if (!pmd_ptlock_init(page_ptdesc(page))) + struct folio *folio = ptdesc_folio(ptdesc); + + if (!pmd_ptlock_init(ptdesc)) return false; - __SetPageTable(page); - inc_lruvec_page_state(page, NR_PAGETABLE); + __folio_set_pgtable(folio); + lruvec_stat_add_folio(folio, NR_PAGETABLE); return true; } +static inline bool pgtable_pmd_page_ctor(struct page *page) +{ + return pagetable_pmd_ctor(page_ptdesc(page)); +} + +static inline void pagetable_pmd_dtor(struct ptdesc *ptdesc) +{ + struct folio *folio = ptdesc_folio(ptdesc); + + pmd_ptlock_free(ptdesc); + __folio_clear_pgtable(folio); + lruvec_stat_sub_folio(folio, NR_PAGETABLE); +} + static inline void pgtable_pmd_page_dtor(struct page *page) { - pmd_ptlock_free(page_ptdesc(page)); - __ClearPageTable(page); - dec_lruvec_page_state(page, NR_PAGETABLE); + pagetable_pmd_dtor(page_ptdesc(page)); } /* From patchwork Tue Jul 25 04:20:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325726 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 863A9C07E8F for ; Tue, 25 Jul 2023 04:21:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E7F96B0088; Tue, 25 Jul 2023 00:21:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 170196B0089; Tue, 25 Jul 2023 00:21:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F2CE06B008A; Tue, 25 Jul 2023 00:21:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E1BCA6B0088 for ; Tue, 25 Jul 2023 00:21:34 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A4B35A01C9 for ; Tue, 25 Jul 2023 04:21:34 +0000 (UTC) X-FDA: 81048835308.18.8DE9FF5 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf04.hostedemail.com (Postfix) with ESMTP id C5E0E40003 for ; Tue, 25 Jul 2023 04:21:32 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=MFgPFIET; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258892; 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=u45KHTw4Lm2isFbqg98Xq6aGMxdNGIm/kUbyd7vxsNs=; b=pCivku9Olyp+QgzlR4eB+Qx5gFHuMbyjg65+XsFLgyKqkcTbP9/L5WBf08dCC1MHWOTWO/ r8V3sd6xwk4YjJZL4a3ZScgIvMjKxyatJ2Z4peIGyxTGKdFgwCDc5J04V+V5snQa93e8GE aDgbu4qtEPUOLar9OIkfYhUcUtx+20g= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=MFgPFIET; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258892; a=rsa-sha256; cv=none; b=NWX0Clis4KMh2NbQ72s03cjanlg01ixiqxDDkC/o4UxbaMZ/wc82XP3VayZvvWNACzYFh2 A7tlHdiYG3QtlCiUMgMi8BIRtcW4yN9nXhnJjz2WU5I8UXc3PLTkFohivFGa8bd26SyT7P XF5aNUHcLT7UCHP64AOsYJNuccVY8XQ= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-d0a8ae5f8a6so2876671276.0 for ; Mon, 24 Jul 2023 21:21:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258892; x=1690863692; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=u45KHTw4Lm2isFbqg98Xq6aGMxdNGIm/kUbyd7vxsNs=; b=MFgPFIETcyQZFOhpw8+4f5zUQ0n+xg0tLu3Cdkb+1dejjtG9+Sn41JCWtxba3EUBon STSpvH1MNNsW6So+a/tghvNI+G/Lbgp5MhbOWzErRXRSurAquyDZtOdk2dZXP+K84d5y 2lj+wM84jK4/KJI/eNnwRBO0/O9yXdLYbiUEV5UJ1n3RcSGR2Pu1ZBK+tTmCkEf8+hqQ 1ItBCZtJ+JMmJlssaP+CTZzrVD9IabvE2unI85k4nMXIrER2uiyvsKz70ElKaAXIai8Y fMscO6ZRlYBmd8LI9oEQGQcnOb2XkEpfo9N2EgAc0FnMq++qauCUPViA0CXIrh8vRr/Z vicQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258892; x=1690863692; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u45KHTw4Lm2isFbqg98Xq6aGMxdNGIm/kUbyd7vxsNs=; b=EAuFz4rMn3xMmxRD50HYQmzpxLKBilRsYgzBJtCCdKql7Nu8YApuWkd2wYXaZz9S8q YezV1CtAxmHNsEc9AkLNzr1FWi4bKRk0dtG2YNSGtdusB6ViBAo7PHLtZV5FSU4Fmkz+ PDSrcGt1M0cw8aU8o9dpUhqxVpBAMhXo/nuY2o9I6mcg1EF+QGIeovaGztNnyKxmJgnb QVOw2kM/MyH3Fdk364UshbR+3DEelgiz5Juy7N+evg8mtPLtGgDKSP5Cvj616vuAaQGF 7etDpzzIH1njm6HIcy7lC7o1huTB5coAWs9s8tx7be+M2PmXyNNXldQx9LyAuoCjE8QS I5MA== X-Gm-Message-State: ABy/qLbQkXIACb8pK1fIf17O4hx8zcS1FQgRL7Kml5oh8XOeqyQ4dhil EwY7ANZ55sjABhk8i9BuXNk= X-Google-Smtp-Source: APBJJlGXFehjpASX0xXxIrGyQXSgIbPf3Ytm7rdvcIS221Bu6qToSpB5aWuJ/dgS8MuNc8IFsSfnXw== X-Received: by 2002:a25:7082:0:b0:d10:a134:adde with SMTP id l124-20020a257082000000b00d10a134addemr4056715ybc.53.1690258891680; Mon, 24 Jul 2023 21:21:31 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:31 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Christophe Leroy , Mike Rapoport Subject: [PATCH mm-unstable v7 12/31] powerpc: Convert various functions to use ptdescs Date: Mon, 24 Jul 2023 21:20:32 -0700 Message-Id: <20230725042051.36691-13-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: C5E0E40003 X-Rspam-User: X-Stat-Signature: ymbsjq9qt7ham19nxzfufq7a3u8i9xga X-Rspamd-Server: rspam01 X-HE-Tag: 1690258892-708837 X-HE-Meta: U2FsdGVkX1/ZQy/InvqHNJjCxOb4peoRa8sMjIO9o4rurZiM4zGoLk2Mf4w42coy1o/+MVT1ENYPi9lEJmvavPph9N77A7sxKRz+xsd9UnvZ5wL5W5pgc8nQFVfbLlbi0A31Sp6QWpwD8F/WbT30XnkYivAqB2BuMex/wJt/9+Mr+HMxmDrc014nfHmpkLtLowhIuFmGs0Gzn1gK+4hhLzEP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h8xfTXnIZ0X54YAd0UkFM1L0nzNVIFG/oBaW1K8dUzOgcxXuEzecJMtKlVoe5J94fzVdAUrPuQOAOIkzynh46wOdGBUV6eT2qvdQw1aMvKQvn/fsg365jp5twifjo+aMdL5E9I73VG/NJ6KVaxyWbtwAL3D3jQVDcQfWiDYxzevI6ea0IakbgfPHhcYPhHiKHpP376T62HjiVau7ckaePiLQrscz4WDnTtB8ST98jvwZKYwSGbESmoCV1q5i6UstSYgHcoZ66G1byoxEtpGtsFdq8YcifQ2BLrzc6UzVoZIRvbBarDl/P8GYg== 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: In order to split struct ptdesc from struct page, convert various functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/powerpc/mm/book3s64/mmu_context.c | 10 ++--- arch/powerpc/mm/book3s64/pgtable.c | 32 +++++++-------- arch/powerpc/mm/pgtable-frag.c | 56 +++++++++++++------------- 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/arch/powerpc/mm/book3s64/mmu_context.c b/arch/powerpc/mm/book3s64/mmu_context.c index c766e4c26e42..1715b07c630c 100644 --- a/arch/powerpc/mm/book3s64/mmu_context.c +++ b/arch/powerpc/mm/book3s64/mmu_context.c @@ -246,15 +246,15 @@ static void destroy_contexts(mm_context_t *ctx) static void pmd_frag_destroy(void *pmd_frag) { int count; - struct page *page; + struct ptdesc *ptdesc; - page = virt_to_page(pmd_frag); + ptdesc = virt_to_ptdesc(pmd_frag); /* drop all the pending references */ count = ((unsigned long)pmd_frag & ~PAGE_MASK) >> PMD_FRAG_SIZE_SHIFT; /* We allow PTE_FRAG_NR fragments from a PTE page */ - if (atomic_sub_and_test(PMD_FRAG_NR - count, &page->pt_frag_refcount)) { - pgtable_pmd_page_dtor(page); - __free_page(page); + if (atomic_sub_and_test(PMD_FRAG_NR - count, &ptdesc->pt_frag_refcount)) { + pagetable_pmd_dtor(ptdesc); + pagetable_free(ptdesc); } } diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c index 85c84e89e3ea..1212deeabe15 100644 --- a/arch/powerpc/mm/book3s64/pgtable.c +++ b/arch/powerpc/mm/book3s64/pgtable.c @@ -306,22 +306,22 @@ static pmd_t *get_pmd_from_cache(struct mm_struct *mm) static pmd_t *__alloc_for_pmdcache(struct mm_struct *mm) { void *ret = NULL; - struct page *page; + struct ptdesc *ptdesc; gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_ZERO; if (mm == &init_mm) gfp &= ~__GFP_ACCOUNT; - page = alloc_page(gfp); - if (!page) + ptdesc = pagetable_alloc(gfp, 0); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(page)) { - __free_pages(page, 0); + if (!pagetable_pmd_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - atomic_set(&page->pt_frag_refcount, 1); + atomic_set(&ptdesc->pt_frag_refcount, 1); - ret = page_address(page); + ret = ptdesc_address(ptdesc); /* * if we support only one fragment just return the * allocated page. @@ -331,12 +331,12 @@ static pmd_t *__alloc_for_pmdcache(struct mm_struct *mm) spin_lock(&mm->page_table_lock); /* - * If we find pgtable_page set, we return + * If we find ptdesc_page set, we return * the allocated page with single fragment * count. */ if (likely(!mm->context.pmd_frag)) { - atomic_set(&page->pt_frag_refcount, PMD_FRAG_NR); + atomic_set(&ptdesc->pt_frag_refcount, PMD_FRAG_NR); mm->context.pmd_frag = ret + PMD_FRAG_SIZE; } spin_unlock(&mm->page_table_lock); @@ -357,15 +357,15 @@ pmd_t *pmd_fragment_alloc(struct mm_struct *mm, unsigned long vmaddr) void pmd_fragment_free(unsigned long *pmd) { - struct page *page = virt_to_page(pmd); + struct ptdesc *ptdesc = virt_to_ptdesc(pmd); - if (PageReserved(page)) - return free_reserved_page(page); + if (pagetable_is_reserved(ptdesc)) + return free_reserved_ptdesc(ptdesc); - BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0); - if (atomic_dec_and_test(&page->pt_frag_refcount)) { - pgtable_pmd_page_dtor(page); - __free_page(page); + BUG_ON(atomic_read(&ptdesc->pt_frag_refcount) <= 0); + if (atomic_dec_and_test(&ptdesc->pt_frag_refcount)) { + pagetable_pmd_dtor(ptdesc); + pagetable_free(ptdesc); } } diff --git a/arch/powerpc/mm/pgtable-frag.c b/arch/powerpc/mm/pgtable-frag.c index 0c6b68130025..4c899c9c0694 100644 --- a/arch/powerpc/mm/pgtable-frag.c +++ b/arch/powerpc/mm/pgtable-frag.c @@ -18,15 +18,15 @@ void pte_frag_destroy(void *pte_frag) { int count; - struct page *page; + struct ptdesc *ptdesc; - page = virt_to_page(pte_frag); + ptdesc = virt_to_ptdesc(pte_frag); /* drop all the pending references */ count = ((unsigned long)pte_frag & ~PAGE_MASK) >> PTE_FRAG_SIZE_SHIFT; /* We allow PTE_FRAG_NR fragments from a PTE page */ - if (atomic_sub_and_test(PTE_FRAG_NR - count, &page->pt_frag_refcount)) { - pgtable_pte_page_dtor(page); - __free_page(page); + if (atomic_sub_and_test(PTE_FRAG_NR - count, &ptdesc->pt_frag_refcount)) { + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } } @@ -55,25 +55,25 @@ static pte_t *get_pte_from_cache(struct mm_struct *mm) static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel) { void *ret = NULL; - struct page *page; + struct ptdesc *ptdesc; if (!kernel) { - page = alloc_page(PGALLOC_GFP | __GFP_ACCOUNT); - if (!page) + ptdesc = pagetable_alloc(PGALLOC_GFP | __GFP_ACCOUNT, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } } else { - page = alloc_page(PGALLOC_GFP); - if (!page) + ptdesc = pagetable_alloc(PGALLOC_GFP, 0); + if (!ptdesc) return NULL; } - atomic_set(&page->pt_frag_refcount, 1); + atomic_set(&ptdesc->pt_frag_refcount, 1); - ret = page_address(page); + ret = ptdesc_address(ptdesc); /* * if we support only one fragment just return the * allocated page. @@ -82,12 +82,12 @@ static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel) return ret; spin_lock(&mm->page_table_lock); /* - * If we find pgtable_page set, we return + * If we find ptdesc_page set, we return * the allocated page with single fragment * count. */ if (likely(!pte_frag_get(&mm->context))) { - atomic_set(&page->pt_frag_refcount, PTE_FRAG_NR); + atomic_set(&ptdesc->pt_frag_refcount, PTE_FRAG_NR); pte_frag_set(&mm->context, ret + PTE_FRAG_SIZE); } spin_unlock(&mm->page_table_lock); @@ -108,28 +108,28 @@ pte_t *pte_fragment_alloc(struct mm_struct *mm, int kernel) static void pte_free_now(struct rcu_head *head) { - struct page *page; + struct ptdesc *ptdesc; - page = container_of(head, struct page, rcu_head); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc = container_of(head, struct ptdesc, pt_rcu_head); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } void pte_fragment_free(unsigned long *table, int kernel) { - struct page *page = virt_to_page(table); + struct ptdesc *ptdesc = virt_to_ptdesc(table); - if (PageReserved(page)) - return free_reserved_page(page); + if (pagetable_is_reserved(ptdesc)) + return free_reserved_ptdesc(ptdesc); BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0); - if (atomic_dec_and_test(&page->pt_frag_refcount)) { + if (atomic_dec_and_test(&ptdesc->pt_frag_refcount)) { if (kernel) - __free_page(page); - else if (TestClearPageActive(page)) - call_rcu(&page->rcu_head, pte_free_now); + pagetable_free(ptdesc); + else if (folio_test_clear_active(ptdesc_folio(ptdesc))) + call_rcu(&ptdesc->pt_rcu_head, pte_free_now); else - pte_free_now(&page->rcu_head); + pte_free_now(&ptdesc->pt_rcu_head); } } From patchwork Tue Jul 25 04:20:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325725 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 50080C10F19 for ; Tue, 25 Jul 2023 04:21:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF5D76B0089; Tue, 25 Jul 2023 00:21:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA6766B008A; Tue, 25 Jul 2023 00:21:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4554900002; Tue, 25 Jul 2023 00:21:36 -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 B53CE6B0089 for ; Tue, 25 Jul 2023 00:21:36 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 88080809E6 for ; Tue, 25 Jul 2023 04:21:36 +0000 (UTC) X-FDA: 81048835392.11.FE73748 Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) by imf19.hostedemail.com (Postfix) with ESMTP id B62691A0004 for ; Tue, 25 Jul 2023 04:21:34 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OoN3UWmL; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258894; 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=sltDOqqNfHEtvz8jLXUjW/r74sJCuRKUMVTEbSHBWCo=; b=TbMqrw/0dxLYAeu0sJ06+G+nxu7/t8p2lBdhWZyFn31W4SEXKAHl8krcxa0owmKjadteVp 7TgkmJO6iXyrh/0zan0QfWJixz7+FrYnc6BwaWKtzuIe3Am+IVX30ONFfs2Dym14cZaHHq zIkb01nFsdPGPtWcCIaWesQVcEHaq8E= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OoN3UWmL; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258894; a=rsa-sha256; cv=none; b=qfyNcOPwumgwE0HQu9lEHZRa9LVbuDIVmEqhAQX0X1nIFf3F50O6tUbXH2pElGbcRDSsk+ lCHkgNKZV8OBuHUJCJLkLtc21LUi05goblqXFYI1Vl78a1Lxb/3bPZ+nYGiwIuuxpzOGAv W+HDv2trNBMtIIEZnujHwrpXWESEe7Q= Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-cfd4ea89978so5442764276.2 for ; Mon, 24 Jul 2023 21:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258894; x=1690863694; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sltDOqqNfHEtvz8jLXUjW/r74sJCuRKUMVTEbSHBWCo=; b=OoN3UWmLSCjyxYbzaa/VyreR9Zp9zZE7q4yjWoRCcej2BHg4aQ044HHkVDn/SawDGs xygKZwOWRrg9shT9yAucyLF6JUhOidpReQLO08WoWlOww74TOvMA9ViH1KwkS5HDFQJa y+AyGlFm7eQ/xHxPvinfJ1GONUFKOJqagJ2BY2uxKaAzYfrmCGsCa4yr7xv8/m49BRfU KlXVshXWDHbntXMlZI7+vEacDxTrUH1emR9hZmFm4q/PkdnrRRqZ8ALZY/gtIumGa75s 4tL6H+cr1eSITvTUPxxUzr3WyxhZ30248GorV0XuK4prnVd3rVvMT55DDWK1kXMXlQb2 U/Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258894; x=1690863694; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sltDOqqNfHEtvz8jLXUjW/r74sJCuRKUMVTEbSHBWCo=; b=ZhxVF0OufHk9D8btZpeilYKkNzBPzfjReKQ6cvrkaS8HTRADj04CfrVEEqhiJkQt1Y RI61bHUf7Let0MbvfR5ZCoz04EznL+xYfB8wpnLi3zbka+bg5dw0JPT4wVXY0yW9HsUx EjLHNUs/0Ez+RoR20mubE/Y/HOUiCV/y6DPhpcNheYwCIhu2qNYXrcPBSNmMqeok5nfQ B5VeGyENl7irGvsFdohqEBxLdFMVNtug++hx2pNKFTxLixWOUgBXf9eKmwioqiqNkHzd 8oUo6NXC0qqcbo1drClgXiyhDydWZ7BNWTRw9ja3i4DbzalapRD+aLxOk+pUvPersO6y e6AA== X-Gm-Message-State: ABy/qLYGvyZCe9/qHW++ApoOpM3NwG85TqUj0BiGMyF3QSqNfs4+eDOM FWeH8BpLSVHtSGDvO0nl+S4= X-Google-Smtp-Source: APBJJlHsEM8PJvWhxaYGxDCv9CFh7IDA0XQcYTrJ3snbNygB4DE40wKDxkk+qw9NHN2b60Di5RWY+Q== X-Received: by 2002:a25:f908:0:b0:d08:7ffc:c0eb with SMTP id q8-20020a25f908000000b00d087ffcc0ebmr6392710ybe.19.1690258893793; Mon, 24 Jul 2023 21:21:33 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:33 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Dave Hansen Subject: [PATCH mm-unstable v7 13/31] x86: Convert various functions to use ptdescs Date: Mon, 24 Jul 2023 21:20:33 -0700 Message-Id: <20230725042051.36691-14-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: B62691A0004 X-Stat-Signature: 8hf6oy43yqubrrdhqcgcjiasxpwzoh6x X-HE-Tag: 1690258894-514519 X-HE-Meta: U2FsdGVkX18q6/gZ2DhsmJIFK6xhhehV1rLto0Lrk3x/wYGQ+plNIuJPq290PijGa53rbO7ooZjqR3qHHDTJtKB3mAsAhlkvuWhiUpfuWcE72s0DdbKAVa4RdjBih2m4V5Pl2+EzPkhiajak8kXk1Qz07DzYjL1+G2MwxtdvIbpBMepg+AdKVou52ldVvBRPgKUpbZKwtv5i6DDMJ23I+v/ag1aILKxpPqT6/wQOoHIOpk4qEg9Ef4pP2skwydaqvq3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8qnTlcxn6nY4m2nhdLu8LrDmXN8CsxdGXYBMI4fGyOdcq83edtlGwZnl9LGKszpJHtMgjFvNlU+Jibc7U4Lxb2oad9Eul5Yv7Sh9xVkCyBw2bN4l/L00XPT01HdMygH3SHmMPJVkRpfWyE+VRCvi3DOqm2TsdJ0WUOtIRFCcTdMY5MjEPC0g== 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: In order to split struct ptdesc from struct page, convert various functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/x86/mm/pgtable.c | 47 ++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index 15a8009a4480..d3a93e8766ee 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -52,7 +52,7 @@ early_param("userpte", setup_userpte); void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) { - pgtable_pte_page_dtor(pte); + pagetable_pte_dtor(page_ptdesc(pte)); paravirt_release_pte(page_to_pfn(pte)); paravirt_tlb_remove_table(tlb, pte); } @@ -60,7 +60,7 @@ void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) #if CONFIG_PGTABLE_LEVELS > 2 void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) { - struct page *page = virt_to_page(pmd); + struct ptdesc *ptdesc = virt_to_ptdesc(pmd); paravirt_release_pmd(__pa(pmd) >> PAGE_SHIFT); /* * NOTE! For PAE, any changes to the top page-directory-pointer-table @@ -69,8 +69,8 @@ void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) #ifdef CONFIG_X86_PAE tlb->need_flush_all = 1; #endif - pgtable_pmd_page_dtor(page); - paravirt_tlb_remove_table(tlb, page); + pagetable_pmd_dtor(ptdesc); + paravirt_tlb_remove_table(tlb, ptdesc_page(ptdesc)); } #if CONFIG_PGTABLE_LEVELS > 3 @@ -92,16 +92,16 @@ void ___p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d) static inline void pgd_list_add(pgd_t *pgd) { - struct page *page = virt_to_page(pgd); + struct ptdesc *ptdesc = virt_to_ptdesc(pgd); - list_add(&page->lru, &pgd_list); + list_add(&ptdesc->pt_list, &pgd_list); } static inline void pgd_list_del(pgd_t *pgd) { - struct page *page = virt_to_page(pgd); + struct ptdesc *ptdesc = virt_to_ptdesc(pgd); - list_del(&page->lru); + list_del(&ptdesc->pt_list); } #define UNSHARED_PTRS_PER_PGD \ @@ -112,12 +112,12 @@ static inline void pgd_list_del(pgd_t *pgd) static void pgd_set_mm(pgd_t *pgd, struct mm_struct *mm) { - virt_to_page(pgd)->pt_mm = mm; + virt_to_ptdesc(pgd)->pt_mm = mm; } struct mm_struct *pgd_page_get_mm(struct page *page) { - return page->pt_mm; + return page_ptdesc(page)->pt_mm; } static void pgd_ctor(struct mm_struct *mm, pgd_t *pgd) @@ -213,11 +213,14 @@ void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd) static void free_pmds(struct mm_struct *mm, pmd_t *pmds[], int count) { int i; + struct ptdesc *ptdesc; for (i = 0; i < count; i++) if (pmds[i]) { - pgtable_pmd_page_dtor(virt_to_page(pmds[i])); - free_page((unsigned long)pmds[i]); + ptdesc = virt_to_ptdesc(pmds[i]); + + pagetable_pmd_dtor(ptdesc); + pagetable_free(ptdesc); mm_dec_nr_pmds(mm); } } @@ -230,18 +233,24 @@ static int preallocate_pmds(struct mm_struct *mm, pmd_t *pmds[], int count) if (mm == &init_mm) gfp &= ~__GFP_ACCOUNT; + gfp &= ~__GFP_HIGHMEM; for (i = 0; i < count; i++) { - pmd_t *pmd = (pmd_t *)__get_free_page(gfp); - if (!pmd) + pmd_t *pmd = NULL; + struct ptdesc *ptdesc = pagetable_alloc(gfp, 0); + + if (!ptdesc) failed = true; - if (pmd && !pgtable_pmd_page_ctor(virt_to_page(pmd))) { - free_page((unsigned long)pmd); - pmd = NULL; + if (ptdesc && !pagetable_pmd_ctor(ptdesc)) { + pagetable_free(ptdesc); + ptdesc = NULL; failed = true; } - if (pmd) + if (ptdesc) { mm_inc_nr_pmds(mm); + pmd = ptdesc_address(ptdesc); + } + pmds[i] = pmd; } @@ -830,7 +839,7 @@ int pud_free_pmd_page(pud_t *pud, unsigned long addr) free_page((unsigned long)pmd_sv); - pgtable_pmd_page_dtor(virt_to_page(pmd)); + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); free_page((unsigned long)pmd); return 1; From patchwork Tue Jul 25 04:20:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325728 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 E02A9C04FDF for ; Tue, 25 Jul 2023 04:21:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F0146B008A; Tue, 25 Jul 2023 00:21:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A043900002; Tue, 25 Jul 2023 00:21:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 456CB6B0092; Tue, 25 Jul 2023 00:21:39 -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 35B1A6B008A for ; Tue, 25 Jul 2023 00:21:39 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 02BF3A075D for ; Tue, 25 Jul 2023 04:21:38 +0000 (UTC) X-FDA: 81048835518.27.69FB794 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf22.hostedemail.com (Postfix) with ESMTP id 28F6FC0003 for ; Tue, 25 Jul 2023 04:21:36 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=QrRJzaA0; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258897; a=rsa-sha256; cv=none; b=63UTHDLOc+203L82QDkEZQxFlRXS0x/2XxfN4+OtZhtInsUwWr9qO9Fd8/49nJ98OHS4Nu cqkEGILQYX+Bxm7oZ1+Qi45q+DurARRBbb5E3232LgUtgHWdijzCyXdxqEUca7yy4My6Ay k8/UOySScN4g7s41RRpkOni6LRv0aiA= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=QrRJzaA0; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258897; 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=HTuFXf3k0XF+iUx9+PEFpsWUTVtSma2QbqtalFKJ0Mg=; b=Qepa1M0hAgiXgvdQ5ftG8MalY0NnOmq0/CC0C/BOhpEP0QgQjOFtXqqZ5J2BLlhZvgzL2y LtKZ7ZPQnpnIO0Tn6866PHrK9eFWyf6bS4hjKIKY5W4R+J3WdV/l6RMsC3SB1c9ZmVDZ6B gcG2YEK4IaZfZGUYA76VXPAjEoiWJJM= Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-d08658c7713so3153782276.3 for ; Mon, 24 Jul 2023 21:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258896; x=1690863696; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HTuFXf3k0XF+iUx9+PEFpsWUTVtSma2QbqtalFKJ0Mg=; b=QrRJzaA03gdUbTqzHfmEzG/SCLN8TfMO31W01m+ZWQlnbcrzlb4tYT+35zeJjfW06z 9U9gt9lsV+tgAHhZ8n35SKI0CeQMqkEFGZ5B5orgn4svLxjBxl6Jzaq1tScsN4cutOyY MBojHX9rcIUgj3E6lWh0fv0eOSaMCWjRoxbQUhG1aAVpaeKYRSQsFSUSSXXm+4gUld+4 AAwiKYy7kKhjXb8bIEfD9zbtO0aneFF+lO/xjXVcWjg9cVHeUj4bupcxDkGJc2fLy1IN +ECwgNBBuGb+qDcAZhQy4/GreCi4XEqGLy5ZaCaADXrFmYS9d/RmD/xlr0+TZwqE0RSU qvRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258896; x=1690863696; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HTuFXf3k0XF+iUx9+PEFpsWUTVtSma2QbqtalFKJ0Mg=; b=mFNz3B/UxA/w0iRqWYZdu5aaMiqRO6BkMQRAUclAcuX9G9vUnL1oKMAYZInUgICCEg 4Ks2/83VRXbO2lJ9bMFXCRdaMsr1ZuN7ZgrOKrZOI233X0cOt3aE23VGja1ejp64yTAN DLny2MJAbvsB6Mwg/envkT/h+32sxVySlRVu5urNFwk+InWrnmK++NA6f5SsyJmiimLQ 9I0vnXN28WKUau+PuYDp52tbU0UfMSQKttbjhEpPak/5N5U1MZKigopH72OhSKaIB8Ur SP7H9xH6qa6HUumf0KBDqOkCKz5tATJU1OjX4da0pU/IbnnOYvMxKNKiRpw9Kgfqz4zC TAiw== X-Gm-Message-State: ABy/qLYg9VLyi5rGm9c3NCVijsij5ocYLhIXKyeRL05ZAOFb/oLDyrDz XwDfW6JtASJhoAuUNlpeakQ= X-Google-Smtp-Source: APBJJlEki8LDrmeLBLq59XmoJzB5sRXzAtgIv4vzSjEn99cb+IjR/JJiSJaFtdPyyxG1wP2vNvhZ2w== X-Received: by 2002:a25:8e0d:0:b0:d13:80a0:b428 with SMTP id p13-20020a258e0d000000b00d1380a0b428mr2932580ybl.3.1690258896011; Mon, 24 Jul 2023 21:21:36 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:35 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , David Hildenbrand , Claudio Imbrenda , Mike Rapoport Subject: [PATCH mm-unstable v7 14/31] s390: Convert various pgalloc functions to use ptdescs Date: Mon, 24 Jul 2023 21:20:34 -0700 Message-Id: <20230725042051.36691-15-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 28F6FC0003 X-Stat-Signature: qj5wxe5jfapiqxyq5hts8jg7jikxche7 X-Rspam-User: X-HE-Tag: 1690258896-638113 X-HE-Meta: U2FsdGVkX18jgmjj/Z57cdf7r3KEtSIJVchs2nbmHtX4D4CPtpS/CXmhkXKJj4xvBzffiY9XgVSNuMoL5vfCG1+uCtevW1xEJrsnb9PXT+1qVfh8F00qiVrUGmJxYm5h/TvlGqDjW0+vz8si0UdehjieOga2vkEiiPj+2hfmhiUuG5+nXNrrLbvOv65ZSzA8t/26NCT4DILR15k1Px5NaG133yUBZBPIfLiL96dpISaf7aB3TeK1XOobMNJqM+tebed+51k+yZ8HPzmk4IsCrhSD17EkAiK8z79+M9tC59buHINioYPIo6/ikpgDs205UlESDQcoTI9iNQvaomjvBOdR4ea1SeRi9PxdqRBftt5zwDjOk+5Dq+NzcIw8gyCSXvPgmcbZ7NxbnJhUt/CBHhdDMLhyMupyW/nwlQyHWXX/ZmpMZwrYNBC4qn9qiqLOLJF/c/WUfZyh/00r0Gadlcf1VH1xWuYCYC1a1X7Ysu8+XcIcEIhFchJAzEyEGcW4JzGU9yHD0s8ieiftWCuUMAEaU5orvG/g3zAE7AlgsDEglLwVqhxfCtdx/qzlqVuM4ZziIlmhOf4qkY+36aU0bFYHEC8qHYZiFnNuwXopjcMeGHjo/xSHaRx6eltlyr0WTt5J/1udy0QV4CzXgsuP2cAjaJQZNbloaqaDK0xyHfLi8xsJ5XsilJWC62wsvg4gSKedFZ9oUEPActoEJAJ38O0gq1BymvakvGMUWfjpMtUtZ2XtgapW7ZvQu9HBb8oIuINYBeNnPzx0J1uVM+VxBbsI+MzpPT5f84bu10jQMGzf5M6Hc5VRsrsxhcueOqkyxKfZmCVcftBO0oLv8MKbwgo1EyY5g64mgXduRCrxZpMllm4N6Hdi4wOj7TNhGBL3sUonPdkzyHnAmwvIiJqZwQ+/W241kcjtyDYyM/VkLRWZc3F4VBRlxty1d/bh1BZ5MI/p2OPjl6WyQSpO6VH s6dG0UGt 9masidCbkoJ3pkI6HK+znYApkfHs4OkBYNIx6/7MUiOugvi6l75uyZC2EvoTWzAibpE711A2mjohRzPd6Gfri3QYU+jtQL8TmQPal9YaUiast9p/x9t3MWvw9133wGnF2B8FfqOVZfWUdlT6yd5I4lgPDS9rV64hq2QhphV5roebuDWLV82yEV+d+4TgfbXLcCePF8XEOBRAlqo8NiwS6U4cB+Eoc5/3LsRQ3Nduq3UXupO81J5qfgPbg2iCXtDDbJFNpkDWYf17mUhVTeVC4X/oQuP/khfUUq1nxkA3Qu+D5OT8BNuWXz4o4mnEAuF/ZHfJnjl8azfovnL0r+0rMEBnCxfSZ2Zxxlmcl2vb5QeuzVLJZ1SiE54T3TyWGZ2TKVMlAb4Tm8Xz1WhYh/A52Zj04mO6t3rOxLUigYFyDUmNvoPDOSqUcGQLOxvKMG4hfPA7flgB9pwhuH3K4qikhVPgNx69PVgv0kqNycnKb9qC3n+/xeAEQ6MDW+M75jZ62+/obyszDBkhbyKlzQTrWo13cdP1F0gPB2BDyou2jNoPNDMhuMuYDBxOFmJoi+oZGto2PyOyXnD3IUYci4RPBLNxX2R1DxKXeIbYQ66JkhnTlu/r0Jf+02mzG7w== 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: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/s390/include/asm/pgalloc.h | 4 +- arch/s390/include/asm/tlb.h | 4 +- arch/s390/mm/pgalloc.c | 128 ++++++++++++++++---------------- 3 files changed, 69 insertions(+), 67 deletions(-) diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h index 89a9d5ef94f8..376b4b23bdaa 100644 --- a/arch/s390/include/asm/pgalloc.h +++ b/arch/s390/include/asm/pgalloc.h @@ -86,7 +86,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) if (!table) return NULL; crst_table_init(table, _SEGMENT_ENTRY_EMPTY); - if (!pgtable_pmd_page_ctor(virt_to_page(table))) { + if (!pagetable_pmd_ctor(virt_to_ptdesc(table))) { crst_table_free(mm, table); return NULL; } @@ -97,7 +97,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) { if (mm_pmd_folded(mm)) return; - pgtable_pmd_page_dtor(virt_to_page(pmd)); + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); crst_table_free(mm, (unsigned long *) pmd); } diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h index b91f4a9b044c..383b1f91442c 100644 --- a/arch/s390/include/asm/tlb.h +++ b/arch/s390/include/asm/tlb.h @@ -89,12 +89,12 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, { if (mm_pmd_folded(tlb->mm)) return; - pgtable_pmd_page_dtor(virt_to_page(pmd)); + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); __tlb_adjust_range(tlb, address, PAGE_SIZE); tlb->mm->context.flush_mm = 1; tlb->freed_tables = 1; tlb->cleared_puds = 1; - tlb_remove_table(tlb, pmd); + tlb_remove_ptdesc(tlb, pmd); } /* diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index d7374add7820..07fc660a24aa 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -43,17 +43,17 @@ __initcall(page_table_register_sysctl); unsigned long *crst_table_alloc(struct mm_struct *mm) { - struct page *page = alloc_pages(GFP_KERNEL, CRST_ALLOC_ORDER); + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL, CRST_ALLOC_ORDER); - if (!page) + if (!ptdesc) return NULL; - arch_set_page_dat(page, CRST_ALLOC_ORDER); - return (unsigned long *) page_to_virt(page); + arch_set_page_dat(ptdesc_page(ptdesc), CRST_ALLOC_ORDER); + return (unsigned long *) ptdesc_to_virt(ptdesc); } void crst_table_free(struct mm_struct *mm, unsigned long *table) { - free_pages((unsigned long)table, CRST_ALLOC_ORDER); + pagetable_free(virt_to_ptdesc(table)); } static void __crst_table_upgrade(void *arg) @@ -140,21 +140,21 @@ static inline unsigned int atomic_xor_bits(atomic_t *v, unsigned int bits) struct page *page_table_alloc_pgste(struct mm_struct *mm) { - struct page *page; + struct ptdesc *ptdesc; u64 *table; - page = alloc_page(GFP_KERNEL); - if (page) { - table = (u64 *)page_to_virt(page); + ptdesc = pagetable_alloc(GFP_KERNEL, 0); + if (ptdesc) { + table = (u64 *)ptdesc_to_virt(ptdesc); memset64(table, _PAGE_INVALID, PTRS_PER_PTE); memset64(table + PTRS_PER_PTE, 0, PTRS_PER_PTE); } - return page; + return ptdesc_page(ptdesc); } void page_table_free_pgste(struct page *page) { - __free_page(page); + pagetable_free(page_ptdesc(page)); } #endif /* CONFIG_PGSTE */ @@ -242,7 +242,7 @@ void page_table_free_pgste(struct page *page) unsigned long *page_table_alloc(struct mm_struct *mm) { unsigned long *table; - struct page *page; + struct ptdesc *ptdesc; unsigned int mask, bit; /* Try to get a fragment of a 4K page as a 2K page table */ @@ -250,9 +250,9 @@ unsigned long *page_table_alloc(struct mm_struct *mm) table = NULL; spin_lock_bh(&mm->context.lock); if (!list_empty(&mm->context.pgtable_list)) { - page = list_first_entry(&mm->context.pgtable_list, - struct page, lru); - mask = atomic_read(&page->_refcount) >> 24; + ptdesc = list_first_entry(&mm->context.pgtable_list, + struct ptdesc, pt_list); + mask = atomic_read(&ptdesc->_refcount) >> 24; /* * The pending removal bits must also be checked. * Failure to do so might lead to an impossible @@ -264,13 +264,13 @@ unsigned long *page_table_alloc(struct mm_struct *mm) */ mask = (mask | (mask >> 4)) & 0x03U; if (mask != 0x03U) { - table = (unsigned long *) page_to_virt(page); + table = (unsigned long *) ptdesc_to_virt(ptdesc); bit = mask & 1; /* =1 -> second 2K */ if (bit) table += PTRS_PER_PTE; - atomic_xor_bits(&page->_refcount, + atomic_xor_bits(&ptdesc->_refcount, 0x01U << (bit + 24)); - list_del_init(&page->lru); + list_del_init(&ptdesc->pt_list); } } spin_unlock_bh(&mm->context.lock); @@ -278,28 +278,28 @@ unsigned long *page_table_alloc(struct mm_struct *mm) return table; } /* Allocate a fresh page */ - page = alloc_page(GFP_KERNEL); - if (!page) + ptdesc = pagetable_alloc(GFP_KERNEL, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - arch_set_page_dat(page, 0); + arch_set_page_dat(ptdesc_page(ptdesc), 0); /* Initialize page table */ - table = (unsigned long *) page_to_virt(page); + table = (unsigned long *) ptdesc_to_virt(ptdesc); if (mm_alloc_pgste(mm)) { /* Return 4K page table with PGSTEs */ - INIT_LIST_HEAD(&page->lru); - atomic_xor_bits(&page->_refcount, 0x03U << 24); + INIT_LIST_HEAD(&ptdesc->pt_list); + atomic_xor_bits(&ptdesc->_refcount, 0x03U << 24); memset64((u64 *)table, _PAGE_INVALID, PTRS_PER_PTE); memset64((u64 *)table + PTRS_PER_PTE, 0, PTRS_PER_PTE); } else { /* Return the first 2K fragment of the page */ - atomic_xor_bits(&page->_refcount, 0x01U << 24); + atomic_xor_bits(&ptdesc->_refcount, 0x01U << 24); memset64((u64 *)table, _PAGE_INVALID, 2 * PTRS_PER_PTE); spin_lock_bh(&mm->context.lock); - list_add(&page->lru, &mm->context.pgtable_list); + list_add(&ptdesc->pt_list, &mm->context.pgtable_list); spin_unlock_bh(&mm->context.lock); } return table; @@ -322,19 +322,18 @@ static void page_table_release_check(struct page *page, void *table, static void pte_free_now(struct rcu_head *head) { - struct page *page; + struct ptdesc *ptdesc; - page = container_of(head, struct page, rcu_head); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc = container_of(head, struct ptdesc, pt_rcu_head); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } void page_table_free(struct mm_struct *mm, unsigned long *table) { unsigned int mask, bit, half; - struct page *page; + struct ptdesc *ptdesc = virt_to_ptdesc(table); - page = virt_to_page(table); if (!mm_alloc_pgste(mm)) { /* Free 2K page table fragment of a 4K page */ bit = ((unsigned long) table & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); @@ -344,51 +343,50 @@ void page_table_free(struct mm_struct *mm, unsigned long *table) * will happen outside of the critical section from this * function or from __tlb_remove_table() */ - mask = atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x11U << (bit + 24)); mask >>= 24; - if ((mask & 0x03U) && !PageActive(page)) { + if ((mask & 0x03U) && !folio_test_active(ptdesc_folio(ptdesc))) { /* * Other half is allocated, and neither half has had * its free deferred: add page to head of list, to make * this freed half available for immediate reuse. */ - list_add(&page->lru, &mm->context.pgtable_list); + list_add(&ptdesc->pt_list, &mm->context.pgtable_list); } else { /* If page is on list, now remove it. */ - list_del_init(&page->lru); + list_del_init(&ptdesc->pt_list); } spin_unlock_bh(&mm->context.lock); - mask = atomic_xor_bits(&page->_refcount, 0x10U << (bit + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x10U << (bit + 24)); mask >>= 24; if (mask != 0x00U) return; half = 0x01U << bit; } else { half = 0x03U; - mask = atomic_xor_bits(&page->_refcount, 0x03U << 24); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x03U << 24); mask >>= 24; } - page_table_release_check(page, table, half, mask); - if (TestClearPageActive(page)) - call_rcu(&page->rcu_head, pte_free_now); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + if (folio_test_clear_active(ptdesc_folio(ptdesc))) + call_rcu(&ptdesc->pt_rcu_head, pte_free_now); else - pte_free_now(&page->rcu_head); + pte_free_now(&ptdesc->pt_rcu_head); } void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table, unsigned long vmaddr) { struct mm_struct *mm; - struct page *page; unsigned int bit, mask; + struct ptdesc *ptdesc = virt_to_ptdesc(table); mm = tlb->mm; - page = virt_to_page(table); if (mm_alloc_pgste(mm)) { gmap_unlink(mm, table, vmaddr); table = (unsigned long *) ((unsigned long)table | 0x03U); - tlb_remove_table(tlb, table); + tlb_remove_ptdesc(tlb, table); return; } bit = ((unsigned long) table & ~PAGE_MASK) / (PTRS_PER_PTE*sizeof(pte_t)); @@ -398,19 +396,19 @@ void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table, * outside of the critical section from __tlb_remove_table() or from * page_table_free() */ - mask = atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x11U << (bit + 24)); mask >>= 24; - if ((mask & 0x03U) && !PageActive(page)) { + if ((mask & 0x03U) && !folio_test_active(ptdesc_folio(ptdesc))) { /* * Other half is allocated, and neither half has had * its free deferred: add page to end of list, to make * this freed half available for reuse once its pending * bit has been cleared by __tlb_remove_table(). */ - list_add_tail(&page->lru, &mm->context.pgtable_list); + list_add_tail(&ptdesc->pt_list, &mm->context.pgtable_list); } else { /* If page is on list, now remove it. */ - list_del_init(&page->lru); + list_del_init(&ptdesc->pt_list); } spin_unlock_bh(&mm->context.lock); table = (unsigned long *) ((unsigned long) table | (0x01U << bit)); @@ -421,30 +419,30 @@ void __tlb_remove_table(void *_table) { unsigned int mask = (unsigned long) _table & 0x03U, half = mask; void *table = (void *)((unsigned long) _table ^ mask); - struct page *page = virt_to_page(table); + struct ptdesc *ptdesc = virt_to_ptdesc(table); switch (half) { case 0x00U: /* pmd, pud, or p4d */ - free_pages((unsigned long)table, CRST_ALLOC_ORDER); + pagetable_free(ptdesc); return; case 0x01U: /* lower 2K of a 4K page table */ case 0x02U: /* higher 2K of a 4K page table */ - mask = atomic_xor_bits(&page->_refcount, mask << (4 + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, mask << (4 + 24)); mask >>= 24; if (mask != 0x00U) return; break; case 0x03U: /* 4K page table with pgstes */ - mask = atomic_xor_bits(&page->_refcount, 0x03U << 24); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x03U << 24); mask >>= 24; break; } - page_table_release_check(page, table, half, mask); - if (TestClearPageActive(page)) - call_rcu(&page->rcu_head, pte_free_now); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + if (folio_test_clear_active(ptdesc_folio(ptdesc))) + call_rcu(&ptdesc->pt_rcu_head, pte_free_now); else - pte_free_now(&page->rcu_head); + pte_free_now(&ptdesc->pt_rcu_head); } #ifdef CONFIG_TRANSPARENT_HUGEPAGE @@ -488,16 +486,20 @@ static void base_pgt_free(unsigned long *table) static unsigned long *base_crst_alloc(unsigned long val) { unsigned long *table; + struct ptdesc *ptdesc; - table = (unsigned long *)__get_free_pages(GFP_KERNEL, CRST_ALLOC_ORDER); - if (table) - crst_table_init(table, val); + ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, CRST_ALLOC_ORDER); + if (!ptdesc) + return NULL; + table = ptdesc_address(ptdesc); + + crst_table_init(table, val); return table; } static void base_crst_free(unsigned long *table) { - free_pages((unsigned long)table, CRST_ALLOC_ORDER); + pagetable_free(virt_to_ptdesc(table)); } #define BASE_ADDR_END_FUNC(NAME, SIZE) \ From patchwork Tue Jul 25 04:20:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325727 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 B7B1DC10F1A for ; Tue, 25 Jul 2023 04:21:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 431556B0092; Tue, 25 Jul 2023 00:21:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3924C6B0095; Tue, 25 Jul 2023 00:21:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 218606B0092; Tue, 25 Jul 2023 00:21:41 -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 0FF006B0092 for ; Tue, 25 Jul 2023 00:21:41 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D6B6BC0C52 for ; Tue, 25 Jul 2023 04:21:40 +0000 (UTC) X-FDA: 81048835560.18.EC282DA Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) by imf30.hostedemail.com (Postfix) with ESMTP id 11FE580010 for ; Tue, 25 Jul 2023 04:21:38 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Dgs8EsJA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258899; 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=hoPDwBR7UkDBRqaPTC6ObTEe9OrRslO4Jma44jkeaBI=; b=PmC5o1elAX7DsSk6HuX9j7qyKAeiCcRFEExeGvoDy0DB9pDIZyp+694QZvFKCEmi0I+6wI qzjM7eUcen5a90rCaM72BwqbGh/9UC3LK4dW0vsR1+0KS0Ma9MLNP3qydfO3YUKDH6Ybru /3BXMmKQ+v5Ze4+0L+UFMSizmrO3HbU= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Dgs8EsJA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258899; a=rsa-sha256; cv=none; b=Zym2m2p4QivvDFzj+7o5s5rODRv2r2Ki0rKTu5Un46dpnlEyXRww3mTF5fZINPIrHajH3R DuSahrAvI21rJuS05XOvWWJZe6WbwgkY/DC95kJuv4DDbLdxVYfcJGp1VimMba22aGRdR8 6r9TBgmUaopKmCbXonRJKfP1VjRbqsc= Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-d0fc1d97716so2005912276.1 for ; Mon, 24 Jul 2023 21:21:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258898; x=1690863698; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hoPDwBR7UkDBRqaPTC6ObTEe9OrRslO4Jma44jkeaBI=; b=Dgs8EsJAHasnII4rJ0h10Nj9H3O9uzEKXy7LW6sf6S5UPbm7zagckuwMpdCbvZk8cU 3/jnkSDkvXi64EHRwyjz+CM8p/KmVE/9fnMiDEX0PvmK/w2bAUSZDPt5BzsyT9VmXNoR USMHwv5na3aMh8DeZjSQRwfSfPFKG4ZOnIYC2X37iqKJqBwj0eKoY0bqe0NY7N310KPu aidhbQQvpt95cN5aH+LGh5XqwJcQ2uC+n4TR20GhHOCZWT8rqRInnhuzQKk9A3ffSHvU 8/8KhU8ISd3BEz/7bIAWQZEwejG7oku5b5qOTInFSfUdh8Iny4J/y8tSxkhE65C29I99 J5UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258898; x=1690863698; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hoPDwBR7UkDBRqaPTC6ObTEe9OrRslO4Jma44jkeaBI=; b=eZmuTFlYuheeYnjURoBnpB2lT/3QAowxD2klRvHMFBi/aSqaapysv9Bf2jIxUoMdpu c/I47h+Qq9os+HfEnGqL/lj5BtgCfMg2jZ7hHYCEkLL5boolQyvEmbZehYFPWSHMluri 4xTMID9+DCpUfMtmRdEpkjmTNZbc72fwfIBqLf/T2ZYOLJBdxOJ92PhvrZb1rsm7tk36 pJX/trM5WGphykWJ4SxJEe7263+h/LR1yoEj0mvngc9GIENGEO7gUrKLGIAWFwMdR0cn CLAijeHVW3Y98FYtvHAeqj2ZJwVPHBRbZOIurdSEsuCC+qGbwcDVRLwIi4gF4kPDu9EJ 3vQA== X-Gm-Message-State: ABy/qLYV+NTgwElb4QLscmXPD4lMrzd3TwwXCxNzm51PPOyg74Ir5TeU Q1RSUmtlLwg+UNvPzbKYu2c= X-Google-Smtp-Source: APBJJlF5Dk/uQrTXMbCnDdD5/bLVaLQ5W3zqcEOsqm95ohTlFSSUZBYyBU16PWFlX2Ey7GE6JXmN/Q== X-Received: by 2002:a25:254c:0:b0:d0b:9058:f660 with SMTP id l73-20020a25254c000000b00d0b9058f660mr5944061ybl.44.1690258898065; Mon, 24 Jul 2023 21:21:38 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:37 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 15/31] mm: Remove page table members from struct page Date: Mon, 24 Jul 2023 21:20:35 -0700 Message-Id: <20230725042051.36691-16-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 11FE580010 X-Stat-Signature: xx7q4ife4j1esy3d98h6nbstxxbs8wsp X-Rspam-User: X-HE-Tag: 1690258898-931812 X-HE-Meta: U2FsdGVkX1/7S+/gg6sFXQ8LceIbYCRNHkVUH6ie50qRdR0IiNf0wutxdr6VGRDM/7xFxvrlfWuxlVvDAeKc6BkWyHwVuoFQ8IYGkw12gSpOYARH16GGaNDZsWF7G1fNH5+fn9ufH7c6LYWrB/kptOhcAYc1abE7JA3mUDBInubkiyuYCViFW77o5fG5Yd0S513Etq//ZEIBl1qSLGrdUbBj9lOcd/jlIp4LJeSlFVRF/G57uKPuS0TwRmSbZSTB+R2Yftch/hd2rACdleoGHQ69PR9oZQfGMYIFRRJsQh0FgpwtPxDrc1frT9ikxmKLnWZYgiEaySt7P//BoFt44jGk/qA1PmM8nuxVJFQOoIhH6DRPhVN+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gTtczihgs15BVI4RlyPqV++dk8lnWQkAXS0kA0ZW8YobJOQd2dRqjiJyeabiUkz3FtDecRL6boml5pcsfZxnRKI4GIigSQTAG0p/HWCdTnnJ8mBIdgEsc9NCuCJtjqjg== 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: The page table members are now split out into their own ptdesc struct. Remove them from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm_types.h | 18 ------------------ include/linux/pgtable.h | 3 --- 2 files changed, 21 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index da538ff68953..aae6af098031 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -141,24 +141,6 @@ struct page { struct { /* Tail pages of compound page */ unsigned long compound_head; /* Bit zero is set */ }; - struct { /* Page table pages */ - unsigned long _pt_pad_1; /* compound_head */ - pgtable_t pmd_huge_pte; /* protected by page->ptl */ - /* - * A PTE page table page might be freed by use of - * rcu_head: which overlays those two fields above. - */ - unsigned long _pt_pad_2; /* mapping */ - union { - struct mm_struct *pt_mm; /* x86 pgds only */ - atomic_t pt_frag_refcount; /* powerpc */ - }; -#if ALLOC_SPLIT_PTLOCKS - spinlock_t *ptl; -#else - spinlock_t ptl; -#endif - }; struct { /* ZONE_DEVICE pages */ /** @pgmap: Points to the hosting device page map. */ struct dev_pagemap *pgmap; diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 250fdeba68f3..1a984c300d45 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1051,10 +1051,7 @@ struct ptdesc { TABLE_MATCH(flags, __page_flags); TABLE_MATCH(compound_head, pt_list); TABLE_MATCH(compound_head, _pt_pad_1); -TABLE_MATCH(pmd_huge_pte, pmd_huge_pte); TABLE_MATCH(mapping, __page_mapping); -TABLE_MATCH(pt_mm, pt_mm); -TABLE_MATCH(ptl, ptl); TABLE_MATCH(rcu_head, pt_rcu_head); TABLE_MATCH(page_type, __page_type); TABLE_MATCH(_refcount, _refcount); From patchwork Tue Jul 25 04:20:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325729 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 E9DA7C25B4F for ; Tue, 25 Jul 2023 04:21:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 653736B0098; Tue, 25 Jul 2023 00:21:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B5D46B0096; Tue, 25 Jul 2023 00:21:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42F0B6B0098; Tue, 25 Jul 2023 00:21:43 -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 357456B0095 for ; Tue, 25 Jul 2023 00:21:43 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 05BEF40CD8 for ; Tue, 25 Jul 2023 04:21:42 +0000 (UTC) X-FDA: 81048835686.08.74115E1 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by imf26.hostedemail.com (Postfix) with ESMTP id 2615B14000E for ; Tue, 25 Jul 2023 04:21:40 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ZdUhmLaX; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258901; a=rsa-sha256; cv=none; b=iOODMaRFOxiOCHEIU1jiCaRHeO09kLAr/nI0lzjRXAyMby7IiYaMAE/tyQ17o1NhkHcxJn 5fk594SWD5HCOQOkTtGEnDiAv0RD7lJraIRwils1r8bOL1c48pBJklbyggP3j6QKp6F+pQ OdhAzNanN9h92mTDi45cNDGZ7K4c+lw= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ZdUhmLaX; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258901; 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=bBkB4loM/Mt006iaxsYk7j8UnaAx8a9/NTd5FkPootg=; b=6aCjcBe2Y4HscvVpAu3aqUjdD5f8qf8ctNFp+vfAdCm2/VlUrVHF3Xbjd3zDqo/OSTVTmq TDcUvenulyF2UM1KmLhy2vFGtwHgepD/IKf0UoDQz6brYL8ghka9JLLiiaPuHmFrsMwLNX KpujBYVbVMrHyKA+bZHf8cOrbTRDRig= Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-ca3cc52ee62so5589126276.0 for ; Mon, 24 Jul 2023 21:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258900; x=1690863700; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bBkB4loM/Mt006iaxsYk7j8UnaAx8a9/NTd5FkPootg=; b=ZdUhmLaX4gyxiKMyaj14CX9NQ1dcJnSa6rrPN3h4Mn2BougMhb6+8eVh3LDQVrQc65 NbnS7VdeFeEZ212ZKZ16lIX06FqrCLzrwnXox0T9+YGd8WFEd02oq0hboPERBUgGx8JC HOw+EuGxnkrsAxoVIbFXPSdQFe979NDqglA7jt9NXl1ISDIRCiCswdNU94Ao6k2KFzes p0unhJhxsBzqp2at7WfBaU/RBWoIHYWL79aXOZXm1nAXnss+vRNjWMvAhrXpkXlQkCEM C6Xg+Yg0Z0IGF4ytYyUqBQzs61/z6rc7xaR+RbhDKuWWQZ0zi2wRVTJY+XBjSXIYJO1f lTUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258900; x=1690863700; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bBkB4loM/Mt006iaxsYk7j8UnaAx8a9/NTd5FkPootg=; b=ONm+sJYAxdnktCelp+6EW47KA7rdRHW7Ldn0Jzga1r1/VhLrV/JCBj3OfkKPDu5HMn oza4IMccGY/RR1+ekK1UzgDVGGo+I7QpKL77e7N7g2MydzTlaKBHpZUbRBlH5IpDeAYq vUKqUj1IfLM9DiTeuDXSnNs2EED3guYH1r9JQV0QpBfUtnFP+irETRm4EGFjg28idlwj Kt3C+trS9RQecOKvN97aHWkCU13Gq7XSFV1c4F0EMm7N3Ll6peI+E0BK7Gaht3vDCKZ+ svgx1Pj9bgjyhkwVvOvljwY05qusX1oiki0VIREYR15V2MKE48nVUBVsWKAU7804TOue RVUg== X-Gm-Message-State: ABy/qLa9xDmPEEb9kH9THYYnXFRplLuarpxuO+dKSYUjVKhX8H8Mmgrn eDgIvI2xs+6CfVVhHuCzfK4= X-Google-Smtp-Source: APBJJlH216bHzn+k38ByANxYCweqR/XKQKTMqZJNszM/Cw5+4Xe9qdLUIJ9YJ2RtXuXTDJ+OkOOs1w== X-Received: by 2002:a25:1003:0:b0:d0b:7ad2:6426 with SMTP id 3-20020a251003000000b00d0b7ad26426mr5060713ybq.18.1690258900146; Mon, 24 Jul 2023 21:21:40 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:39 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" Subject: [PATCH mm-unstable v7 16/31] pgalloc: Convert various functions to use ptdescs Date: Mon, 24 Jul 2023 21:20:36 -0700 Message-Id: <20230725042051.36691-17-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2615B14000E X-Stat-Signature: 8prt7tjnnq7mzasuqabs4ddzr4xo15uk X-Rspam-User: X-HE-Tag: 1690258900-467713 X-HE-Meta: U2FsdGVkX18ymnqY7U8bx5zKKZUtiMGfgUT/WOG4cxvq3aaQKr9CFf99FIJIDnVvLIjo62MJzZM5qT+Z4omWFNH5aL8xMezbnS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IiOqrocbaP+DOYzvAzkrvbo+k/P83ln0yBWOyFSYXwsqEnCr3AiiAzbEQmxhMRLAxdYBmSt4dV6A5q1sAsypeqj2kTtGdqU/yWijztwxFic/AhqPq7apUKNtpqNWgpdnLfkkQK0ZyCJ5YdT5F3zoqu5cakt9+dU7CXwgyNIDUeJRXddJih9F+IxZQ0RvxdTU5FOOHkov8wiEMYjCL7sBGk0LBBmpzLmPoic45oQ1q4Mn0sUFuM+3ASm92z2jse4POfRsg3ywxP1Yb5AT7vRDYacIKGOZMgRxqmhgEiwxAQCrZep/kpi8ONrhap53bHcfrr09ozUnpuTkk6BRGD/YC2idmnJQSGLOaTOgdug1ZJhWGX1pfILgp9dlcBA== 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: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- include/asm-generic/pgalloc.h | 88 +++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h index a7cf825befae..c75d4a753849 100644 --- a/include/asm-generic/pgalloc.h +++ b/include/asm-generic/pgalloc.h @@ -8,7 +8,7 @@ #define GFP_PGTABLE_USER (GFP_PGTABLE_KERNEL | __GFP_ACCOUNT) /** - * __pte_alloc_one_kernel - allocate a page for PTE-level kernel page table + * __pte_alloc_one_kernel - allocate memory for a PTE-level kernel page table * @mm: the mm_struct of the current context * * This function is intended for architectures that need @@ -18,12 +18,17 @@ */ static inline pte_t *__pte_alloc_one_kernel(struct mm_struct *mm) { - return (pte_t *)__get_free_page(GFP_PGTABLE_KERNEL); + struct ptdesc *ptdesc = pagetable_alloc(GFP_PGTABLE_KERNEL & + ~__GFP_HIGHMEM, 0); + + if (!ptdesc) + return NULL; + return ptdesc_address(ptdesc); } #ifndef __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL /** - * pte_alloc_one_kernel - allocate a page for PTE-level kernel page table + * pte_alloc_one_kernel - allocate memory for a PTE-level kernel page table * @mm: the mm_struct of the current context * * Return: pointer to the allocated memory or %NULL on error @@ -35,40 +40,40 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) #endif /** - * pte_free_kernel - free PTE-level kernel page table page + * pte_free_kernel - free PTE-level kernel page table memory * @mm: the mm_struct of the current context * @pte: pointer to the memory containing the page table */ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) { - free_page((unsigned long)pte); + pagetable_free(virt_to_ptdesc(pte)); } /** - * __pte_alloc_one - allocate a page for PTE-level user page table + * __pte_alloc_one - allocate memory for a PTE-level user page table * @mm: the mm_struct of the current context * @gfp: GFP flags to use for the allocation * - * Allocates a page and runs the pgtable_pte_page_ctor(). + * Allocate memory for a page table and ptdesc and runs pagetable_pte_ctor(). * * This function is intended for architectures that need * anything beyond simple page allocation or must have custom GFP flags. * - * Return: `struct page` initialized as page table or %NULL on error + * Return: `struct page` referencing the ptdesc or %NULL on error */ static inline pgtable_t __pte_alloc_one(struct mm_struct *mm, gfp_t gfp) { - struct page *pte; + struct ptdesc *ptdesc; - pte = alloc_page(gfp); - if (!pte) + ptdesc = pagetable_alloc(gfp, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(pte)) { - __free_page(pte); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - return pte; + return ptdesc_page(ptdesc); } #ifndef __HAVE_ARCH_PTE_ALLOC_ONE @@ -76,9 +81,9 @@ static inline pgtable_t __pte_alloc_one(struct mm_struct *mm, gfp_t gfp) * pte_alloc_one - allocate a page for PTE-level user page table * @mm: the mm_struct of the current context * - * Allocates a page and runs the pgtable_pte_page_ctor(). + * Allocate memory for a page table and ptdesc and runs pagetable_pte_ctor(). * - * Return: `struct page` initialized as page table or %NULL on error + * Return: `struct page` referencing the ptdesc or %NULL on error */ static inline pgtable_t pte_alloc_one(struct mm_struct *mm) { @@ -92,14 +97,16 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm) */ /** - * pte_free - free PTE-level user page table page + * pte_free - free PTE-level user page table memory * @mm: the mm_struct of the current context - * @pte_page: the `struct page` representing the page table + * @pte_page: the `struct page` referencing the ptdesc */ static inline void pte_free(struct mm_struct *mm, struct page *pte_page) { - pgtable_pte_page_dtor(pte_page); - __free_page(pte_page); + struct ptdesc *ptdesc = page_ptdesc(pte_page); + + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } @@ -107,10 +114,11 @@ static inline void pte_free(struct mm_struct *mm, struct page *pte_page) #ifndef __HAVE_ARCH_PMD_ALLOC_ONE /** - * pmd_alloc_one - allocate a page for PMD-level page table + * pmd_alloc_one - allocate memory for a PMD-level page table * @mm: the mm_struct of the current context * - * Allocates a page and runs the pgtable_pmd_page_ctor(). + * Allocate memory for a page table and ptdesc and runs pagetable_pmd_ctor(). + * * Allocations use %GFP_PGTABLE_USER in user context and * %GFP_PGTABLE_KERNEL in kernel context. * @@ -118,28 +126,30 @@ static inline void pte_free(struct mm_struct *mm, struct page *pte_page) */ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) { - struct page *page; + struct ptdesc *ptdesc; gfp_t gfp = GFP_PGTABLE_USER; if (mm == &init_mm) gfp = GFP_PGTABLE_KERNEL; - page = alloc_page(gfp); - if (!page) + ptdesc = pagetable_alloc(gfp, 0); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(page)) { - __free_page(page); + if (!pagetable_pmd_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - return (pmd_t *)page_address(page); + return ptdesc_address(ptdesc); } #endif #ifndef __HAVE_ARCH_PMD_FREE static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) { + struct ptdesc *ptdesc = virt_to_ptdesc(pmd); + BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); - pgtable_pmd_page_dtor(virt_to_page(pmd)); - free_page((unsigned long)pmd); + pagetable_pmd_dtor(ptdesc); + pagetable_free(ptdesc); } #endif @@ -150,19 +160,25 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) static inline pud_t *__pud_alloc_one(struct mm_struct *mm, unsigned long addr) { gfp_t gfp = GFP_PGTABLE_USER; + struct ptdesc *ptdesc; if (mm == &init_mm) gfp = GFP_PGTABLE_KERNEL; - return (pud_t *)get_zeroed_page(gfp); + gfp &= ~__GFP_HIGHMEM; + + ptdesc = pagetable_alloc(gfp, 0); + if (!ptdesc) + return NULL; + return ptdesc_address(ptdesc); } #ifndef __HAVE_ARCH_PUD_ALLOC_ONE /** - * pud_alloc_one - allocate a page for PUD-level page table + * pud_alloc_one - allocate memory for a PUD-level page table * @mm: the mm_struct of the current context * - * Allocates a page using %GFP_PGTABLE_USER for user context and - * %GFP_PGTABLE_KERNEL for kernel context. + * Allocate memory for a page table using %GFP_PGTABLE_USER for user context + * and %GFP_PGTABLE_KERNEL for kernel context. * * Return: pointer to the allocated memory or %NULL on error */ @@ -175,7 +191,7 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) static inline void __pud_free(struct mm_struct *mm, pud_t *pud) { BUG_ON((unsigned long)pud & (PAGE_SIZE-1)); - free_page((unsigned long)pud); + pagetable_free(virt_to_ptdesc(pud)); } #ifndef __HAVE_ARCH_PUD_FREE @@ -190,7 +206,7 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud) #ifndef __HAVE_ARCH_PGD_FREE static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { - free_page((unsigned long)pgd); + pagetable_free(virt_to_ptdesc(pgd)); } #endif From patchwork Tue Jul 25 04:20:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325730 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 11312C00528 for ; Tue, 25 Jul 2023 04:21:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 717766B0096; Tue, 25 Jul 2023 00:21:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C7A86B0099; Tue, 25 Jul 2023 00:21:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 51A16900002; Tue, 25 Jul 2023 00:21:45 -0400 (EDT) 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 38CF26B0096 for ; Tue, 25 Jul 2023 00:21:45 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0EA4580818 for ; Tue, 25 Jul 2023 04:21:45 +0000 (UTC) X-FDA: 81048835770.27.F800F06 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf12.hostedemail.com (Postfix) with ESMTP id 3A0E84000F for ; Tue, 25 Jul 2023 04:21:43 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YmaPL1Vi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258903; 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=jHkn+4hWn6cNWfQmftBQOtWQYQb9iJJIYcRZZNmu6iY=; b=jy2WQWHtjd329JxH/5S4Ofy24eqaJInOGQdjFSOFecsh8GC8J6ZBmnmd9lPOLBGao1B5gs bSvLzeQoCs9v6WfGU8beqdlAHfjobdl7hTiIk4kp+YPspxQSDkFbCE2lF6n5In8deMpHRK gH/Onm9nA/EqoOSyzBsi8AWinlxB+TI= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YmaPL1Vi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258903; a=rsa-sha256; cv=none; b=8VZO8dIiD9vRe4vbE0/wcfyX/C+s+jhme+WENctM7368lrKvABkA3CTlj0rg4n6TEgZseb 8BZSWnlDuM9WXa8Shvc9Iff4UYKbcdSiZmKpgvo1ue+LuVPKoMmxPPq0tKCxpv6MXosuaF UHZraJI6J8lDY4hbSS+LfcycSXO3Ys0= Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-d066d72eb12so4536209276.1 for ; Mon, 24 Jul 2023 21:21:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258902; x=1690863702; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jHkn+4hWn6cNWfQmftBQOtWQYQb9iJJIYcRZZNmu6iY=; b=YmaPL1Vi+BQChOKWGw1MlFqz3AIULFncYrkFnUsVyfilrIdeasoH5GHm0MEpRXKgmq DwC9KwXiAQ3MN8gwuAbymt06/p5z+8sYZZRmtF0QZ8N7W0KJLZlIdtmS/iEXcHfRR9pY 2ULSywNr2+fCENRH3Q/SedxdAZmlqvHkU4bXO0Iy6mLyj0C0e7FNRd96oXnepKXsjgBp DVfpoX3+8pHS5yXYZY0DswmNPSsrKwOikBQLnb77xz8k9ebKbrK+QxqOENWwGszD02R4 u3nvQUFC/AuDK1NFsePOhCwUQCv2T+yjXJkyc6tTHY68z6Qz4nIbLO6jQDPO+Xjl6VQM RJag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258902; x=1690863702; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jHkn+4hWn6cNWfQmftBQOtWQYQb9iJJIYcRZZNmu6iY=; b=RqBfGL6lBAhB2zPTDaAZ7MLhkF3Qk34yyeXMI3amBFc/+cQ/PuHgfeyPDqQEIE7kVZ cujJnYySKGmz6STdxlBh/ofBp/4nIdjQfJkepiLnRP3PYQ+dpbaZgbSSeh6RUzQ1trWY /N+2iz8NqS58TYg6P1p+QG916KsNWfA3DP3qMguDmlTTm3AG8ljiMLkFZltyg2PhwiPp uB24ju8y69TQJtVVZ17UvH/RsLnGhX2E8ub1PVWgG0KCAdmf0T/Tn+nU2y38t5Ob8WVh G7RCvSp5TvZ5eYzC4+f9KKVDB7SD5K2TQ15aBHW8SmjOlEIDXu3Cs2Tx1luqT9CgVnCD c8FQ== X-Gm-Message-State: ABy/qLYPBSJa6nLwBgvAiRwSLyA3pO7j6CDWy7ddDrl8zynoX5xnGY7Y 5pXoJIQLw/e3MWet3Bisd5o= X-Google-Smtp-Source: APBJJlF19R+0iLSXwcqdh2p0QPj8gjsaDLf4/piQLSANpJDw+A6xil+mrxUfv/BGU2XCVUHQZlpYDQ== X-Received: by 2002:a25:dbce:0:b0:bcf:e2a6:7085 with SMTP id g197-20020a25dbce000000b00bcfe2a67085mr1287878ybf.23.1690258902247; Mon, 24 Jul 2023 21:21:42 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:41 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Catalin Marinas , Mike Rapoport Subject: [PATCH mm-unstable v7 17/31] arm: Convert various functions to use ptdescs Date: Mon, 24 Jul 2023 21:20:37 -0700 Message-Id: <20230725042051.36691-18-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 9qjspnz3uyhgq1p8sqtgcucu9x4k3spm X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3A0E84000F X-HE-Tag: 1690258903-996400 X-HE-Meta: U2FsdGVkX1/VTznuTCJA2kyovbQ04zJCv9IniBw7DnryrFF/BabqX0LSzcazg3R4nlQOqGyMEaQE6tlhU0RRl4DzMyC1oVqbYfGJaykStqp9m6A8DfE2t/RENrkNWW8wzTUhbzrCaOQQIfiEBXeMNEkiqUGIr2melyENl/surzFCn0Eeol3DvoUBo4NqT5y8tqIiap4j5gwAd7LTSiVM+5E7YAIdiv4wI/e1iZX/lnn94WOBoz4B84RGMf8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XOcD2PqsAh4GhDUE7hjZ+sxvNAdbhNcIB4BHEvPO1tOhOaZvEXEbSvmyHGi9yYo7ZoVeQoeMN+JKrpa5F4FAgr0iU+f2f1FSl/gZHXSJKJxKuuOOqW22qgXJ72lAQtHxTowfa+FLWzwY80bYN95f4DQSqpl/tC/Io9mScuO3HptX+ecJ1re0s8fyLxLqB1RkXT1yDRk4HRvo08YdVBuvoPLwrQNnTimupKJ8o/q4hNv+QZvUY3UCDFA1DWIHtkDT4uTTSiQA== 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: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. late_alloc() also uses the __get_free_pages() helper function. Convert this to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/arm/include/asm/tlb.h | 12 +++++++----- arch/arm/mm/mmu.c | 7 ++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h index b8cbe03ad260..f40d06ad5d2a 100644 --- a/arch/arm/include/asm/tlb.h +++ b/arch/arm/include/asm/tlb.h @@ -39,7 +39,9 @@ static inline void __tlb_remove_table(void *_table) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) { - pgtable_pte_page_dtor(pte); + struct ptdesc *ptdesc = page_ptdesc(pte); + + pagetable_pte_dtor(ptdesc); #ifndef CONFIG_ARM_LPAE /* @@ -50,17 +52,17 @@ __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) __tlb_adjust_range(tlb, addr - PAGE_SIZE, 2 * PAGE_SIZE); #endif - tlb_remove_table(tlb, pte); + tlb_remove_ptdesc(tlb, ptdesc); } static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr) { #ifdef CONFIG_ARM_LPAE - struct page *page = virt_to_page(pmdp); + struct ptdesc *ptdesc = virt_to_ptdesc(pmdp); - pgtable_pmd_page_dtor(page); - tlb_remove_table(tlb, page); + pagetable_pmd_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); #endif } diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 13fc4bb5f792..fdeaee30d167 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -737,11 +737,12 @@ static void __init *early_alloc(unsigned long sz) static void *__init late_alloc(unsigned long sz) { - void *ptr = (void *)__get_free_pages(GFP_PGTABLE_KERNEL, get_order(sz)); + void *ptdesc = pagetable_alloc(GFP_PGTABLE_KERNEL & ~__GFP_HIGHMEM, + get_order(sz)); - if (!ptr || !pgtable_pte_page_ctor(virt_to_page(ptr))) + if (!ptdesc || !pagetable_pte_ctor(ptdesc)) BUG(); - return ptr; + return ptdesc_to_virt(ptdesc); } static pte_t * __init arm_pte_alloc(pmd_t *pmd, unsigned long addr, From patchwork Tue Jul 25 04:20:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325731 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 275DBC25B77 for ; Tue, 25 Jul 2023 04:21:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5CEE6B009A; Tue, 25 Jul 2023 00:21:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B0EBE900002; Tue, 25 Jul 2023 00:21:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 986026B009C; Tue, 25 Jul 2023 00:21:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8935D6B009A for ; Tue, 25 Jul 2023 00:21:47 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5111CB23FE for ; Tue, 25 Jul 2023 04:21:47 +0000 (UTC) X-FDA: 81048835854.19.35EB2DD Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf06.hostedemail.com (Postfix) with ESMTP id 4E92B180006 for ; Tue, 25 Jul 2023 04:21:45 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=llZNAcL5; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258905; 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=1W6z1I6yvWrQZbHmgHYBEGZZDstSbvELOPET/EcKlKw=; b=XKOT4G0a/8uDtC5rvWuUkNWwDPe4WCCi4xfDksAQYZf61r4VarL6ENvkqrivO5SDCesACH sMTrKZdt5eRuz9dLP6hfSZIVRwmCGgAglfFdRmEpUA0Nlvx6yRvdj535HnlWjvUCkGjwko JKM25/AUckzBvrFE8HUhYikuMod0vw4= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=llZNAcL5; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258905; a=rsa-sha256; cv=none; b=r02XJ6/stcXuauTi0RMkgEedVU51II6c9oeOh9sAmOWyoG/KDztid/KPuBG0CloFzS4fEM ifYGaJ6+uM0MnJiTQALUmDUFtXC4kS4puOr2t4v6rXQPK0VzJot8kVS3i2Jo7ZA0dt11Eq uN2xFwtYS/eA/d7o3wDTfs5pQ7vvJO8= Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-d16639e16e6so691797276.3 for ; Mon, 24 Jul 2023 21:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258904; x=1690863704; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1W6z1I6yvWrQZbHmgHYBEGZZDstSbvELOPET/EcKlKw=; b=llZNAcL5ycBFvzQAJZ6/7pTtXuYWij53XzPtouHMRbZn6leKQwmdyrNb7ZQDIKMG1m dR4kHDNfHjwFzi7thvuqMg/yyonddaX76H366KbzQfr0mkb337gkTgeXtW8fYA7C7vgk 0JX1efxIqLTVNU9f3lKJPAHDACzn61fxVyoRKEpyP8P7ERItPl34MD7TyhY45+GL16eR 5mEH9l98a4BvtK/z9rHYNj8+yyPV+LgacWgOs4WnwTXzC4ltuUCUEGWdaUuvQRw4+9rt VkJRX5ILuNF3nkwEu0MY2t+Msy6Bxfzl0kRhh6mJAuamIH8rB6hnYqiG0nMAmPPj+VFo IfmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258904; x=1690863704; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1W6z1I6yvWrQZbHmgHYBEGZZDstSbvELOPET/EcKlKw=; b=E1imSvFrGCjndHW4+zcNgWGqUZ5cMrGfoapnr/obv8JZc0ZeciJODzusL0vuRtB5Rw DBvdiYNw8olstF85nV491WzjoOUSSVaZ+N6VlGgHQ142/7w5v2fc2bA5eeYUVEUdMzTx n0JCDOEkuqzcfDyTsu/quV2foi3W3FZsZ2PBDd12WWhLf84M2TRrzTYzQY2EVKm2fc9k EV7qZBvPrTNbWvpL5y1yKQowL7fxVJn+VWSOsPizzS1J4kDUvB8HO+Mq3n44ry9gvgJ/ +LnVKeoUZkll3sv3gNy6grhuADm5gYfzSsBx7eq0EniLtJY26fv9FqfElY2oH1gyeCdC FmaQ== X-Gm-Message-State: ABy/qLbsFxzbeDP1GdqAq6PJaONcQ3t7lOPec3aJAEUgTCK74uWoOWN7 xmO5E76BPSFBrrlp/9V5Su4= X-Google-Smtp-Source: APBJJlHNukUfyrx8d4ygarvYMYKc0qsL214/d3tYWYQLTsgvH0ZFNOJIIblBNYsFgmKRmFutGU4Hyg== X-Received: by 2002:a25:cc4f:0:b0:d08:50cc:4733 with SMTP id l76-20020a25cc4f000000b00d0850cc4733mr5932948ybf.45.1690258904372; Mon, 24 Jul 2023 21:21:44 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:44 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport , Catalin Marinas Subject: [PATCH mm-unstable v7 18/31] arm64: Convert various functions to use ptdescs Date: Mon, 24 Jul 2023 21:20:38 -0700 Message-Id: <20230725042051.36691-19-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4E92B180006 X-Rspam-User: X-Stat-Signature: 6hs7jtdq5idtac6tysde5sp88oeuxobq X-Rspamd-Server: rspam01 X-HE-Tag: 1690258905-822132 X-HE-Meta: U2FsdGVkX194UL7GWV9p7m5epO/QNCmezEzkRzrdlqpN9wbK/RIjUyjtcgcUxhJMIDL1FoRuWJvazAYw8/BzBa7Y0BcXiePyG/DUgVyn6XEidbRZPdWbux8Yp0UI8xBsMtA12MJoQGxPq5A7OmBp43HxnLyoF0IZhHAo6JsIfX9tzPwesb6J1J6q5sB5ZfiAKA2onmYC+z0yuUCXxBRubV2Es+10qcgt/8F1X4vFh9l98gGUBvQ8YNwvfYujSt4wPlJ6keG8tiSwaY4nC/OXkjJ1Ksd8pblvbl6WHNvT+fDsRAZE4QN1xZaIAOLZJeuE1X1E7pDcSOA6s7Gf6iCz5FWeXH/QZ/pz9hr65j/9EJ/J+jjXOQp+23wPohwFpA+OhHdksH10fsioDX8F0w+ncdFcTkVYtXaIba3vplaMbKZh5NN9Xy9m+AEn35Bd+/NoTQ3nfUQRauQy699zk4NCf0S0xuzqqteT8AphitbXLK6y/yYgf6PlsoGGBtsQsANa6HHrMK/oaDEv22mAzIBqMbEvsxIJHz5yScPLtXTEmPb0XvE8q1Ni1cVdpJlni5lSTra93tK8EMte0+3m8LFRJ47eNOpPmhjRVAT5VIQsrx8EaoRNJP35RxJCpgnO8SKDri5Hbp5V8a3kOO/EP9FAkWvUssq+Ccz+YwmdRHP3XMBO32tWWLKLjK/2NfEeuNIaU74bGLQNZLHL+NPXFYt2LkqhNiQoDmBWBCr2Jc3PTvt2wr86hnf5NlcU89RGXtdXu3kIGNpzMwc6oSPEvmAwrDIYizYhmXR15wcEla8EDXFeJyooV6+nSgNwAWwB7TgABZHft6hUadreTCyCI/ipJcXcMYClTjrhuU+jx3HR9emMaOsSJPI4LCjn4IoRD8vGQcXIe/spDenSIQVqN2XlnitVGno6BEm2axUzwc8L18mHE2oOCU0b1msHyNtmSLaRTpgkV5ev/+WCBOROGCz kvsVdwMh QejRC+m5Zjcana2hLpq+Gf2ca+lNsAKX37qkBhRE1vaZ83AclKXfDl2O7VRfh5U2gC7D+kgVipJeRa9DnxQzx9mYHEkuWqdWBuNdZdbjQGwDNj4gmwyWA1+K7SLWHzFOwOC8QiJSm0p6Ls+jS8zlPUDYfAGdRy4muxUjoARxJQx8UEERVQVTzxHqgXI7d5zGyebPIPTf8WA8zwrh4cwWCFptpCTbrzSIMHLOnPbYfWy9lCRtBqVLAuD5XJd1w2MnFoGoODeipsowx9qNan0r7ckLCIA1IuDWpxGla1siL5lXR81Kj4V9sX5xBBzefjufkMGyS2cT7zq7lGEmITRyqB/Nbs/9pGfLfr62uZmzWr1ycyYQuKDlfwLVmxfrFLv/M2eyduAY4DXmfNNkwJRu/PFynAS3hpPCH93ezu9qXeLkSlON9rggwB0wVd9RM/ofK77n1yyjP4Ce7o9NGqX0tz+e8u1sgFv4Dn6Ysz6IpDzEea9A7wTMPAbg03dSOk+bTOfTOhF2pq6+GzLripYCxtMeuNX1m9RiCZ4U6/18gE/B1IV2xe14x5UQlHJeSTknsvwljbbggylf6cmj3K/WO7bsUh4K1/p0ZFQdD2Hsi+OX1Gd1WLJfUX8wD7TA182a6JSQQAnpBFd/IzZPSuL2nsi+fBg== 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: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) Acked-by: Catalin Marinas --- arch/arm64/include/asm/tlb.h | 14 ++++++++------ arch/arm64/mm/mmu.c | 7 ++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h index c995d1f4594f..2c29239d05c3 100644 --- a/arch/arm64/include/asm/tlb.h +++ b/arch/arm64/include/asm/tlb.h @@ -75,18 +75,20 @@ static inline void tlb_flush(struct mmu_gather *tlb) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) { - pgtable_pte_page_dtor(pte); - tlb_remove_table(tlb, pte); + struct ptdesc *ptdesc = page_ptdesc(pte); + + pagetable_pte_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); } #if CONFIG_PGTABLE_LEVELS > 2 static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr) { - struct page *page = virt_to_page(pmdp); + struct ptdesc *ptdesc = virt_to_ptdesc(pmdp); - pgtable_pmd_page_dtor(page); - tlb_remove_table(tlb, page); + pagetable_pmd_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); } #endif @@ -94,7 +96,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, unsigned long addr) { - tlb_remove_table(tlb, virt_to_page(pudp)); + tlb_remove_ptdesc(tlb, virt_to_ptdesc(pudp)); } #endif diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 95d360805f8a..47781bec6171 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -426,6 +426,7 @@ static phys_addr_t __pgd_pgtable_alloc(int shift) static phys_addr_t pgd_pgtable_alloc(int shift) { phys_addr_t pa = __pgd_pgtable_alloc(shift); + struct ptdesc *ptdesc = page_ptdesc(phys_to_page(pa)); /* * Call proper page table ctor in case later we need to @@ -433,12 +434,12 @@ static phys_addr_t pgd_pgtable_alloc(int shift) * this pre-allocated page table. * * We don't select ARCH_ENABLE_SPLIT_PMD_PTLOCK if pmd is - * folded, and if so pgtable_pmd_page_ctor() becomes nop. + * folded, and if so pagetable_pte_ctor() becomes nop. */ if (shift == PAGE_SHIFT) - BUG_ON(!pgtable_pte_page_ctor(phys_to_page(pa))); + BUG_ON(!pagetable_pte_ctor(ptdesc)); else if (shift == PMD_SHIFT) - BUG_ON(!pgtable_pmd_page_ctor(phys_to_page(pa))); + BUG_ON(!pagetable_pmd_ctor(ptdesc)); return pa; } From patchwork Tue Jul 25 04:20:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325732 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 9FEF9C04FE0 for ; Tue, 25 Jul 2023 04:21:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E382900003; Tue, 25 Jul 2023 00:21:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 36B6F900002; Tue, 25 Jul 2023 00:21:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2330E900003; Tue, 25 Jul 2023 00:21:51 -0400 (EDT) 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 13BB4900002 for ; Tue, 25 Jul 2023 00:21:51 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DE119B242D for ; Tue, 25 Jul 2023 04:21:50 +0000 (UTC) X-FDA: 81048835980.25.D9C739A Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) by imf13.hostedemail.com (Postfix) with ESMTP id B142C2001B for ; Tue, 25 Jul 2023 04:21:48 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=isSLzJlV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258908; 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=/CuYJ7liBLmFxtlpmCAIL/qtog0vkZLk1dVk72P32nA=; b=ucnNARsq2KMfx8sEdIjfnO4MuJJbxJYmVuB8xHFU5d9ybLLvWaQjiEscVRiv7Ke44jdn+n r24Q/mKD6JtbOvCGYhv/f3UGn5AY7axAu9jY4w+YlLZ8r1EDwQK78BOSUxP1IJ3GdF0Xxu DBIHz3hyRPqcbLT/t2aWouwXAQKtoLk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=isSLzJlV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258908; a=rsa-sha256; cv=none; b=zKH20UFQMDVWo3bYQ/lXwpaKxRt/6dLgdpnHR1eJ+mZRxfLyDEzkqZv2GIUJ/djiEs1231 5kj5miChMU00vQW4epOnVcF3nEfIffUilV01W+QLK4TEdAFA24kN+NfkwxdzHZbdqvdSc+ MYlV6xiuvqL2aOogl/En7s8+TwFW1kw= Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-d129edb8261so1958253276.1 for ; Mon, 24 Jul 2023 21:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258908; x=1690863708; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/CuYJ7liBLmFxtlpmCAIL/qtog0vkZLk1dVk72P32nA=; b=isSLzJlVCcu3DqkromZhEI/qWyA5zzmxG1x9IbP6194I1DKOByM/hDEPdxe0FV3MLw d6Rw+lHZ9WlgptdvBWiFzGMaM6KUoRlGp3xu2jda8iMy45KiL59BtGKHYho8dHuVUxG+ hJLuMObqibUKBJwga6VwRPSAoh79vGoLNGxF2cxBKo1aHJdauK67/yOhDfLuLDKzblyJ F0wgtxLKGut1KlZ4xgsSxueuM+T0O4hKbp6cFWk4PiHYX5rGa1VxC3c5t+U93CbfreQA BhDLct+PPc5ibyvQ9RmPu/T+BvIQhbpSiLzGAmfokkxsUZTkKg3EAjaoANJECHoNxZLs xbZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258908; x=1690863708; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/CuYJ7liBLmFxtlpmCAIL/qtog0vkZLk1dVk72P32nA=; b=QlfNDnSnO0eShzb3Z8TJldC2Cod++ISjkc0IHvxfJ3rZdBhdv4ez+YkRL1eOswU37x O+WrLKKv41oo5lE0hhyMdeo0X5Zf3SQxknH3n6QWnBEadzFwSD1DOT7Kp4v8Et1dpJUZ xWtCN+/dOa+JaK9iAQBk8ifyisMX3JQIERSZPfvHhtDUtF3ejA75h86LdmfFA2c6PU6E x2V+QWh7s8Xc4k2bMyXh1OpfGVrQh+ut1wsD6UxDS95zsblmQbtGOQn1No7ea8GsmbWC vNwtl233zysVrrt2u+X5lTZXK+v/XsEyP3GCYBJqzUMPV0I0zXYziLgRXBtMLJOIslxT NXrQ== X-Gm-Message-State: ABy/qLaEAbza0pXs04ZCiPeKY2n27vbKlELD3f612FRnquULhu4icllv GHVJ1yohHq5k7d6eKZxOjP4= X-Google-Smtp-Source: APBJJlE3eJKl34GJI9esPlRffLNepF5AyEOkc7MEH4MKJMttiyYPB1pXgCmUyzmySa6Xjpm5Cuhodw== X-Received: by 2002:a25:b08a:0:b0:d07:1a89:2e73 with SMTP id f10-20020a25b08a000000b00d071a892e73mr1367996ybj.28.1690258907697; Mon, 24 Jul 2023 21:21:47 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:47 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Guo Ren , Mike Rapoport Subject: [PATCH mm-unstable v7 19/31] csky: Convert __pte_free_tlb() to use ptdescs Date: Mon, 24 Jul 2023 21:20:39 -0700 Message-Id: <20230725042051.36691-20-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: B142C2001B X-Stat-Signature: 38x9ky6kuy579sp7t1s6i7rdf15jt6xa X-HE-Tag: 1690258908-8441 X-HE-Meta: U2FsdGVkX1/nlqgf9EPT60zPkelIf1nxqtgItDK/fzPNrEcp9PnWtfTkhrhYMKWH2JvPGFVqWyIJ+yDcRKGTdJcXQA6BgAL0olKquSeWeJvdi3tBbHCgQ2AeMm3QZTCLttyjTIYX30rEgt8aJK80PmMTiUZ3H3PQT7WVQaH7g51mpH0nlsAA2dDBQEYFZkdQ4cBiSZIFpa/OVa90EwkXC3mxnitHZPwQAUMdU+n+TEhaV9Wz77qj/rMI8dXeQ7FNpziAjtXOiaOeMEzj3dtjudjkhTaiy4clw/u+uwtBf5rgBBtwW+6glh0JfNNdX/sglG6RgTn6wDJpxTA2oK4kI1kD4hcYRn50tHFcGu/AvjuwQ6xfYEAiuYhLr3eXkAq2kY64/xQ0yVOb1quXCk48Kz8cV95dnowrlB7zlk0mOd91ZdkfBsbNn4lqQUUE2jukHSP1SgxpIBOpsqz5chtKzoF23TndydywZSBWZnHMUOu3F0fbzt0ricWnAiCli/zqSoN8urxEvEdmwWwg2zSLLjsEDl7iI8OUozpUQKTd2ha4dVNm8pVWUWZ5t4WBPZno66+je2HpC52fdQL3lme9r1eJa0wboAQ4GtK7cx9bJCWWtlE/VBBLWm9BUxSdd4M2FZO3NRVjSZAm8q4zj18ozA+anARFgoRhi0rzC2NLedljNk/3vJRk/OzB8eujZ93unJsTxicqP9m9VfP6lxJMiX8uAt8i79tah3TuBO6GFUCpqEZWYhP/PKT6JyeqgKCGn7++y0aZptVdadlFT+9Oa9Pfuzv5F9ZiXO/+LI7Dlpw1iEuesPBwHs0UL91zvvT5DB+mkBlscyJqY18kcJVnBOl70tfV606OD8W7d+gAg/0z/LEMm4fcXkAlH6nwj0o1kmvGPtLUbPnp8p/4selu3TNtgtzORkuwa27rWYnwIfiwe/dzo9EYc04s8tRYUyKj7aZd5UMNq230M/VLfMe tgn6Pn2g U3llEs5cIFZSf6aO82l5pGhzD/gClCL0Xjy6brZ/pBEaXSK0G5MaA4owKKIsVJDI6C5qQiO0Oy2Kgq4Wi0/BkgpgC9V0EpBKLxXJ8D7t6alpO4xIQh68vHT1Pl+dWZddfZlt1BrS++vCzRvbACjiJqOUSFM00wu2Ecaot1LvfnsnnCPhfvyYqCUVGbUlXF49JmKS3pt5dutnKBoLoP4NBqJatY4Epr0FxHCuw1uOu16edQD2oTeYG0jHqI2q2D3J4zWkJVOvd5M8IZF9V2CFFHlYr18hdf2vnAEBLMKJ0eS9WBVPNoNzhj3EzTZx1m/uXlJO4meEtCQoMJCq2N0M2lnmBoNox7CUQSSH7kBAf7W2lA2nD5kzsuqrS7vjyThabpX9C3bs28WOwyX7vYRy3TOYaQJ7F++immNxX5uAeMC5mmULtQ2Ifk7eByoaDQNOagSQoG09YhXtCjMNioAKACKejNrO4olgQX4WzWouA59mbWek226HuRHkdJWzrc8vwgofVx+ON62Yqh2jKT6DRg++sPzackxZmUEgJI4WwbChrPMcZ2SIQEspSs5LO7EeJf/q1tnAnrByXMgGNP/MfHPRbGjSpXp38VVQS+xNDeYTKFzmNaVqjnwX+BKaEGTrgIk1rOwjyDDe1QBI= 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: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) Acked-by: Guo Ren Acked-by: Mike Rapoport (IBM) --- arch/csky/include/asm/pgalloc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/csky/include/asm/pgalloc.h b/arch/csky/include/asm/pgalloc.h index 7d57e5da0914..9c84c9012e53 100644 --- a/arch/csky/include/asm/pgalloc.h +++ b/arch/csky/include/asm/pgalloc.h @@ -63,8 +63,8 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) #define __pte_free_tlb(tlb, pte, address) \ do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page(tlb, pte); \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc(tlb, page_ptdesc(pte)); \ } while (0) extern void pagetable_init(void); From patchwork Tue Jul 25 04:20:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325734 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 7CBE1C04E69 for ; Tue, 25 Jul 2023 04:21:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14B07900004; Tue, 25 Jul 2023 00:21:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F2B30900002; Tue, 25 Jul 2023 00:21:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D3081900004; Tue, 25 Jul 2023 00:21:52 -0400 (EDT) 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 BA837900002 for ; Tue, 25 Jul 2023 00:21:52 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8A35C1604E5 for ; Tue, 25 Jul 2023 04:21:52 +0000 (UTC) X-FDA: 81048836064.21.4D792E6 Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by imf29.hostedemail.com (Postfix) with ESMTP id BFEF5120009 for ; Tue, 25 Jul 2023 04:21:50 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=f6oxEdex; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258910; 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=aUnc1suNAj/KzreaB6s7vAsOWiJZx3FNBLzDbQjj/SU=; b=ILGRb4HWJbw9cwbqRZdbHLecKo2dUwWT1yNHa3rMQcMnj3OyAmBvl9vbUtnOuC3qEJDQFF +0w4CG7f/FsBtT1PGubf6hfeWR47+Uhu9s/RSyIBpwzt+9Z584SgFRu8zk2qleTjMCRyee atbMHu5jdZe6Cg4faNi9F5S9xaUWs3Q= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=f6oxEdex; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258910; a=rsa-sha256; cv=none; b=WZZjWe9ybwxzeau+fW/4cU61TYHetk+fisCMXzYQ3L/n1Y8q08t6ARG49wy8mhrhfnlHQ+ WP6UFpgjLbyAXxogmS49hJRQJJet/t4BMi2RieYZPSJuRo2txopdK7mU/bBKyVBVv9vk0K ZG8ABezjOLEVrkXxwBOTfkvULyKe0kM= Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-d13e0bfbbcfso1762028276.0 for ; Mon, 24 Jul 2023 21:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258910; x=1690863710; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aUnc1suNAj/KzreaB6s7vAsOWiJZx3FNBLzDbQjj/SU=; b=f6oxEdexqW7t8O18O1zlBzEMy1/ySz1lSWwZIgvC+6ZdC+AQVNOOjrUGsL3n8z9yLs jC/oIvWOegKfTXKYCqEjhGYC8DO1R1+qqiiOoaRmFe+GV40qDgP7vCBrkhQ8/QoelGjZ 6zYUNV4SeVX24QIWi1/OsGEJx1KydkZGoq9ape10nJTNyMWr+pQqOvmxVzCb+3U9sgmC ze1LeRMHMeTo2LxUzcGxr55PmnWGKX2eITQpSi6L0WDbS9ycLs9Jos/2PAo+dLuVd9aS LiJCpXRUIDud7YKdN1pv+EIwqPuZ42v47LQ3yS2kQDdlx8gJ3/GU5UxByOmc+boocCVB ZyIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258910; x=1690863710; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aUnc1suNAj/KzreaB6s7vAsOWiJZx3FNBLzDbQjj/SU=; b=SgFCzGPiramtAxnDaOCB+2KN6UafI1BnUDc3iefi83IasHxzesvlVDn3uP5ODX8g5M V1PRzisup3KHoydzxHnUJFAk/VsYF7KP7Qgcp0RO33scxerJuEQVz+LbrC6afYPM6oAE 8RGj0FHupDBYCUsCW0SPlVNP9fdffiVzlwXiyoiAvPjPECEywcsAoWtUbXTqpeX6nuZY 8Y21jFhC28yLNjE2y1eEPrbWLl3XXRSFAHOg/LFqV06cq28m7nHF0yWuVE+r7rOST9ls w9pTHrzZS3zN7UJ3q87jAIZ/pKtZ5eqmYZppDV6b8YSuPbZSDe0dxFBm4fWoSAjuDD+U zqiA== X-Gm-Message-State: ABy/qLZOGiRB9pwk0/7yoY4xbmOvBZSml30oTLs1bTw6qcqH1bq7DYNe eincSmfOgyS1vG/i+SM49Tg= X-Google-Smtp-Source: APBJJlE5+Qlh5eptk2IDiumLzwzdgKuW8E4L+dGkDhCtXpTjXCpZJt13f1YzsO4C3URc73BGKhlHpg== X-Received: by 2002:a25:6814:0:b0:d0a:3876:a22a with SMTP id d20-20020a256814000000b00d0a3876a22amr1377987ybc.4.1690258909714; Mon, 24 Jul 2023 21:21:49 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:49 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 20/31] hexagon: Convert __pte_free_tlb() to use ptdescs Date: Mon, 24 Jul 2023 21:20:40 -0700 Message-Id: <20230725042051.36691-21-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-R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N0cf92oKP0L /EvuQOCG ccOov0Hf0tUA2WpJOo8jxg21bi0gHpOKcwgCNc6NQNwOzrnH73MqhRJP+SGKDmHhOIxazwgnXhFsWL0mx4OUEHhBuHjOrOwnmN9E+wtP/VuAkAMslZtT3iSOu11g7jXRag8eOYmCPI9PissSZ40vlhtjOwnO5s0Q8HGlp1QKC0covLxO9IC4bqjdYcVY9eDmRKkIbDkwgEaI6voR/+1zEzxNzWfFrKZwukfxMVzT5HZu+qnirsjx1nq1xEQyKeJiaEz3MT2d+QNHuBniaFfalXA1gv3T952WpL0u46y+GeHDXf346NzF1m5cjpI0Ve4pVYG/Aanhzjb7yxWXeH3lh1QYrOOHVPWjDRStsFklEw7MBGgOcWFIkctcqCKepNQ+3yGah+VTJ3HbrSWDDr6bWVAafA06mQC9KRwescnoa2dSYUSahRXqXnR0ZhTmVpYQees5+Sm0df4IHvn08NctK+RgoF5iRfAZUMFNtlKRE4i/2OhA0iyIP08bsG3YjnlivVY+PtPqC5l8NuP6ev2RA9yh6LDw/y27SVzW0sWRmp1CDj/4= 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: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/hexagon/include/asm/pgalloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h index f0c47e6a7427..55988625e6fb 100644 --- a/arch/hexagon/include/asm/pgalloc.h +++ b/arch/hexagon/include/asm/pgalloc.h @@ -87,10 +87,10 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, max_kernel_seg = pmdindex; } -#define __pte_free_tlb(tlb, pte, addr) \ -do { \ - pgtable_pte_page_dtor((pte)); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + pagetable_pte_dtor((page_ptdesc(pte))); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif From patchwork Tue Jul 25 04:20:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325733 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 E4B6FC001DF for ; Tue, 25 Jul 2023 04:21:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7651E900005; Tue, 25 Jul 2023 00:21:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 71555900002; Tue, 25 Jul 2023 00:21:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5DE87900005; Tue, 25 Jul 2023 00:21:55 -0400 (EDT) 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 48B7D900002 for ; Tue, 25 Jul 2023 00:21:55 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1FC3CC040E for ; Tue, 25 Jul 2023 04:21:55 +0000 (UTC) X-FDA: 81048836190.13.D368DA5 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf21.hostedemail.com (Postfix) with ESMTP id BC0821C000B for ; Tue, 25 Jul 2023 04:21:52 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=M6jRKuiv; spf=pass (imf21.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258912; a=rsa-sha256; cv=none; b=5TgjIh6fmjjKUMcNHM1qhvEvPWlYVqfZ2hKBk6HeexL4hmOTYeoC/B/bdycfOtXnudUoHz 2q1MgSp0BXRfENzDUZ2AKhPPVGON220sxezv597F58mmvNHPSdTaxymYVMvC4Hus/2oND3 UB9FXs/t66EkFxXnJEvoMNsvaNMi4+k= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=M6jRKuiv; spf=pass (imf21.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258912; 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=pBiyp2dfMpzV+NvCt1JbKOh6Ic1GEYp83948mVxRzoc=; b=F9pjqRMMdsvb9IhOLmwsQMetaTQ+QgB6dMglfNdI9IpSWC4gcn8LuIAG63UzlpMK+hFZIJ JPqPO8FzprSxvgYfnsiMn9zF+yYYN7q5sHX7WYYj1GV1YwsSDfO0lBWSLhnVA1tJl/p7gp oTFiC6+RhQ0Po4KtFUXBGu/c6m8geZg= Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-d08658c7713so3153908276.3 for ; Mon, 24 Jul 2023 21:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258912; x=1690863712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pBiyp2dfMpzV+NvCt1JbKOh6Ic1GEYp83948mVxRzoc=; b=M6jRKuivh8zjiemd5A6uxigxJohHpad42drXAXZPo/WrWX/VH06lIJBZPBsy6q5WUU sx0lJdOkpQ0kaLkBOuxv3JTr0MrJ9mxzZ+UUwF+trvlZXj+IJfJxZEoLsbjBtENoOnKp r4LPLa1pA9aLy86FefeD5kRctnKeFj9h3GxRlhN5hCXqNjunVSlk6MQa/3J7EWf+g7LP GgIUvItIu349rIBsGC+5p4KYn28jcwcdvYVyudYGHQ4Rpe+/D34t/jp9N4BHJAtnbKCw qFN4cKxe4NHkjK6LRf9V/I6F5RMPandO1u3QcQV36zYYu50WN177HZ6ueUgU7U2rKCNZ UtKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258912; x=1690863712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pBiyp2dfMpzV+NvCt1JbKOh6Ic1GEYp83948mVxRzoc=; b=hRA/RG5vyEYPV9TKzWsytuneSP+AWmUGQbLDt2QWRHwCK2Ee9JEL3VwtpRbpcsmqCj DGjZjgu/CP6YC+udsMbodRRDGYAeLaurE24L2NYlDMdbcjgjBW7LRAM+Nn3cuLdTicbF Jw//m/hEV1uXi7G9TMF37E0SGIQmEuRYih8WEIaJA627boqT/l9jznIXr7dBTS+vK8Jy J8+QbuUv7B5VOPdyfjOgypu5QO9q/DqKbwKii1h25TfHOpCLbyebDR1BBT08qxvunEI1 UuaruV+4opzvqmopBtQnoiJpq1FABgqvCHNj8wDQBAfWVo4SPtBXawZ1cz2aoIWng66a lZdw== X-Gm-Message-State: ABy/qLanpS8ymWQAtO0Dvz6f7n9v3qXmFtawbdihrliUrMqb4nX0cl6d em+iS7I4+MzidMmpbkJm7Cc= X-Google-Smtp-Source: APBJJlHmWGng2mD7r+HORvYbViNahHExZyfg9AnaCMkhuF9zAe2z+T72MtBm8rxbTIBepY55dKGlDw== X-Received: by 2002:a25:2547:0:b0:d0b:f845:c831 with SMTP id l68-20020a252547000000b00d0bf845c831mr5748800ybl.13.1690258911713; Mon, 24 Jul 2023 21:21:51 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:51 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Huacai Chen , Mike Rapoport Subject: [PATCH mm-unstable v7 21/31] loongarch: Convert various functions to use ptdescs Date: Mon, 24 Jul 2023 21:20:41 -0700 Message-Id: <20230725042051.36691-22-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: BC0821C000B X-Stat-Signature: 6a3roawsiqb94jhr3bdi8raxohdp3ea8 X-Rspam-User: X-HE-Tag: 1690258912-464728 X-HE-Meta: U2FsdGVkX182h8odw5uzktF/VrsSsMEb5wRmVu4SoHrNdK6w+N6TcxpBVgXsjE0xXV91b19nS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aq6e6XvX2agaGjGKajX4bCyJFNWGowWowkEELtjbKbRFHUi51Bh0KmPsQ+M3Unu2gJl1W2W4od4KQ/L3DiqSsLINnh1YMu/LS4+Kb5Dro5gJTCxkus24z8hEr2HQdNRTnaYN2W8U9+gneCdru7rYPLTPxNGJcGYHDfSjhaIKOIzfsm29piHYK8ADmcbTISCksWRvO7cjR748G4H48mRckO1uhY+9XeydZrIdVjNbmSeccvCD3dLCv9C/72E8gYlkeW8oT+GBiqKE05x7QfDARv71hvHgs9SF+E2jMGdwkcnw6q3pqzWES57Q9Sw8wWHn7lZe1Pvuxtg9w2mV0lUTQFWPtQQ/+pkPnB0i0JMnNDIAbJIsSsvXNMMbMkxmFnyuEMsv7pVyLURdBHrYu5GofLGb6Pw7U4KiND+goxmbSQ== 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: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/loongarch/include/asm/pgalloc.h | 27 +++++++++++++++------------ arch/loongarch/mm/pgtable.c | 7 ++++--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/arch/loongarch/include/asm/pgalloc.h b/arch/loongarch/include/asm/pgalloc.h index af1d1e4a6965..23f5b1107246 100644 --- a/arch/loongarch/include/asm/pgalloc.h +++ b/arch/loongarch/include/asm/pgalloc.h @@ -45,9 +45,9 @@ extern void pagetable_init(void); extern pgd_t *pgd_alloc(struct mm_struct *mm); #define __pte_free_tlb(tlb, pte, address) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) #ifndef __PAGETABLE_PMD_FOLDED @@ -55,18 +55,18 @@ do { \ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) { pmd_t *pmd; - struct page *pg; + struct ptdesc *ptdesc; - pg = alloc_page(GFP_KERNEL_ACCOUNT); - if (!pg) + ptdesc = pagetable_alloc(GFP_KERNEL_ACCOUNT, 0); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(pg)) { - __free_page(pg); + if (!pagetable_pmd_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - pmd = (pmd_t *)page_address(pg); + pmd = ptdesc_address(ptdesc); pmd_init(pmd); return pmd; } @@ -80,10 +80,13 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address) { pud_t *pud; + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0); - pud = (pud_t *) __get_free_page(GFP_KERNEL); - if (pud) - pud_init(pud); + if (!ptdesc) + return NULL; + pud = ptdesc_address(ptdesc); + + pud_init(pud); return pud; } diff --git a/arch/loongarch/mm/pgtable.c b/arch/loongarch/mm/pgtable.c index 36a6dc0148ae..5bd102b51f7c 100644 --- a/arch/loongarch/mm/pgtable.c +++ b/arch/loongarch/mm/pgtable.c @@ -11,10 +11,11 @@ pgd_t *pgd_alloc(struct mm_struct *mm) { - pgd_t *ret, *init; + pgd_t *init, *ret = NULL; + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0); - ret = (pgd_t *) __get_free_page(GFP_KERNEL); - if (ret) { + if (ptdesc) { + ret = (pgd_t *)ptdesc_address(ptdesc); init = pgd_offset(&init_mm, 0UL); pgd_init(ret); memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, From patchwork Tue Jul 25 04:20:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325736 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 D8C10C41513 for ; Tue, 25 Jul 2023 04:21:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D59FD900006; Tue, 25 Jul 2023 00:21:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D302F900002; Tue, 25 Jul 2023 00:21:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF777900006; Tue, 25 Jul 2023 00:21:56 -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 B0588900002 for ; Tue, 25 Jul 2023 00:21:56 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 8C3A280818 for ; Tue, 25 Jul 2023 04:21:56 +0000 (UTC) X-FDA: 81048836232.03.9FB5114 Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) by imf11.hostedemail.com (Postfix) with ESMTP id C691E40007 for ; Tue, 25 Jul 2023 04:21:54 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=PXib1Cao; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258914; 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=PAg5qbCpsu4QeXC2CiYcNVSx9jEaugPagVbNncebk84=; b=EWm5/RxZ/aKtO2zSCmVjeK4LdSS/08s0qG/oFP0kpYay56bJhP2Ev0IPvxquicED6UkVaE ncVrFLrEWb+zAJeIcw+CSMkJep3jDIwTRl/8ZO/i45RDsd36kX/QFxi0mjVXR0J64KIsAG aTC6kmb/HC0OnXK9uijRntM+4suSrVo= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=PXib1Cao; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258914; a=rsa-sha256; cv=none; b=t1k+HXQG08ZJ6PerG4Oy9hsoRXDi22DxZP2YRz0psbO1ycziUt95/alchu7HJqUkRIdOpY kT0vsE60VQN/d13U1HX2+7v8tmOlIc8q9VSscO9kO/qqYPEI6OmNFkWVq8RabdQZsyhVrY i6stWAs1cPIewwBa1e3YLVKoFvE9wRQ= Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-d16639e16e6so691892276.3 for ; Mon, 24 Jul 2023 21:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258914; x=1690863714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PAg5qbCpsu4QeXC2CiYcNVSx9jEaugPagVbNncebk84=; b=PXib1CaoeptK69/6qIILztnTaPIyTv5YQR6TlThXrcj/XpnovRKNC9dRvmGTlMVJ+Y 8clpfWi14Fbd16+bMMcIRSu1RjPFhxm0HGFSqSbVNLXv71Rm3nby7GTQmmhFhxR6Fe4W a+uFGPq1sDojuKpfGHqkLm54qltGyV31LmZTGF+k48o1qYH0m7DJawnWKwrZ6fgwSg9U SkV3boxZmuDGmlSDQsQA0yQXTmRpMU2gDvzpay51JFwtkFxUR2TcnLVayYqi4qXpl0OW +6iL34M/ESeTyP1F7hG3vKsG74iuD4sY6ImSrnr2BOLiIrK5HdmfLQg1v5h+YsRalPF6 ymFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258914; x=1690863714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PAg5qbCpsu4QeXC2CiYcNVSx9jEaugPagVbNncebk84=; b=i1a6nj6AyJWlZVNrPH7OBVoEdrpdmsj6d3OCB2Ydk9DY2lJUoi1QYlvAIET/RnEiQ3 FSfi5Etox54l/jD0mim2bcA1ge6FzbD/cmGJ7zx+9A8DxuvWIu8g79kdCKmHQ5V0ZDaY Q1YkV2r/Y2PAivuw2F/ccL+8fW/HMXmSDQB8aVt15zJCeHFIx2BbqAXGVGLosVCyo73l dxSKZJ81CgS7EEaqBjid2Kw3f0+2eQLF5ifZEprkAWdnE69+N6f82IvQ72iwkTQmppHF 2IHTsPX020P7NbLPktQJBm2Q/3eJRs3hIJcm+V5EMfQp9pDqg90P4lq8yX3Il4YXeCeG SrjA== X-Gm-Message-State: ABy/qLaeNy3wL8qvoMM9JHi1BSqQrKL4KksEay1JthO7lSt1hwiY4RHn t/9CWwNDBaWdsA1QB55I7s720ZC1a8wlTg== X-Google-Smtp-Source: APBJJlHF/0iqvuKN3GeuQCQLqa/Csn12p4p6+Y/7f8hKrU53tH/yWNA7sehk6j4tDPYcgh4VwiCADg== X-Received: by 2002:a25:d57:0:b0:d06:7064:5209 with SMTP id 84-20020a250d57000000b00d0670645209mr6311982ybn.22.1690258913820; Mon, 24 Jul 2023 21:21:53 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:53 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport , Geert Uytterhoeven Subject: [PATCH mm-unstable v7 22/31] m68k: Convert various functions to use ptdescs Date: Mon, 24 Jul 2023 21:20:42 -0700 Message-Id: <20230725042051.36691-23-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C691E40007 X-Stat-Signature: g787xbc96iakedf5he3oznss98goewqf X-Rspam-User: X-HE-Tag: 1690258914-558882 X-HE-Meta: U2FsdGVkX1+cVmyhB59Dc+Pv8Avkk7tmCZcTGejBxIIZtT0WDecZlr5SL2uPqzXtlcRMWwq0GKnGfAorsBX7i6OGUmxi6UZBjWCwyNYCq3uSPYFz8jaijV3oEVoO1fpM/LrnORgtXxBsggZHh1ImWnzpma0hsOTyS+zaII8UmFdlGH2jh9g3fRbv5OQq4qvfZ4GijOSgl0DuhC+FF9BUhQ0BxkENNsQNdA1sEmO2F0edi02E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EyIXAMCuUJccHd/rfE0VGnSee/bsIUUjBbxqTTkMo7Xj5D1hfcoey9c/HlTsl/XXi0/2mzudbxC86Ssm+YS1n1QqzYzDdKYMnwIL5+YlL8DYN8OAppbx6slScQEAV0/qeQzMABuM1XAUM2oDg2RJWobv1G9OFKVWjJXYNxS1a+oMeSsCjjFMYJInBdTiiz5PBzTng/Zqr2GPjS/FEBLRE+EhjZ08w7jOdgo1E9ihgRe99qJXOpAr3Jef56tyhDOOSG/wJlaVbCzNxszuwSnwDSp2dtZYmVkF6Zc4hDMc7nK0FQxuCMCz8VjVgF/uOgWQElDjVHnUTA== 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: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) Acked-by: Geert Uytterhoeven --- arch/m68k/include/asm/mcf_pgalloc.h | 47 ++++++++++++++-------------- arch/m68k/include/asm/sun3_pgalloc.h | 8 ++--- arch/m68k/mm/motorola.c | 4 +-- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h index 5c2c0a864524..302c5bf67179 100644 --- a/arch/m68k/include/asm/mcf_pgalloc.h +++ b/arch/m68k/include/asm/mcf_pgalloc.h @@ -5,22 +5,22 @@ #include #include -extern inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) +static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) { - free_page((unsigned long) pte); + pagetable_free(virt_to_ptdesc(pte)); } extern const char bad_pmd_string[]; -extern inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) +static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) { - unsigned long page = __get_free_page(GFP_DMA); + struct ptdesc *ptdesc = pagetable_alloc((GFP_DMA | __GFP_ZERO) & + ~__GFP_HIGHMEM, 0); - if (!page) + if (!ptdesc) return NULL; - memset((void *)page, 0, PAGE_SIZE); - return (pte_t *) (page); + return ptdesc_address(ptdesc); } extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) @@ -35,36 +35,34 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable, unsigned long address) { - struct page *page = virt_to_page(pgtable); + struct ptdesc *ptdesc = virt_to_ptdesc(pgtable); - pgtable_pte_page_dtor(page); - __free_page(page); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } static inline pgtable_t pte_alloc_one(struct mm_struct *mm) { - struct page *page = alloc_pages(GFP_DMA, 0); + struct ptdesc *ptdesc = pagetable_alloc(GFP_DMA | __GFP_ZERO, 0); pte_t *pte; - if (!page) + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - pte = page_address(page); - clear_page(pte); - + pte = ptdesc_address(ptdesc); return pte; } static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable) { - struct page *page = virt_to_page(pgtable); + struct ptdesc *ptdesc = virt_to_ptdesc(pgtable); - pgtable_pte_page_dtor(page); - __free_page(page); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } /* @@ -75,16 +73,19 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable) static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { - free_page((unsigned long) pgd); + pagetable_free(virt_to_ptdesc(pgd)); } static inline pgd_t *pgd_alloc(struct mm_struct *mm) { pgd_t *new_pgd; + struct ptdesc *ptdesc = pagetable_alloc((GFP_DMA | __GFP_NOWARN) & + ~__GFP_HIGHMEM, 0); - new_pgd = (pgd_t *)__get_free_page(GFP_DMA | __GFP_NOWARN); - if (!new_pgd) + if (!ptdesc) return NULL; + new_pgd = ptdesc_address(ptdesc); + memcpy(new_pgd, swapper_pg_dir, PTRS_PER_PGD * sizeof(pgd_t)); memset(new_pgd, 0, PAGE_OFFSET >> PGDIR_SHIFT); return new_pgd; diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h index 198036aff519..ff48573db2c0 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h @@ -17,10 +17,10 @@ extern const char bad_pmd_string[]; -#define __pte_free_tlb(tlb,pte,addr) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index c75984e2d86b..594575a0780c 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c @@ -161,7 +161,7 @@ void *get_pointer_table(int type) * m68k doesn't have SPLIT_PTE_PTLOCKS for not having * SMP. */ - pgtable_pte_page_ctor(virt_to_page(page)); + pagetable_pte_ctor(virt_to_ptdesc(page)); } mmu_page_ctor(page); @@ -201,7 +201,7 @@ int free_pointer_table(void *table, int type) list_del(dp); mmu_page_dtor((void *)page); if (type == TABLE_PTE) - pgtable_pte_page_dtor(virt_to_page((void *)page)); + pagetable_pte_dtor(virt_to_ptdesc((void *)page)); free_page (page); return 1; } else if (ptable_list[type].next != dp) { From patchwork Tue Jul 25 04:20:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325735 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 E4893EB64DD for ; Tue, 25 Jul 2023 04:21:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0129B900007; Tue, 25 Jul 2023 00:21:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F2C83900002; Tue, 25 Jul 2023 00:21:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5696900007; Tue, 25 Jul 2023 00:21:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C4483900002 for ; Tue, 25 Jul 2023 00:21:58 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 97A95C0C57 for ; Tue, 25 Jul 2023 04:21:58 +0000 (UTC) X-FDA: 81048836316.25.F5F1237 Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by imf11.hostedemail.com (Postfix) with ESMTP id CC6654001C for ; Tue, 25 Jul 2023 04:21:56 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=fGvrybG9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258916; a=rsa-sha256; cv=none; b=bASdrydT7H5RTcYsAu0dNSq0AY+F1aYwmLbb/dFrpweWKrQpc/cNFgKwBa5H9hF1qZhOX2 PB4emZPrUzoWznZWXkhiy6uy08piDIXdpt/Q24Y+06HTbJbHpi7SMkaB5n09NknC+EW7X2 kzMqQlht/UzPtp98ztPh7RPyFD1lfiM= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=fGvrybG9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258916; 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=Z2eVDlXL8alglJUGVXcc8JA7ix0brgT+4DYqdXjkOuM=; b=VapREoF/Pu1+O4xJQDsT47r//zBi+ZTxk3bwCO95n3XQ282kdTnNG3kxbPqMwfJKJEbmfD pn/g8QcaBH/Qmqt0HofzVMilstO/0PzQw1M5zd25EX6eHbJyBB+JGrT76VrCR0M9VcuLxF AD5unZ4fr3ip073uevp9YMm14jksREw= Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-ca3cc52ee62so5589270276.0 for ; Mon, 24 Jul 2023 21:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258916; x=1690863716; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z2eVDlXL8alglJUGVXcc8JA7ix0brgT+4DYqdXjkOuM=; b=fGvrybG9veCXSoZFXJMA0UtqwNVtXsAlnWuMk/bkXpKkiczqed+HRBg7qpGXw+rftP R8qGxP/khxNNrFznF2hl0CDjqxop72dBkyp4625bQ80IjqR8i+AlFghPxbvHSncIk2dU DIqadiRIjjzhPNPBHKa8Srlv+IgcPTSwuOlmzDd7w7/overcGZcXEJW2ZE2gLlzTkiIr 14q1X4buVUmvyXPkdMqpiQ5xV1g5ijhPBheP6rwOByILYuHwrisg3701wx7CgFQtr2bO RrmWP1BVIW5ubmY7FqAv2e+hZuvZuJ8ivG88vT2nRQQmOHlirL+OU5ylsfQ+AZXaGLB1 RXTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258916; x=1690863716; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z2eVDlXL8alglJUGVXcc8JA7ix0brgT+4DYqdXjkOuM=; b=cShc/e3d5Xbzyec/cXnW47yfYRbToSv/+nvPrE4JDJyUqv/fM9LpPXeiP2uUaHLduy YS/fgEjZ1QWoz2XhDxr+LS4BEZ4bR9C4IwlQ+6jIYnJ2Iw767F+ykIRSIhgzYRIBKHBP zIGhnV+iNft8boYLsRiykDEM0Vam8StuqmiYfey66pIAO/uNZUShu046i/bvc352/oso jUsI5uKL5chwJrE46H0l7Mm+hmAyTEqmn9b3KoulfGqO8RWNinRQSTREB/7GNZgwryDa q40oCFcse3UsYq+J2kMO3vMTPdBLeJd/TzV7CfyAL3b8G7FyFgi/etx3NKAbSbONWKWR C0LA== X-Gm-Message-State: ABy/qLaRK0eOHQ+ulAvuNH8AKW66qokzblRLqQVzDVG4o0THk6DfGcxB 07jS3EGTT/d+22refYXo8/s= X-Google-Smtp-Source: APBJJlGrUdYE+QekYe04OLVV4hTwe68IN9aeZvp7joelMErKuv+FL/dozsxuFXjvhOH/EvJSITLrDw== X-Received: by 2002:a25:ac88:0:b0:d16:7ccc:b407 with SMTP id x8-20020a25ac88000000b00d167cccb407mr1735614ybi.39.1690258915878; Mon, 24 Jul 2023 21:21:55 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:55 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Thomas Bogendoerfer , Mike Rapoport Subject: [PATCH mm-unstable v7 23/31] mips: Convert various functions to use ptdescs Date: Mon, 24 Jul 2023 21:20:43 -0700 Message-Id: <20230725042051.36691-24-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: CC6654001C X-Stat-Signature: 3e9ojzgxnxhtcf4kxgnxupw9nmw7wa86 X-HE-Tag: 1690258916-912957 X-HE-Meta: U2FsdGVkX1+SDBqD4kLyqQEXg37gLfaBza7GPkPKd4LZ3bezwc4WqXE2lDLKsA1xdeZQ8vSLzAOp0jxHWw/GnmDYFYug45OeO9H1jbbBYtRiHEjCu3f7pqRX203pX6gf9XvnXQ+rchMkooWnhRvPXFexu5iFXLJnrDxrlFUtiJDiedhMAWdVsVKzB2UgjtFp5loh2DU8ihCl0XgM2tIkdrC+dgh+UCt4cjBmzE7+OXKdrgCB2moubUXsa4ZoPbNzkCp1l9r3e0txkG+HmfMIpYXuqxC67MY2pzA7uO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MH7KrS0NtdTCCSxVwZvGqA/6Z0FAZHdOe2mKj8zwkhAH55fZXOVK1UuQZKpiA5qjOVyrMCsDjQjMGkCVggug1xhmi4VaRhETIkv9bmsliXVIhA== 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: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/mips/include/asm/pgalloc.h | 32 ++++++++++++++++++-------------- arch/mips/mm/pgtable.c | 8 +++++--- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h index f72e737dda21..40e40a7eb94a 100644 --- a/arch/mips/include/asm/pgalloc.h +++ b/arch/mips/include/asm/pgalloc.h @@ -51,13 +51,13 @@ extern pgd_t *pgd_alloc(struct mm_struct *mm); static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { - free_pages((unsigned long)pgd, PGD_TABLE_ORDER); + pagetable_free(virt_to_ptdesc(pgd)); } -#define __pte_free_tlb(tlb,pte,address) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, address) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) #ifndef __PAGETABLE_PMD_FOLDED @@ -65,18 +65,18 @@ do { \ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) { pmd_t *pmd; - struct page *pg; + struct ptdesc *ptdesc; - pg = alloc_pages(GFP_KERNEL_ACCOUNT, PMD_TABLE_ORDER); - if (!pg) + ptdesc = pagetable_alloc(GFP_KERNEL_ACCOUNT, PMD_TABLE_ORDER); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(pg)) { - __free_pages(pg, PMD_TABLE_ORDER); + if (!pagetable_pmd_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - pmd = (pmd_t *)page_address(pg); + pmd = ptdesc_address(ptdesc); pmd_init(pmd); return pmd; } @@ -90,10 +90,14 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address) { pud_t *pud; + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, + PUD_TABLE_ORDER); - pud = (pud_t *) __get_free_pages(GFP_KERNEL, PUD_TABLE_ORDER); - if (pud) - pud_init(pud); + if (!ptdesc) + return NULL; + pud = ptdesc_address(ptdesc); + + pud_init(pud); return pud; } diff --git a/arch/mips/mm/pgtable.c b/arch/mips/mm/pgtable.c index b13314be5d0e..1506e458040d 100644 --- a/arch/mips/mm/pgtable.c +++ b/arch/mips/mm/pgtable.c @@ -10,10 +10,12 @@ pgd_t *pgd_alloc(struct mm_struct *mm) { - pgd_t *ret, *init; + pgd_t *init, *ret = NULL; + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, + PGD_TABLE_ORDER); - ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_TABLE_ORDER); - if (ret) { + if (ptdesc) { + ret = ptdesc_address(ptdesc); init = pgd_offset(&init_mm, 0UL); pgd_init(ret); memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, From patchwork Tue Jul 25 04:20:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325737 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 D8F02C04FDF for ; Tue, 25 Jul 2023 04:22:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A40E900008; Tue, 25 Jul 2023 00:22:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65276900002; Tue, 25 Jul 2023 00:22:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CBB2900008; Tue, 25 Jul 2023 00:22:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 391FA900002 for ; Tue, 25 Jul 2023 00:22:01 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0CF9480A2D for ; Tue, 25 Jul 2023 04:22:01 +0000 (UTC) X-FDA: 81048836442.12.4315F0C Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf01.hostedemail.com (Postfix) with ESMTP id 1C9C340009 for ; Tue, 25 Jul 2023 04:21:58 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dhPD8Mhd; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258919; 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=DOzSOLTncjJXn0AvJQqE6PD7zrtBe8MIuyz5zw7TzDY=; b=vB93ArtAPgJI04UE2ZS3CIS5CHu8ZMIfqGZ+ordlF0sdTh0PBENQX8Lm2GZJhu7Y86QICl GFEGb5xlplIxCn+FvgijzXMedhFD6M0jgyQh07XqzF8mCWQNBKSccvN6cTM0OhuppLnH1t AKM7rTEdlWhy8WgrtzjagHuxVeWUvt0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258919; a=rsa-sha256; cv=none; b=JoeatzKKvYiroiz1hvadfl2yOn9hkaGQ0uMSnrj74xq9bzXIkXbesnx9GdceJTgdUc7IM3 jNTOmFRfrYYpo+iLzN2pIkygDB+JOYLzOpCgziySB1UoHFASecSQdBUXt9bmuJtdethEY/ Vf3yZSbH66YEIQm8RzWMKPYeUF4QCRg= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dhPD8Mhd; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-d0b597e7ac1so2718159276.1 for ; Mon, 24 Jul 2023 21:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258918; x=1690863718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DOzSOLTncjJXn0AvJQqE6PD7zrtBe8MIuyz5zw7TzDY=; b=dhPD8MhdzMmnO7UJpDnYU2UUndnCrctJzCVX4h8RxV/2AqAGAmNSSgBAimCgoOXbFI jwqB3InLHcwQnBW7LGy3zNpfxtaFx0sRNMrc2BW/oP9Y9sT30Imc49n106obHaMafKD9 3iENsXyRilYTy2IVeIDj7UinpA3gJg4m95b/YmknsgUr223VL5cVJ4//6IC3DQ94xugG 7BqjgjAuhv+rjaUhUgEIiEByqDs5npSuOOnKXGMd/lRwDVio+iIe4ROtQu1UVk7GVi+q O8m155eNSAMp9dX3vcmdIfcwnE6nUvi43OowEy4OezSv6ZkWZbIGQtYJYSHuCGDVV+u2 iZCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258918; x=1690863718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DOzSOLTncjJXn0AvJQqE6PD7zrtBe8MIuyz5zw7TzDY=; b=k1oU5bM6wXCdJQxO9N8IfuNXjVtQzH354nirNz03VBp5qwVYLb9w7R9wbdEjOnktqC C8u8l1MggrXLv9l9m1PbBJU9HV4pLwYHarnOSem67A2PwMkXpUjuYH45uYoNW/UTYP/Q u3Ku31ENpZXVVZ29EwjShzIGDWMHF2wJThAZkmxlbsUHKe55h/2GyMVqI9BC2oxlTYet b+o+aq5fy9PRVIO414QIGgcsEtvwmR6NTwri3aH7vq507c6+UN7+UrSKW3U77z7yiLoo /XOsEIdh4JPl5i3AZV6TJFIf0Y3j3SsxDZdGiRrIBOHLlH8S1TA5fDLhAxH2mTabpeMf xnTQ== X-Gm-Message-State: ABy/qLbTrV2vahuJmpByarbrzi+bWErxM50ku1+2mg+201FUxhvSgwW5 S/CiyUEbt2EOGAaaz5Dn/XE= X-Google-Smtp-Source: APBJJlGh3t71iGxZySWvCqAB9/DfGs5U66hmdz8Mr8qCsALi+Mic17AL5W5IK2UTO7itITs/+4o4Zw== X-Received: by 2002:a25:ced0:0:b0:d13:e334:241b with SMTP id x199-20020a25ced0000000b00d13e334241bmr2805085ybe.21.1690258918114; Mon, 24 Jul 2023 21:21:58 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:57 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport , Dinh Nguyen Subject: [PATCH mm-unstable v7 24/31] nios2: Convert __pte_free_tlb() to use ptdescs Date: Mon, 24 Jul 2023 21:20:44 -0700 Message-Id: <20230725042051.36691-25-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 1C9C340009 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: qkowgsjrzigr6xum9zirxabzh9ahhn9r X-HE-Tag: 1690258918-619773 X-HE-Meta: U2FsdGVkX19oNDbNhVvWknltBkAjvW2oJyvc1NQUU2uO909Bc1ZUP2MrVpVjqgq7PVb4wQKoiQ2nzIXYpRgsjQo9qrmaShofpt3+LWkq8UzOw3/egqf6GUTAVpp+nNd+px+ysgIuBh8UWMKD/IyYBan1VMyw2q/WUWlGnPfn9L33WHCktskx9hvxeg81OWBAY+sz1zA2Dc0p4YcLiE90WnC1/tHBNhZhmCphjM1wGfd4v4wHNB5Pe6HuRpFv94AivqFccHmolJTYc4H5w0C0WEy/w+b9EoySMagrP8FGHLUMQCjJe/mxPOgYhMmVNlbWHg/50TuxSAQx16v1MsXvJA0n2gI27WNPzOhfQDfHEoOLruLj7W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A/Z0W9I3dghANTlxPGu+GQxQIcqOEsEwVSrX1qfjgai41rp4RESy2UXLjJp9MHDs7M/MepQNCmafqDnjJ9ecVbAOfllcfo6he8y4kz96mwooFh6wDcKcxeyeSfGL98HdMmkonqKZh/7H9VDYgwYX75/iIUmfjVDLV9GvEsRakdAgxZjAUHfX2y1/rlwCz2Fd8lFQ= 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: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) Acked-by: Dinh Nguyen --- arch/nios2/include/asm/pgalloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h index ecd1657bb2ce..ce6bb8e74271 100644 --- a/arch/nios2/include/asm/pgalloc.h +++ b/arch/nios2/include/asm/pgalloc.h @@ -28,10 +28,10 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, extern pgd_t *pgd_alloc(struct mm_struct *mm); -#define __pte_free_tlb(tlb, pte, addr) \ - do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ + do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif /* _ASM_NIOS2_PGALLOC_H */ From patchwork Tue Jul 25 04:20:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325738 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 EA958C00528 for ; Tue, 25 Jul 2023 04:22:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 590FA900009; Tue, 25 Jul 2023 00:22:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54105900002; Tue, 25 Jul 2023 00:22:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E094900009; Tue, 25 Jul 2023 00:22:03 -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 30412900002 for ; Tue, 25 Jul 2023 00:22:03 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 0EEE11A0755 for ; Tue, 25 Jul 2023 04:22:03 +0000 (UTC) X-FDA: 81048836526.04.E588C7A Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf14.hostedemail.com (Postfix) with ESMTP id 19E9F100011 for ; Tue, 25 Jul 2023 04:22:00 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="pF3/aUrb"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258921; 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=0AnRv7d38hHUVaoAGins0CaWMMRgzo0GwUb20Y9YoSw=; b=Th7FvalmnaaST8bwSHcclMIs/UvrAML2WX4HIpombKAk2KDJDARzRNnbvoTf+7fRQZq6Dx fGTj1adQcW1FxCmd+ziWLHpG0BprE7J7YHLAi74jOjA/ywK+s/31WHKtLMrrcRh+6FZZP1 9ZpZA6YKnxUrhV/+MF7LOmdFuMnl61E= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="pF3/aUrb"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258921; a=rsa-sha256; cv=none; b=O0ahiSN4fgdaM+NR81eJ9E1sYWgfDiEU8aLNKNJDKMHHIJe2rmo1bvW6aiOTTbn+KU3I1j 6iVq8GWMbgz7G8u+ZaFKi2LjnWO6lwJWT5V51jluY38Fo+qRMGUYFm3C2LW2Wpds1wXh9F ehVZRahwzL4bAYMvvpPfd5m0Yh1kH5A= Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-d0e009433c4so2258234276.2 for ; Mon, 24 Jul 2023 21:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258920; x=1690863720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0AnRv7d38hHUVaoAGins0CaWMMRgzo0GwUb20Y9YoSw=; b=pF3/aUrb3JX49e0u22fW9ciATl7u+MUedSxMIodJhkvCSur2UbV1ymLo02TZ+J+kPF Kx5HeDHnWoCFEiMJQRkEFLmGeKvRgst1SRco5Nf2sutYKL2w+MtMEjm9RYoVaVV/WbaV YVQVPd7LOUuBtkmGFl+FmiiuwqN1u54q2lW5pHrezKOb3piONF3+v81Wt/4bQq44saNJ XmrP/XQPqOefJAz6PJqT1BLnizFGrc2xSl/LadxebvB7doG0PAx8D01yebNX4JhyxCLk tgaBucE6SVITexqLzDjpMrpbMyKpy8WP6lMzfEvzG49OmJW0+1GrWwpk6bQXNmC80wMv +HWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258920; x=1690863720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0AnRv7d38hHUVaoAGins0CaWMMRgzo0GwUb20Y9YoSw=; b=ZfeqAF3x2wZ6wtxSqjZP3mDdr3E7wZMfLgYPPw5jl7jWxwt8/QOw5Eb8YfAzt2pTqb JPETVSdIOnBkpLnhJUp/x0/HOJYqcwDhUuPOuCvT8Q3rcpRn4OXRn7pC+u/UZa+66RVV QZkF5aaPEcxjHu5W19+uq/Z9HQt3UV/6s9+sbBvQdFPzK7zNnyP4Q3jJrYXFDlg6CKT4 XXhMuaWeQvBPm1EWcBdSh4ka3QIaaiG2K3ffXi0ZPmQwzyDbczkoPgCEM2pDZUl6Mpot Me7heK/hHkeESlmKbo0xH9ny6Q8N7ALy6r+oNjxllC8DGM92aeUn8vqrrMdE//BHElgq Q7rw== X-Gm-Message-State: ABy/qLYKhBYTWt/LuEsdbKF3An70pah6mVDwJikZSjXUvV6YFYEiMQC/ MbrMM4lzI+VcoGVZplTgFjZmCf+fOhgvAA== X-Google-Smtp-Source: APBJJlEdkcahnNVyEvlWTLDmpaRsWSF5WciOnYxL0p0ce55MSQlJt+bgPnW2jeW0QxRihWyF8hwpDQ== X-Received: by 2002:a25:ac42:0:b0:d0a:da40:638e with SMTP id r2-20020a25ac42000000b00d0ada40638emr6436068ybd.12.1690258920108; Mon, 24 Jul 2023 21:22:00 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:59 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Jonas Bonn , Mike Rapoport Subject: [PATCH mm-unstable v7 25/31] openrisc: Convert __pte_free_tlb() to use ptdescs Date: Mon, 24 Jul 2023 21:20:45 -0700 Message-Id: <20230725042051.36691-26-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 19E9F100011 X-Stat-Signature: jupb5tfw1e8a9f8hwbpmmcjww693spyf X-HE-Tag: 1690258920-404710 X-HE-Meta: U2FsdGVkX1/JsEET7mqvl1pQuez5zSeWW6j5da4CpNO57IVKR1E35Y/NgC8MXVklACV7qyL44I38vZTkfWPWEGbeF+5HUgiWsXbnLVR5XIBBJ4QlXkaEFx2eezybduAd/zTlbdQGKN6E7e808n1wBYFR5r9avdOkQwwadmhBg3T7NOd+sb+bFSWZITjpQxsiHJh8k9drrsO/A5SSDXMIei6GiMbTcCLrwUg+PxFR41/l/CXVZWp0E96SnD7uM91MRvmn4y16XdIq/oVch94ASn6FNG2pJ2pTJOWHzAjlookWSn0m5l1Ole51/F+Bpq341xLTdrOH1jqDRhepr61fT3IGJf3Dopcs0uiXRbyHFn+tn5pv3amXVJqW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8FDsVla3v7ODFF4C0z3etE7uLk4i4IkTOC2Yay7QqG1SXqH3EZlc3Xgi0n9c4/c03+3O7NY4b3MiyAnb0amaFEXN0wShbN57jLMO0QqtADR6nGExGOL+7zpzFGJLSvUh21i6pX03HHNi30TP+wWxxeWotgkJIbNnwTD0akUaP/8ooUhU0g= 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: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/openrisc/include/asm/pgalloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/openrisc/include/asm/pgalloc.h b/arch/openrisc/include/asm/pgalloc.h index b7b2b8d16fad..c6a73772a546 100644 --- a/arch/openrisc/include/asm/pgalloc.h +++ b/arch/openrisc/include/asm/pgalloc.h @@ -66,10 +66,10 @@ extern inline pgd_t *pgd_alloc(struct mm_struct *mm) extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm); -#define __pte_free_tlb(tlb, pte, addr) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif From patchwork Tue Jul 25 04:20:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325739 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 0C1AAC07E8E for ; Tue, 25 Jul 2023 04:22:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F0B990000A; Tue, 25 Jul 2023 00:22:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A108900002; Tue, 25 Jul 2023 00:22:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 519CB90000A; Tue, 25 Jul 2023 00:22:05 -0400 (EDT) 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 40CF2900002 for ; Tue, 25 Jul 2023 00:22:05 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 07CE2809E6 for ; Tue, 25 Jul 2023 04:22:05 +0000 (UTC) X-FDA: 81048836610.27.4ED5A16 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf19.hostedemail.com (Postfix) with ESMTP id 315D11A0008 for ; Tue, 25 Jul 2023 04:22:02 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=iu7T9ShR; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258923; 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=3wtNkjiFE1rjq7ZRDFNmpMqdu/3EA/QyC8BNR6xlaRk=; b=6Q6HlGb78HKWRXjC7t94BXKPtbySjcZf6BUC6yS+BXgLrtVC0nsb0YRK6pLlQ6PUPplag8 6L4USL2LdnfOsNKPKbOE2vmjybAUm7aASF0fsp09ZZzWWffLdJRWsb1rujpPO1Cl3XZEG4 7X9AuDQ2TzEY2Ju7tgmYG8W79rUDyfg= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=iu7T9ShR; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258923; a=rsa-sha256; cv=none; b=448NK199EdcaeY6DMm63NIfoLsD4RQDEP2lh+Az/6NRvHFnR9rfr8ngTzSnr8qz5Ji25u+ VxlzaOS3SJER0DvMy/Fe0/t8zUMKLwNVucTB/aWU31bIf24G1isLHAtSz5qC7CwwJyCeaa vv3En+cJTyjwQ2wohhaRhJPQvfEMuZQ= Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-cf284f4d7afso5663832276.3 for ; Mon, 24 Jul 2023 21:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258922; x=1690863722; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3wtNkjiFE1rjq7ZRDFNmpMqdu/3EA/QyC8BNR6xlaRk=; b=iu7T9ShRTfGWqcA5uJNn48P7ITBijMcZXksGMFFsSIJDj0VmHTYECkWvPEWNMN60a1 IUYR/sDhh53Vy6dzUT6UahYzj05kYwH8neXcRQGMrWnafyF9Nggmi7HojAqo4PR9lKrk 02FdxS1l6wceDUexmcvfeLaN7cB/yf3NJTMHz8qA/qhQubNB4zuidHLrnfC+CD9FthdV DmB6BJ+22VwMurCnw4NmkeKklt87ZDgX5spGKsnDe9xsWqCmiOPReZ8vAaZPSBJPyLEZ EQXlbCfDgq90/zCmmXSE8cDOoCHltzy9M5tcZZJw0IWtubbSaQTI0PoE70blt5u8J64C txJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258922; x=1690863722; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3wtNkjiFE1rjq7ZRDFNmpMqdu/3EA/QyC8BNR6xlaRk=; b=GneURjio7KK7SU/Cun1fz40igpfbLDtFNU5Vhqqv58ed3JVKK/r8bAyf22OmCqZGTB X3/WFhN3v1O9y6wkFnkVhlI/USrTPPuPwNWaFdYnWokw5x8W5+cD5gLrWAmGl+/2lAiX +ItkgIbYDv9ycdT2Ob5epb9GcbsTUBB2yn5TWglvFECFMTu1jKKsUOUZYkuUxzDR+ZLB L2Hc//cONJA4q3FcHkwmpxPiZafMwJWVg+MyL82RLV48XfsuHvKiWQLZ5nAHVxHt0oCP wx1+Adtd5hbgii09CV5iCbkuBDinawWzUbN8FlvbUJ13OZVd8IaqTx33BXPVZahkPoOW 5vxA== X-Gm-Message-State: ABy/qLaZt0EEXksg7MjxXucfrnzNab794UT44Pku9zvIB0THbBlqFuiG x+VmSuPRXImI1zUQcjq23i0= X-Google-Smtp-Source: APBJJlGfBdwhSlxwyOaXtB0+Cx5VSBUjcB1Wb8y8NRWIESkjts+Gr4L0lqHFPdNq/1caH3RyI0GElw== X-Received: by 2002:a05:6902:cb:b0:bc9:92c9:7fd1 with SMTP id i11-20020a05690200cb00b00bc992c97fd1mr8566515ybs.3.1690258922187; Mon, 24 Jul 2023 21:22:02 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:22:01 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Paul Walmsley , Palmer Dabbelt , Mike Rapoport Subject: [PATCH mm-unstable v7 26/31] riscv: Convert alloc_{pmd, pte}_late() to use ptdescs Date: Mon, 24 Jul 2023 21:20:46 -0700 Message-Id: <20230725042051.36691-27-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 315D11A0008 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: cac85cmr4srcwkmyhhsirjcf59gq6g9g X-HE-Tag: 1690258922-440435 X-HE-Meta: U2FsdGVkX1+VH16fDp+706ls6nZfxv8aPoJq8Pc6g88nB3Fu5n6qrXdguoTZzqLMLCXXrHbYlrJnFgOpj0qiJTH1yGxaPAL6Oa4P1L1kufuBRXGS0SI2+FrNLZzFpEbjd/hHByM0beEG1J2flsfMGqumBlLiYyz3u/ZA7rTvLoWlhpWpqR1m8n/TxIZn01e2sJl1aZztydB5mA8oHZSyGbcfAPVENhNEfeJUmRaBS0yIDHwOHQZ/CWcGT9Rsk5kER+2BlE+X1Zv9nBqoWSnV4vNkoaGUXJqh6TMZnb3hxxW0Tc3XxZ4jYtJFkY6XGpA/N7YS2gfycfzr2cNxnE/UYkqx2H/5H94CJGOGcFm/ERZhufcb4AluiU7k4CnaEZTcdYvcssDLrrjgKHjCaS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o+tYHfYr+4bG4cSi4KChDT/eCqvhe4CFG19M5LZyxJ3AP1MMEV/8ENSG4gN6scsqsCjXKyI8fIZB/fOpJltUU+I26UFa+PQpu9XMqE1z2amD2UoktSxzrrcL0cNERvNCvHnqsbx4xHCbSoAiNVo2z20paWqdqix2yEJ5E9yF+TOyzZEnk4D8ZZFrYou3yFDy2HKKscIE0I7IijbqaoGpuR6osYaiV0 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: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Palmer Dabbelt Acked-by: Mike Rapoport (IBM) --- arch/riscv/include/asm/pgalloc.h | 8 ++++---- arch/riscv/mm/init.c | 16 ++++++---------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h index 59dc12b5b7e8..d169a4f41a2e 100644 --- a/arch/riscv/include/asm/pgalloc.h +++ b/arch/riscv/include/asm/pgalloc.h @@ -153,10 +153,10 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) #endif /* __PAGETABLE_PMD_FOLDED */ -#define __pte_free_tlb(tlb, pte, buf) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, buf) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte));\ } while (0) #endif /* CONFIG_MMU */ diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 9ce504737d18..430a3d05a841 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -353,12 +353,10 @@ static inline phys_addr_t __init alloc_pte_fixmap(uintptr_t va) static phys_addr_t __init alloc_pte_late(uintptr_t va) { - unsigned long vaddr; - - vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page((void *)vaddr))); + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !pagetable_pte_ctor(ptdesc)); + return __pa((pte_t *)ptdesc_address(ptdesc)); } static void __init create_pte_mapping(pte_t *ptep, @@ -436,12 +434,10 @@ static phys_addr_t __init alloc_pmd_fixmap(uintptr_t va) static phys_addr_t __init alloc_pmd_late(uintptr_t va) { - unsigned long vaddr; - - vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page((void *)vaddr))); + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !pagetable_pmd_ctor(ptdesc)); + return __pa((pmd_t *)ptdesc_address(ptdesc)); } static void __init create_pmd_mapping(pmd_t *pmdp, From patchwork Tue Jul 25 04:20:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325740 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 1A4B5EB64DD for ; Tue, 25 Jul 2023 04:22:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7655290000B; Tue, 25 Jul 2023 00:22:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 715B1900002; Tue, 25 Jul 2023 00:22:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58EBC90000B; Tue, 25 Jul 2023 00:22:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 45393900002 for ; Tue, 25 Jul 2023 00:22:07 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1A22C1A04D0 for ; Tue, 25 Jul 2023 04:22:07 +0000 (UTC) X-FDA: 81048836694.20.3A149D1 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by imf14.hostedemail.com (Postfix) with ESMTP id 512F5100011 for ; Tue, 25 Jul 2023 04:22:05 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GBQqKOXR; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258925; 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=NG13BwzmmAIpXpcduEwvRHFbS3iQhU18W2JpKLteVDY=; b=NSKdYjRJgpZc0/XpZnnRENNaL5blDbQUTzQqLGWddVa8tLcsq7O9Hld2wQq1x/smi/rRo1 vEz4qtLoiXmLduvQkFXdi8IDU5aSu4RUexUCybJ/3mNF5UHWvN8wedHsAx1Ud1DGk5dZkb eil3rWeprE9k3ZzqfUgc1eSsTJyJQmg= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GBQqKOXR; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258925; a=rsa-sha256; cv=none; b=mOp7hADDWgZjnxwWZeeCRsd42dNNIAGV4XGqMYbXcVQGu4YoB39laO36P/GqM2YgAt5eTP oXN2sIqiHHe5X43tECdcyugnOYbXRgTjYizBifrgYJFacO/vQNRP5DNcCUlqJqo8lQuS+n 1rnxWwkb1Z6wZiuhgl0NIhaaIHNmKFg= Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-c4cb4919bb9so5540835276.3 for ; Mon, 24 Jul 2023 21:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258924; x=1690863724; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NG13BwzmmAIpXpcduEwvRHFbS3iQhU18W2JpKLteVDY=; b=GBQqKOXR4MY0Ps6Ytzn9QjLc5kcnNARqYVMOSqCl4nxxP5zueTINjr7iMbjZhk8uU1 uF+ZNdDLWemlb8QXVTn60jLorPF4KaxuajyPq7XQ8ZCUpgrsfyxcNU4aZsjJHBdfgv4V f3SehFOrdMCWYaV3GNfOxXZlwwtfQps2pLwSnw0r1MZbny4VXC0cZl+5ECg/uwswSkJJ 2spe5/EA1yI0VqTuQ1Drr9GEQcMwkhM/FKbElCEbuZdJkSdi81Zbahgosic5IMYJMWsY zz7YF2FVGFBOrfl6ZnWHbV39qhmx668oKEAvnRRKMjMLLqABK50UfsT2Oc13y2cvxYxd xuhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258924; x=1690863724; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NG13BwzmmAIpXpcduEwvRHFbS3iQhU18W2JpKLteVDY=; b=EXpfK4s9dtKgoB2Y+4rQhVIuq3V22p7ica+wAI/46TisWLvwA901thhRARyG9hxykk tCQWhej1ehcAYm2FsMQfhlnB+PrythQiUu/w96phglH8zznd0vQYvBWo+teltDT5Q215 PU1xXjNDGcbAz2x3O1/cIp3o9AmoRHV+3cLHIkHd8rD+/NSLqhqOu0SB5Jg1PaqenWI2 fsSMYyoCaRsojIhBFXhzTUKatJEx+TKFiIwI3bNo84lnzYjIeIlxw2YNmD8sASJlSJEk zM8Is+amjbt0kjyqV5eaQaEBhQxikFIqe3UAzb4lrjszFj98QQEMHNySw5ftSQAWLfNB Qi+w== X-Gm-Message-State: ABy/qLZsRmCGRqnqhKFah3HEzqcttdWMJnnMHFt121Kp4ASUfW6RTLs/ Ik8Rf7RWPs6BSGLQ8k1HZNU= X-Google-Smtp-Source: APBJJlFIEKBO4FnrV/9ajkbTKUo/vEdRCYW7kk6X3z3g19puIv3mx6us1kMtRHRFLnY2I/2ODsKhEw== X-Received: by 2002:a25:2309:0:b0:d0d:2d82:7a27 with SMTP id j9-20020a252309000000b00d0d2d827a27mr4389099ybj.13.1690258924402; Mon, 24 Jul 2023 21:22:04 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:22:04 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Geert Uytterhoeven , John Paul Adrian Glaubitz , Mike Rapoport Subject: [PATCH mm-unstable v7 27/31] sh: Convert pte_free_tlb() to use ptdescs Date: Mon, 24 Jul 2023 21:20:47 -0700 Message-Id: <20230725042051.36691-28-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 512F5100011 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: n6nyunrnkpdhs8y7t6q7uccz31qo7h8p X-HE-Tag: 1690258925-176478 X-HE-Meta: U2FsdGVkX1/y0GrgR2AC+0leHvoumPs0/C+DkNvZmuRRkVL0oM22AaGMRQA0B52jh7sOAdttmwA9PiR6G0eOCu2qSNgqW2vNia+sHsOu3mTYlcQvgN2glX2CYSrp7IRcDGdxpXS9ehXmfySdN08Na0jHOwEgYi+P+0pLlBrJGjCSLo+WaNeQ3DCMUBE5aWtN9KElEsjb8wU6UauhGuBCf0bSPuvyEvvVLAE0Y74Ssq2RDrAB/7we4/WWH2uvMTQVS0vYRE+UJ6AGja/GXbhFkcS987cyFyoNO/i3O6tEqrbYKM6ZCbWC8PqfG94QMKeTTyPAftEaXOE/Q6a0hBVmkCLwLoIriAcFZFaGwSBr4Q6OPYBo3egxQS/1fdBL7eo3SMQ+mBXkiG3Hc8wJ01/uggmFZoYcUqbJXMF5uWxgEVmikYxaZZhD8Ok0TaRX5JxZ4P1w3GpoPCYdVsrK1Db8uzhGF27o3MsHjr8rxMh6g5aUZDZoTWasshP9az3ejqPy1UgE4X17kIBXcNnhCZEUvtr7eXd+R7z92r25CddCyMwGNIvzUC6T7iAABeztqh8Di+iyfpBUaIhB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ity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Also cleans up some spacing issues. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Geert Uytterhoeven Acked-by: John Paul Adrian Glaubitz Acked-by: Mike Rapoport (IBM) --- arch/sh/include/asm/pgalloc.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h index a9e98233c4d4..5d8577ab1591 100644 --- a/arch/sh/include/asm/pgalloc.h +++ b/arch/sh/include/asm/pgalloc.h @@ -2,6 +2,7 @@ #ifndef __ASM_SH_PGALLOC_H #define __ASM_SH_PGALLOC_H +#include #include #define __HAVE_ARCH_PMD_ALLOC_ONE @@ -31,10 +32,10 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, set_pmd(pmd, __pmd((unsigned long)page_address(pte))); } -#define __pte_free_tlb(tlb,pte,addr) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif /* __ASM_SH_PGALLOC_H */ From patchwork Tue Jul 25 04:20:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325741 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 510FEC04FDF for ; Tue, 25 Jul 2023 04:22:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D58B690000C; Tue, 25 Jul 2023 00:22:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D0B5B900002; Tue, 25 Jul 2023 00:22:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B340790000C; Tue, 25 Jul 2023 00:22:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A1CA1900002 for ; Tue, 25 Jul 2023 00:22:09 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7E7BD809E6 for ; Tue, 25 Jul 2023 04:22:09 +0000 (UTC) X-FDA: 81048836778.05.6F7E38C Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by imf05.hostedemail.com (Postfix) with ESMTP id A8B0110000F for ; Tue, 25 Jul 2023 04:22:07 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=qNSUsqiV; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258927; 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=K9EaWELDe99nUon5K3Z+iJo2yPeaFSzyCnD+eyoagSI=; b=NM0FslUQ9uk/oBMbpC8eOzRl+6rFKAgxWLmBo6uwG5EHq8Ym7iL4SlnQ90VeqDAhAyGcXn +Io6IP1sARO62cZ1yMpPlzRgbSe2YBwcR5++qwYvRncgGy6zYmrSeWzpJVLHbQO/H4fty0 OII3mFea6+eD72Xo36SB+l6pUejbVek= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258927; a=rsa-sha256; cv=none; b=ac4T0vuc6EtVlq9XAkNrf24N50feE4Zp/wfrK/ltF4yjqw03r3Mv28KMcyW96h+hzltsCR MYWq3ggmMLNdTolDGE+5J84QqIPc1ctu9OLW+9Zpv/OCK8TZaIAFflPDONAQ7YMzyW5+au A6E/ob/avz/WC55TWSemEOArUGzQTIo= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=qNSUsqiV; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-d075a831636so3448406276.3 for ; Mon, 24 Jul 2023 21:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258926; x=1690863726; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K9EaWELDe99nUon5K3Z+iJo2yPeaFSzyCnD+eyoagSI=; b=qNSUsqiVKVB0ESH5eMh2318rltbeTzVNrLxONrPQx/nleyciLPoBJAEyvEQiA5s1Tn 685R6sAh2RRkBOJ+dHhwwHaTsDfn1Dq0fhp7maY379FRtPvlZFAioZBWPPk7fa1Wkq01 qN75vY9UJqWiLkOixY4L6XdTPAaqKlrcR9SWRLlUZxoXjG975sFhxm21WZutHmQKl3h2 OQ9WcHoISTJ2OjIGWYQNx9W6xFSNLrPRAFCGXfmCK8TcPNzYvmKngSTkC45cBTIzIEjY 73sY0YERl7Ohg+xplAh/xTNZowvdAeC+fipfIzPvDIC0nmap4j6fccJNDYEXWoxWM6gV WCvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258926; x=1690863726; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K9EaWELDe99nUon5K3Z+iJo2yPeaFSzyCnD+eyoagSI=; b=bF20zQ4MGH3IUuWU54G90STOhPrhsoGTlo5LAY3iYSQkq74naSjY9PhL47QR70v7O8 W6q4br1ocQKJwzhWRD5u3j4TITq7RTqj11u4iGOWPHVOtvKscxj1Km3zEs/TKy2CgXnH qCZ/XIfTDOcj5Ix5O2r5nzMhzhA0fj27Fs4GzYK3Mbk1IMQ7It2pK0tiggjG/b30K6q8 lJBG2rdOZMsEQ1lrmuCurD5gQjeVUfFrWNrZ7xCCrz/W84O5p3Nvb60+ntB24yP65wHe m6agKGnwIXpdLJ2TvOtIflixK8AexbCroOdf/KZfgKYpqXwsc04GW1ibUO1y6RzusMhy noLQ== X-Gm-Message-State: ABy/qLYyv7yedFcFcwvqIEvszRUOvnBgBT9Pv5o9Zmy5spWVfkB5v0ph ApEWYTF6d8QbyagN1l4gNik= X-Google-Smtp-Source: APBJJlEYsYvwES4yIHo2kt7NPKD5Twgr2oGLJnzn9f7qzh6ZvPXJtQdH1+pOAmNJT4cd1ABpvr+wDQ== X-Received: by 2002:a5b:88e:0:b0:d0e:3831:fa2b with SMTP id e14-20020a5b088e000000b00d0e3831fa2bmr4772882ybq.62.1690258926669; Mon, 24 Jul 2023 21:22:06 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:22:06 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , "David S. Miller" , Mike Rapoport Subject: [PATCH mm-unstable v7 28/31] sparc64: Convert various functions to use ptdescs Date: Mon, 24 Jul 2023 21:20:48 -0700 Message-Id: <20230725042051.36691-29-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A8B0110000F X-Rspam-User: X-Stat-Signature: q5ew1ty3pzpnwetkyady16z847mie5y5 X-Rspamd-Server: rspam03 X-HE-Tag: 1690258927-957860 X-HE-Meta: U2FsdGVkX19l52KxdJ0r6oNx0+gv43LgziKg4FE/48IetfmUn2R2dXB5HKQXRvc0CNELwjggs5QA29HQGsIBUqoD/URax5Bfx/ZGJFj3hvZWG1ILY6r0VvappJAW00MDDGwovbZgTXR2SZ/9qFvBGyhaNOI3Tg0iFLDuiHh8LRbsxtBhXUxDXdczNOLdY6HvmqHJur9md67ZYMijujwjXHwhyC0Rb6Q+2rT+drGg1A65O4aYniEvJGtlavjZP2De7jMMZh9L2only6VK3i8oghLrMlhvHiceFOpBW5sDWyugDb8jXdXZbwp0HJz0klHR4X2w0zgbGJ7470Oq3nxAGanW4rflJ8Y1851/u3k6kfdKEka2wPBGDUQLxKw2iYcitRTvFxLE02ASKzfyrG1BQ9tX1rS9prsgTzDkrEnr/Db0cNAwuH/iqXvujwtXXO5Mg6ndhC37fXFWIk4hU86OBbddY3ivezKVi6pwVX17mmzP/fIwc1X9nZob+i2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EauQ== 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: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/sparc/mm/init_64.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 0d7fd793924c..9a63a3e08e40 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -2893,14 +2893,15 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm) pgtable_t pte_alloc_one(struct mm_struct *mm) { - struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO); - if (!page) + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL | __GFP_ZERO, 0); + + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - return (pte_t *) page_address(page); + return ptdesc_address(ptdesc); } void pte_free_kernel(struct mm_struct *mm, pte_t *pte) @@ -2910,10 +2911,10 @@ void pte_free_kernel(struct mm_struct *mm, pte_t *pte) static void __pte_free(pgtable_t pte) { - struct page *page = virt_to_page(pte); + struct ptdesc *ptdesc = virt_to_ptdesc(pte); - pgtable_pte_page_dtor(page); - __free_page(page); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } void pte_free(struct mm_struct *mm, pgtable_t pte) From patchwork Tue Jul 25 04:20:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325742 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 6E576C00528 for ; Tue, 25 Jul 2023 04:22:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0AE4C90000D; Tue, 25 Jul 2023 00:22:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 06027900002; Tue, 25 Jul 2023 00:22:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E42BE90000D; Tue, 25 Jul 2023 00:22:11 -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 D097C900002 for ; Tue, 25 Jul 2023 00:22:11 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id AA140120C67 for ; Tue, 25 Jul 2023 04:22:11 +0000 (UTC) X-FDA: 81048836862.23.AE7E538 Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) by imf21.hostedemail.com (Postfix) with ESMTP id C695B1C000B for ; Tue, 25 Jul 2023 04:22:09 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=cSKYfsxs; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf21.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258929; 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=ES9RfFz84BcV9KH4Nk3AfkjPOEvVVRdPbPMSiTejLcw=; b=l1aFKPNd779WB9A92hBoPq8vcODSuqE6bAzZFD4nxnIPz625xLrj9VfKfag7+gpi2Oisb7 K4Qpmso1KT8uu+/riGkdrMS6IOK8KnhyCnQw4G23npevTQmbH7/ba91dXxOcKX276pKFb5 rhJYs4s6WMA6ubkNcprCSrORb4lLIGs= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=cSKYfsxs; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf21.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258929; a=rsa-sha256; cv=none; b=hx48VjR1naAhNdgacJfP/AjIVnnnF3D8jmhIzwovNTL3WTDx24mzZkHtA/2vyGSu6tEnI0 MDzkz1/G+zAD2vGSWAh4M7yxrrPDGUnzf8mK2ptVbb2ZmXKCV+me9mSzcvJNGZT4q8nfkv jPfdI9q9v9KqCgRusWMHtscYlnskgtM= Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-d0b597e7ac1so2718249276.1 for ; Mon, 24 Jul 2023 21:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258929; x=1690863729; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ES9RfFz84BcV9KH4Nk3AfkjPOEvVVRdPbPMSiTejLcw=; b=cSKYfsxsSJS7ffOM4NEt7zqMXRoog1hv17RKdUNV14hwO6VLFQmWr65pOVoZcWEcHO ZTxl5sTEIPleNQWx16W6XrYvQNc8QXYYi7iNKk/WLCGUAw+9con++Nm/zKIXiRkvFnF7 Kmn+uijjQiZlrdtiQKHDxzRwNsdnc8EVkdLLz/rRCQKPLyPDRXi+bbVeFHkpJoJjSqoQ LLoMyhXQM5hAlfwlKm9TGFpC4wUaQoFel3CzrwsKFljyIKf+UmRISO6P0XGMas/PtQ7m PZz9tli6d2qqtk+AGtTpbrNJSRqge28gNGwJ8TouzN1vk9cQxwcl+kcXzH8Il6o+JKN2 oqCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258929; x=1690863729; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ES9RfFz84BcV9KH4Nk3AfkjPOEvVVRdPbPMSiTejLcw=; b=L9xlhxUb3/eWfmyI3eIwrNrfi4dJAOORytcCFstGu0fR8y+L6ZWqSoEDAj1MLwxwKT KHNrviKlooUKlvvaHz0gfyeAj51T8wlfSGcJ2poNo6TuS2FCfUmAiMEbEdlA6pyNjoui xQLN4nea1rwyFIlCEE4tZcMccSI7o4gPicdG+lfwsOcXjLu3QdSwDTeNLCNHToV8y/pb IQ1NNE2xf657Zo7w44Mckru6QEvL8IEAX9iUDpP5kftopyeBq4CKZpOwVbTraLKpEtUT wU7iX2yennU03bewUItK+K3F3149R0Kg3pmNL+LzO9e3g9iLPwiRL19pCl1dmws6hHuQ HQEA== X-Gm-Message-State: ABy/qLb/QxI4MxbgH9rVuiMhJhSBhMq6PNPBz5xn1hM5jTzPCgebUopF Vv0nhFyk26tKAOqEBt416vo= X-Google-Smtp-Source: APBJJlHinG28bY5749COLWHo/TBHjyABo5nSLZGYajOWLjAfKDEgrRU/vgHTv2Ygbb3WniVSdKl5LA== X-Received: by 2002:a25:700a:0:b0:d16:c58a:e63a with SMTP id l10-20020a25700a000000b00d16c58ae63amr1491610ybc.23.1690258928721; Mon, 24 Jul 2023 21:22:08 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:22:08 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , "David S. Miller" , Mike Rapoport Subject: [PATCH mm-unstable v7 29/31] sparc: Convert pgtable_pte_page_{ctor, dtor}() to ptdesc equivalents Date: Mon, 24 Jul 2023 21:20:49 -0700 Message-Id: <20230725042051.36691-30-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C695B1C000B X-Stat-Signature: y9kryw1nckgkor7dx7kwrwczu5quqk8y X-HE-Tag: 1690258929-661682 X-HE-Meta: U2FsdGVkX1+YrV8uUTpwKWWlniwhtDM5Nvp5Nx+k8HssOBXhG4o1L3WxAhWZqSq7a9pwpx9OHCZS1BN0uz3RtWTtziF47BVdttcIy7JN+g07r5hX3AxjhDUVrdjVyOR2GoemRO4DxOhsYTEGEvH9k//NQiJoOPRG/2uOzEB1SwAyVhSEZ1dE+jPZiDpgFr5iUYxeQKa8v2Xe/B7TPgpJ3KawG20VW0qqVCeNMKjRybVTWFg/SdEXVWd7o/j0tx9T4kz4cADMw9kpos4iO+IuqEL+9TET+rB6tUC+ho1k2s5XRZhkGaERY1dwgH0R4Tx8Dy3MQB/jfS3SE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MjriFrNmLswwCZ4EzqyXEDOapmQ82o3I1W6V0/RZ/voFWxH4MOQGp4aNeg8BoCwbQ38K1pQh/+Pl29Tq2L9GZOGLcRoIuuwIK1xKti3vmieiWnYDVgzq2JUqzdqU2Bdv+pIRIQ8epWkcveNxGr97jUwfmGXPs/NQKQ11dixnvAmWRyAxOyw9Zqo/8fB1jcs2yVytaxPBrY3r+VP8ipGyIWNA= 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: Part of the conversions to replace pgtable pte constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/sparc/mm/srmmu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 13f027afc875..8393faa3e596 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -355,7 +355,8 @@ pgtable_t pte_alloc_one(struct mm_struct *mm) return NULL; page = pfn_to_page(__nocache_pa((unsigned long)ptep) >> PAGE_SHIFT); spin_lock(&mm->page_table_lock); - if (page_ref_inc_return(page) == 2 && !pgtable_pte_page_ctor(page)) { + if (page_ref_inc_return(page) == 2 && + !pagetable_pte_ctor(page_ptdesc(page))) { page_ref_dec(page); ptep = NULL; } @@ -371,7 +372,7 @@ void pte_free(struct mm_struct *mm, pgtable_t ptep) page = pfn_to_page(__nocache_pa((unsigned long)ptep) >> PAGE_SHIFT); spin_lock(&mm->page_table_lock); if (page_ref_dec_return(page) == 1) - pgtable_pte_page_dtor(page); + pagetable_pte_dtor(page_ptdesc(page)); spin_unlock(&mm->page_table_lock); srmmu_free_nocache(ptep, SRMMU_PTE_TABLE_SIZE); From patchwork Tue Jul 25 04:20:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325743 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 6CBFFC04A6A for ; Tue, 25 Jul 2023 04:22:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F060990000E; Tue, 25 Jul 2023 00:22:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E6892900002; Tue, 25 Jul 2023 00:22:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D09F290000E; Tue, 25 Jul 2023 00:22:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C0618900002 for ; Tue, 25 Jul 2023 00:22:13 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 94D70A0BDB for ; Tue, 25 Jul 2023 04:22:13 +0000 (UTC) X-FDA: 81048836946.15.7544150 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf03.hostedemail.com (Postfix) with ESMTP id CB13620005 for ; Tue, 25 Jul 2023 04:22:11 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dIpSbxhi; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258931; 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=JRfRtQSkmDpdaHgWU+x8J8rVDSFtmuGYMRjnXDV0vQY=; b=oWt6gFCoqBE04Cy6oWhRYUxckeG28oGPRxrzKtSj+dWfEO88ylBO+J/BcLB8onHgF+kq4D uY82oNVWlE6M7SKM3J4UVJ0QcOPVa4jU8PpH4uODknMjxL3dJCIZJsjzrDln3Kapg9QTnc 8zh4OqufPqoN1EMoyBS7LUuqxKX3new= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258931; a=rsa-sha256; cv=none; b=Vy7vlHkW5KJ0F0nSgej7u1xhYULJrsSUJOun2UdJpIg4kowv6lP0oW55R5lrM4SE+LIdin Kd/aD+gtLB+MUSYCLI8WoD8RnQRdOyDeV3CKamuJucDig5hdq97d1n3gnPIAdhs1jdsZ3C rlC9vKOUN1mrxl/xpJYt8jKE5MrLj0U= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dIpSbxhi; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-c5cf26e9669so4297005276.0 for ; Mon, 24 Jul 2023 21:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258931; x=1690863731; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JRfRtQSkmDpdaHgWU+x8J8rVDSFtmuGYMRjnXDV0vQY=; b=dIpSbxhiHoEZRybZXN/MVeO3g9uu5Wr3kckw/68K6KR19uhvm31rhYObpAHJDDboRN fN++WCiGx69nFrN6B8d/NLOzRwfLSelYXtCG2axa3nxyX1nLiBBRswcz9UUR+gYqr6j2 ancXFsSIRjlVC+siGAlQPxsDtqvlS6d02kp43kWDLSl5AqbfL3SxRXE8QCvzAnUbAKUU YasskwMDZ8VrwnmHFnrCJmWDVf5znjGB85g4q/nAwV8W9HMi2mBDPg8zNmEW2Wmz/ahG Gd3GY4JptXSFLWhWmWPz4PD8TWa0sGWxRtah1a9utFkbDSvAH1sC4A2J8wMHczxZTgoj 5RbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258931; x=1690863731; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JRfRtQSkmDpdaHgWU+x8J8rVDSFtmuGYMRjnXDV0vQY=; b=gd8TWJXuh7CWZsB+pBTqZ9NXIXHTF7yHGjTq3CkIldVR8zF6fCu0b2aOBaVHCDrtQt vh5QWeU0/OqN3V9buFgFkF/KealLw1QY+SF/qD+P6jDrf6nRO+hUANxjUiU4vHv9nzmO qte7T13f8WllWAsAidgvSu4W6xckTRpHtImCrnZcnYVX6elYkBmaWr9OEYMqivjFwxqC d0qpk66AJr4WAGgU43OkMzV85aWGrCPBt25nFuwr4+ZkQqwvvfoIWu5wdzYFXASphVIa zQeZsKHVJ0RV/QGGWpaULMoWJxKX0Cf4MFP4WlqdN+imBPKeVVp1fgpYXcteP+iQ2cQr dnhQ== X-Gm-Message-State: ABy/qLbJ9WyvRnPD9H+5T6yy4CO8u/t4kzrFwHCyiZOZ9QdL/ZKZPeK7 RAetVihutvccyKdUZcjS66Y= X-Google-Smtp-Source: APBJJlFFrRXSNeam/kWey2sQFPpJrG6DmS1yW3xEJWnQmkKSGkoB3AAvrxYF3pVhZLtkZcpr8uNrnQ== X-Received: by 2002:a25:2517:0:b0:d0a:86fc:6110 with SMTP id l23-20020a252517000000b00d0a86fc6110mr5159740ybl.28.1690258930893; Mon, 24 Jul 2023 21:22:10 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.22.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:22:10 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Richard Weinberger , Mike Rapoport Subject: [PATCH mm-unstable v7 30/31] um: Convert {pmd, pte}_free_tlb() to use ptdescs Date: Mon, 24 Jul 2023 21:20:50 -0700 Message-Id: <20230725042051.36691-31-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: CB13620005 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 8qh9w35ti6t9pd1shkp93hshj1dz77mt X-HE-Tag: 1690258931-852186 X-HE-Meta: U2FsdGVkX18VzDxhh5rDw9y+vWr/JPhbYgF4uvCGUQfudXR2lR7WMFBRHRU3p88zI5YoyJFqe5VDQ1cnBU9Akc6nDvRlegG/0wuOIftcqSsB5X6W+qv62R89rbPcB6c/HqiXHJuGJbUI3dbvOV7lWDbtA7gJIoicAhVsxibdarAuE/kOh8HLRPzGvRZcrFuctnnhFaYK9nFCF3SoSpN5KGx+/OHD5JtdQ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fN6/WsvlfWNLtuh1SHJ+V2xYB19xxvEIb7izhM/r24Q00TQ72X2DJ0uABo7EsOWC4NkXOK+4zJbATy4ecwwL8ZRNCqk/HmVe8iurjejUOzaMmKvViSMjI+O2ebmh0fCoWRQk1fsNn7RHGMuRFT29A+lRQLe9MQ3VK33HRv7tnkp6Gv18nagVr81VXrFgp3lqMw+ag4UPuSv7dj+2XKeEVBp+zDV9gZG0mLK6bImyT9/WWJHlbfamZCPV4kaO024TSD7UjsTDwEhEnxt2zeZYEmimVcX2qAG0UzxK1G4EjFJZ+rrwa2zJCkF7GDLunDHmTFTDDKYspaLc= 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: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Also cleans up some spacing issues. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/um/include/asm/pgalloc.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h index 8ec7cd46dd96..de5e31c64793 100644 --- a/arch/um/include/asm/pgalloc.h +++ b/arch/um/include/asm/pgalloc.h @@ -25,19 +25,19 @@ */ extern pgd_t *pgd_alloc(struct mm_struct *); -#define __pte_free_tlb(tlb,pte, address) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb),(pte)); \ +#define __pte_free_tlb(tlb, pte, address) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #ifdef CONFIG_3_LEVEL_PGTABLES -#define __pmd_free_tlb(tlb, pmd, address) \ -do { \ - pgtable_pmd_page_dtor(virt_to_page(pmd)); \ - tlb_remove_page((tlb),virt_to_page(pmd)); \ -} while (0) \ +#define __pmd_free_tlb(tlb, pmd, address) \ +do { \ + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); \ + tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pmd)); \ +} while (0) #endif From patchwork Tue Jul 25 04:20:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325744 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 68CD2C001DF for ; Tue, 25 Jul 2023 04:22:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F2F9B90000F; Tue, 25 Jul 2023 00:22:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB9B2900002; Tue, 25 Jul 2023 00:22:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C945B90000F; Tue, 25 Jul 2023 00:22:15 -0400 (EDT) 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 BB0C1900002 for ; Tue, 25 Jul 2023 00:22:15 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9A7B6160960 for ; Tue, 25 Jul 2023 04:22:15 +0000 (UTC) X-FDA: 81048837030.05.847A9C4 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf03.hostedemail.com (Postfix) with ESMTP id C769720005 for ; Tue, 25 Jul 2023 04:22:13 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="pXw/al5n"; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690258933; 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:dkim-signature; bh=ge3Da1dLlbVImV5jdD/HZRx7aISFPvIvfEGvqleo2SA=; b=IJJ6S+lpvdYLFTcnxtQA14fd4/3ielLdkJa5CrBAMLG+1LHjtHBO6AhvtolEjADTLqS/xU ov3rb95viOP/zWqdtnrQWxZnZcxSX2vTyK5o3yTJ9rdhoxTVcE0w431vmvTT/6wjZpvCs0 jD7C8wnlUCf/a0e/hTNzaDJiR4zAgSs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690258933; a=rsa-sha256; cv=none; b=xUjVOLx6Ym8fcZ8Q6Fx10XdARDxhyDYYm54k/RWgZHp5vEAQHhJ0Y7Qe7zRXOIrBoJCh13 Vs0Skb5KbSeMzeryRtTpplxBu5Xb0vb5yQRq1G0U/pnZIFau+qC7TsanyYJTNvwYPdTffd eEuDPubFyTvoPt9BbWOpaM2DuQO0lr0= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="pXw/al5n"; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-c5f98fc4237so4297296276.2 for ; Mon, 24 Jul 2023 21:22:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258933; x=1690863733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ge3Da1dLlbVImV5jdD/HZRx7aISFPvIvfEGvqleo2SA=; b=pXw/al5n2PZt63hoen8XWII6rt0WFX5sgjX7qQn8gv0HWFLKnKq3bevtOzYUASugG2 pCxGKJOC5ggVyKCT1VDrwsaEi6MlyxwOLjAg/45BvYDi6yzh+q0BBiRQroW3z59gIlxT qmaJpZ1xyAeP6+U8sI1TI5+kmnURZAb3iR8avL4fKbvg/gsoUc7EkqlV+0gnf4rSHbHI 2YWk0HYiOFW33a4FYfPo9WrS1QN1IRD+XWbKqzPIeVg52ry9QdQcyg/270EcS7s+RywF +5wAnQbinAMNk/Lv6GIEnBeoT41AhvsJSWE+pPOymAwrKRfCNfM+KV2MhemhV91wxD/d 2Dxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258933; x=1690863733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ge3Da1dLlbVImV5jdD/HZRx7aISFPvIvfEGvqleo2SA=; b=anlWzckJjDAEnth0xzkzZ9Rcsn5OJSci3Pgl6+pP7A2E4QIzqRSFTsJFNcstmCGPXt Yd+m5buuHL+XjFrbye7a1hAgASLA/XB1T2R41tAyXrMrCDCivsvTJCfeeo+e8zzQeZqy 0C6igTsARlVUCh6efikbK75eJ3tQ2kOyBoJZIb/u6VDW+zof/D0tD5rkbkih/5ruZfxQ lQBOYJoX/eX99knLFMwOJG5lre4ctFnvLtOTZ3mgR0b2rCWpFqbNL11E8Sn85eZfspKY RJQmtckRa8m3d7Ll4sxCEe835Gm+gwTrmCgOP/pYz4rfOstZd/1MtiGTvvgBoTQXHmbh 6O3A== X-Gm-Message-State: ABy/qLbT4RSYgP0g8p1E4WhXDIl15ACMO3Xj4Y2u0nJIcw+iv/CnpPr4 DkHqi7uuQS+rbRMUN7kTl98= X-Google-Smtp-Source: APBJJlGduGUsku2y340xQfxyEpNx6ubFn5qWJpFMniISafhH3MH0EHub+91fIwUA2U73/kY7XLKlHQ== X-Received: by 2002:a25:5087:0:b0:d0e:2e5c:2f80 with SMTP id e129-20020a255087000000b00d0e2e5c2f80mr4416565ybb.64.1690258932878; Mon, 24 Jul 2023 21:22:12 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:22:12 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v7 31/31] mm: Remove pgtable_{pmd, pte}_page_{ctor, dtor}() wrappers Date: Mon, 24 Jul 2023 21:20:51 -0700 Message-Id: <20230725042051.36691-32-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: C769720005 X-Rspam-User: X-Stat-Signature: 36f88y1nc7tgm4pge7yf35fimoas9jm8 X-Rspamd-Server: rspam03 X-HE-Tag: 1690258933-318224 X-HE-Meta: U2FsdGVkX1/1YDZXEK4KmScrixa8XZTAsPqjG6TFV7I/yjYRnQV09JJcR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y5i1HwWhwsG+6SSbDJLplMK5FLBo1qNXkVqxewf9O7h3ClNMwjK3DykwWzbM92JtccMNF64+7WYFVzFsH72Fi1+72Pus7ySSV7o8UzCtHQU8nCVTX/7Qqyn7VpfT1znSx4cLuUJopPJkWAy5Xk/mmXuDsSZUF74fC0WtldfkzcJsQL/q1EisfPiKDblBkt9MZXrE8bDwUmGQIl0682osJcZF/7a745cjXTKdFP0jatGHF8EcGcKyAxTjwdl0VbExpCmq1lJnU9eJ9+PDwvmRGz4nJGEZZFN/D6oxzzAABxxzgQczvIuyOv0LMmgjOBEFuK2bLeMPwrANJr+YkM4TEbpykeIhvTwyaEFN9ZAow5f+Clo+WyI+XMJLRcA4h/ZjQMqO39elj4vMwk0VGkh4N6FHgg31GGB062rQJ9vKSPUOqjcBHUAHtifH2eiuMwK890Qkq6RiIDNgQAfEVKplHt7hdo2St/2u5KhZrs2Ub8179KDrSfsBujtSHA2glxN1Ln0bEg= 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: These functions are no longer necessary. Remove them and cleanup Documentation referencing them. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- Documentation/mm/split_page_table_lock.rst | 12 +++++------ .../zh_CN/mm/split_page_table_lock.rst | 14 ++++++------- include/linux/mm.h | 20 ------------------- 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/Documentation/mm/split_page_table_lock.rst b/Documentation/mm/split_page_table_lock.rst index a834fad9de12..e4f6972eb6c0 100644 --- a/Documentation/mm/split_page_table_lock.rst +++ b/Documentation/mm/split_page_table_lock.rst @@ -58,7 +58,7 @@ Support of split page table lock by an architecture =================================================== There's no need in special enabling of PTE split page table lock: everything -required is done by pgtable_pte_page_ctor() and pgtable_pte_page_dtor(), which +required is done by pagetable_pte_ctor() and pagetable_pte_dtor(), which must be called on PTE table allocation / freeing. Make sure the architecture doesn't use slab allocator for page table @@ -68,8 +68,8 @@ This field shares storage with page->ptl. PMD split lock only makes sense if you have more than two page table levels. -PMD split lock enabling requires pgtable_pmd_page_ctor() call on PMD table -allocation and pgtable_pmd_page_dtor() on freeing. +PMD split lock enabling requires pagetable_pmd_ctor() call on PMD table +allocation and pagetable_pmd_dtor() on freeing. Allocation usually happens in pmd_alloc_one(), freeing in pmd_free() and pmd_free_tlb(), but make sure you cover all PMD table allocation / freeing @@ -77,7 +77,7 @@ paths: i.e X86_PAE preallocate few PMDs on pgd_alloc(). With everything in place you can set CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK. -NOTE: pgtable_pte_page_ctor() and pgtable_pmd_page_ctor() can fail -- it must +NOTE: pagetable_pte_ctor() and pagetable_pmd_ctor() can fail -- it must be handled properly. page->ptl @@ -97,7 +97,7 @@ trick: split lock with enabled DEBUG_SPINLOCK or DEBUG_LOCK_ALLOC, but costs one more cache line for indirect access; -The spinlock_t allocated in pgtable_pte_page_ctor() for PTE table and in -pgtable_pmd_page_ctor() for PMD table. +The spinlock_t allocated in pagetable_pte_ctor() for PTE table and in +pagetable_pmd_ctor() for PMD table. Please, never access page->ptl directly -- use appropriate helper. diff --git a/Documentation/translations/zh_CN/mm/split_page_table_lock.rst b/Documentation/translations/zh_CN/mm/split_page_table_lock.rst index 4fb7aa666037..a2c288670a24 100644 --- a/Documentation/translations/zh_CN/mm/split_page_table_lock.rst +++ b/Documentation/translations/zh_CN/mm/split_page_table_lock.rst @@ -56,16 +56,16 @@ Hugetlb特定的辅助函数: 架构对分页表锁的支持 ==================== -没有必要特别启用PTE分页表锁:所有需要的东西都由pgtable_pte_page_ctor() -和pgtable_pte_page_dtor()完成,它们必须在PTE表分配/释放时被调用。 +没有必要特别启用PTE分页表锁:所有需要的东西都由pagetable_pte_ctor() +和pagetable_pte_dtor()完成,它们必须在PTE表分配/释放时被调用。 确保架构不使用slab分配器来分配页表:slab使用page->slab_cache来分配其页 面。这个区域与page->ptl共享存储。 PMD分页锁只有在你有两个以上的页表级别时才有意义。 -启用PMD分页锁需要在PMD表分配时调用pgtable_pmd_page_ctor(),在释放时调 -用pgtable_pmd_page_dtor()。 +启用PMD分页锁需要在PMD表分配时调用pagetable_pmd_ctor(),在释放时调 +用pagetable_pmd_dtor()。 分配通常发生在pmd_alloc_one()中,释放发生在pmd_free()和pmd_free_tlb() 中,但要确保覆盖所有的PMD表分配/释放路径:即X86_PAE在pgd_alloc()中预先 @@ -73,7 +73,7 @@ PMD分页锁只有在你有两个以上的页表级别时才有意义。 一切就绪后,你可以设置CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK。 -注意:pgtable_pte_page_ctor()和pgtable_pmd_page_ctor()可能失败--必 +注意:pagetable_pte_ctor()和pagetable_pmd_ctor()可能失败--必 须正确处理。 page->ptl @@ -90,7 +90,7 @@ page->ptl用于访问分割页表锁,其中'page'是包含该表的页面struc 的指针并动态分配它。这允许在启用DEBUG_SPINLOCK或DEBUG_LOCK_ALLOC的 情况下使用分页锁,但由于间接访问而多花了一个缓存行。 -PTE表的spinlock_t分配在pgtable_pte_page_ctor()中,PMD表的spinlock_t -分配在pgtable_pmd_page_ctor()中。 +PTE表的spinlock_t分配在pagetable_pte_ctor()中,PMD表的spinlock_t +分配在pagetable_pmd_ctor()中。 请不要直接访问page->ptl - -使用适当的辅助函数。 diff --git a/include/linux/mm.h b/include/linux/mm.h index bd3d99d81984..e4e34ecbc2ea 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2913,11 +2913,6 @@ static inline bool pagetable_pte_ctor(struct ptdesc *ptdesc) return true; } -static inline bool pgtable_pte_page_ctor(struct page *page) -{ - return pagetable_pte_ctor(page_ptdesc(page)); -} - static inline void pagetable_pte_dtor(struct ptdesc *ptdesc) { struct folio *folio = ptdesc_folio(ptdesc); @@ -2927,11 +2922,6 @@ static inline void pagetable_pte_dtor(struct ptdesc *ptdesc) lruvec_stat_sub_folio(folio, NR_PAGETABLE); } -static inline void pgtable_pte_page_dtor(struct page *page) -{ - pagetable_pte_dtor(page_ptdesc(page)); -} - pte_t *__pte_offset_map(pmd_t *pmd, unsigned long addr, pmd_t *pmdvalp); static inline pte_t *pte_offset_map(pmd_t *pmd, unsigned long addr) { @@ -3038,11 +3028,6 @@ static inline bool pagetable_pmd_ctor(struct ptdesc *ptdesc) return true; } -static inline bool pgtable_pmd_page_ctor(struct page *page) -{ - return pagetable_pmd_ctor(page_ptdesc(page)); -} - static inline void pagetable_pmd_dtor(struct ptdesc *ptdesc) { struct folio *folio = ptdesc_folio(ptdesc); @@ -3052,11 +3037,6 @@ static inline void pagetable_pmd_dtor(struct ptdesc *ptdesc) lruvec_stat_sub_folio(folio, NR_PAGETABLE); } -static inline void pgtable_pmd_page_dtor(struct page *page) -{ - pagetable_pmd_dtor(page_ptdesc(page)); -} - /* * No scalability reason to split PUD locks yet, but follow the same pattern * as the PMD locks to make it easier if we decide to. The VM should not be