From patchwork Tue Jun 27 03:13:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293718 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 94635EB64DC for ; Tue, 27 Jun 2023 03:15:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EEDBC8D0005; Mon, 26 Jun 2023 23:15:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E9DF28D0001; Mon, 26 Jun 2023 23:15:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D3E2F8D0005; Mon, 26 Jun 2023 23:15:12 -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 C73BA8D0001 for ; Mon, 26 Jun 2023 23:15:12 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 94F141406BB for ; Tue, 27 Jun 2023 03:15:12 +0000 (UTC) X-FDA: 80947061664.27.96BA9C8 Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) by imf27.hostedemail.com (Postfix) with ESMTP id C134540005 for ; Tue, 27 Jun 2023 03:15:10 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="Y5YNwg/Q"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835710; 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=MHOfkIhqgNSJuF1KwsijuMuLLSkhgRJG2qdOaXtAfEsLCdvPiyPNedisaFHY9zJj+fkDYs 8nsS4d9soPK5R+KqiY1sdDOEeBG1m58vnAd6bFap4IWysMEg2bAUQaCJGuRWKy7ThkFYOw 7YufJ5babHpUOPWFXxu3pC2bww167hA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="Y5YNwg/Q"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835710; a=rsa-sha256; cv=none; b=OKZa0wVy5wI7/bIsK1AeQ+kUPHpcSbNCN61dxQtQVoJAb2L5COUMImRVW5WWsJbLvhs7DJ 679BSVwcP28MwOKjxMPSr5dtQAbHeqflgxyYnX3pKrurbx24pJ93hb9C/1xn/mD5C9UNvS fOuFlMiMsU8HjHlR7wYeNH+SSd/lzvk= Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-570282233ceso30912007b3.1 for ; Mon, 26 Jun 2023 20:15:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835710; x=1690427710; 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=Y5YNwg/QZrK+aHp3q3F/s+zHvk1fnDqd1/MV2/FtyEws8x/EU1okIb5gZ0g0bwjJIl 5VUUqN9Wuh0HLMtWdAEYbmMx90i6AJPptQg4hAlIbSGwOvljd5Q6n3O/2f8tA77gBCdK YDhNGdvPzlezHyk8L+H+QUfnc3k/4+57L174UxCkkys5LGiYJFRoujM3bGB1Ibcn91ui mqfwiux2PkGJoz2g2vjn5ccwHyr655voiBf0XjjuTxpjhEe8LJcN7Q6CvIBEB03riKFC EsDpQXncNNWQyJs9hFhiDQn510NXqp1Pgv3vGtCcL2I6tmdj8XTW1jmQN/FUgbsQGPmI XxjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835710; x=1690427710; 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=MI1ok/BUtZ46mlai+DqhqyK0CUWajI8cPxJ5+BkPmIZlmaNnuBYyVXJJa946QhRULU 4iryQK2EcVJ9c9kRLK4JTbGU5Zsi4+4LHZhUgW8eRGyqA2pK+dcZxFQNgPoaAXUE446R X9EZwbbWxryIPDictruj+ktzy5aMlaSkLQrL3oQTTey5naIk7wBPVT+nomC8zCw52iAP WlnX8UeFECpJ5fOmWfGHO83yg+Mv22uT0o7F8ZrDmgZ3AD3J35JbMXOJ+WXPlCfsMMUM pLIhUvX6cdDtP6XbB8NI9VVsUtDcsAX1+ghvPeJQIAd2Suqfj5gsx7Q/Wo1prKMudYB5 VL0w== X-Gm-Message-State: AC+VfDz3RbzQqHVKEpsjqoGzkq3u3KG9hfskEVx2di5s86yYjhCPwPwZ cuo832aBU3Z8TrwPl/yJ6So= X-Google-Smtp-Source: ACHHUZ6evDL0HWuUOw/E7eS1sxmpRauJbQh+5KyxG9iaYPnpfZgG5Wrtu7krHuwGR/MT62H3t8vWEA== X-Received: by 2002:a0d:d681:0:b0:561:81b:7319 with SMTP id y123-20020a0dd681000000b00561081b7319mr25124050ywd.32.1687835709872; Mon, 26 Jun 2023 20:15:09 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:09 -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 v6 01/33] mm: Add PAGE_TYPE_OP folio functions Date: Mon, 26 Jun 2023 20:13:59 -0700 Message-Id: <20230627031431.29653-2-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C134540005 X-Stat-Signature: eakm6oo1u5bbwnepedt3h8ituhnpj963 X-Rspam-User: X-HE-Tag: 1687835710-395996 X-HE-Meta: U2FsdGVkX19N83FsOjbo0Tdee1hRtLHDMPuMDYvftn0IbD8a+BXvFd/MoxQxPxfofQv6fV4q2SOBZVsKeT9gtvkivaQi9IJWHoLNal4Ybqo8ySAmVAl+MwMeR1Tbgd+lA/2SSU2KC8D8qKh0caYQF4ZxMNE13w/nCntntp+aOAjNWSO9mdr+YtlefG1nwEAM7eTxSj5sRWpcjyHFinvVG5at1ulYjFoPd1XeAugfY2P3vWkIDyzRw5RVMSXkJh3JtOmVzj1mlNvs8+BiGYANaJ8PXXq0wNofIOypWOYNnCGoEkNGK8zGYjbQEBe5MFK/v53oIvWiLECglW0eZh8KKtMxE0lOHFEr5N+/X+y6YMVkb4ID5aHGbE4+OeHMLpqKQ4xJpN1DV6eCgRtsOKX2o5nSvT/NL01/V7PrUgENtp5K0o+nGRhJVse9VOWvkirvQl38oljpfkIcYsRpNElAUiBp/AHsTrZFix2Pj1e9Yw4YS2+rKJ7RjzEuSm2VaboJ5GBBEeXNUd0mIZZDfu5KEB16zIwMAo52K5XXbL2WZUOf/Ai8raqQMuLsgGflva8l0H8Lchml9+aClDhAWHlKWQh8c2lzMH6813j4MXnzUccZZzeuKhFbuI9xOIxjcq//BdYLti4tMytEJuv3EpMd8hYn3VOz2ZNffweDIP1pSqYkc9jNKlzayuez5HaSoQL3SCjQ0fcUuLrbPD+NocDqLZce2TTTn+iolndz6z1+3kMf9h6lHMJ0HHCGp+BVFBMfj6oAHNF7rUS/X776alOD71OwbUWh37a8IMyGsrst7pQxJQwXk/ssVnpe8wdcDop0IUFnDEejXWuw8CoEXByOTXHdnvW7UwYe3IvHaT6JikBli6VS0a8w0wv9MvufHSGLbubZBlF5ulqQ8hwk0eGZf/Za/3yCUcTbfg5ebN/Ju0xN+p7nauolj3fW0SeK0XK1Fl1hAbO6gFkqzFkSGxn LgU4l19V x5ko01l6k+nOKWqIwvvbosZcnldIgLZzkix+krFeW2WDoFAzhj1FZkPdtKzsP/WmVenmjQ6crr3v82mKN33Rorlsa0ShsQR1UMse5vqUOwNn4wFMQ5ls4YfnccQdndpbnQQ/a9fJVjz+lUvRtQeEnBSs1dIoLlFLBKjieukj+10PnIjMvjwT40ye44gExnLV8BUEeK3Yic9y7GPbgTjMR1VQ4zcbF1Q102WfFVzabOFZKThAJZBuMvBfR+N140EwKYc61q8dNy914WGzZHot3ekRJBsaSoB5/wxvmFEN7UXk4lpZpO1mKACq2w+Q7oyhtar2m7npaiRNAsoF+NxUBvMAh6EEwMX7A+Ge6CGi23YXItmS61LsJBYHxV3Eqk9hcqt26kqRQgvXdpXUtEOnRWtn98SPzsVuh/GZr4W+1VhN/aKNBZLq6TeCyOjwJwGOSsUiWBAs8ILKD6AEQYZg32CFtEiwgtRyLejjCk2QtHjkCqbqXHSxcl0CEujBF8r7xu6S0ZymhdRik51UPysrQgwEj1+KMh14zjRWBwOMgRAOia+hmWJX58SZkkUCS8wZ0jKv7kC/igloAk+cK4OIKgqajQKpO1OEgMk9izYzElXqaU403l1dA1PnSx4GBQn1xCgc9A1Laz4EkFzk= 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 Jun 27 03:14:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293719 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 E84BBEB64DD for ; Tue, 27 Jun 2023 03:15:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C17B8D0006; Mon, 26 Jun 2023 23:15:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 772368D0001; Mon, 26 Jun 2023 23:15:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59F968D0006; Mon, 26 Jun 2023 23:15:15 -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 4ABE58D0001 for ; Mon, 26 Jun 2023 23:15:15 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0EA101206AB for ; Tue, 27 Jun 2023 03:15:15 +0000 (UTC) X-FDA: 80947061790.15.6962F6E Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by imf13.hostedemail.com (Postfix) with ESMTP id 3A9B520015 for ; Tue, 27 Jun 2023 03:15:12 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="KFVPW/L1"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835713; 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=qrvvNogNsRIG83AHolsa9VCJSL8m6r0U+Sd+5GfHivE=; b=1IUJcj/+4CYtshDE74/N8CkPAK2fW+/vCtGl2Cr97dNgnZQzzZKFZrk9tgRyCSxVJMvPCT TUYVGh2VumyHM03u1pK9AFfnkTvTxNmrUtY1YsqWkehyFlDp89ccdeR7UsgM0W+iQdTbtB nlTojpoFG7VJMF/K+5aRY8NW+I2mc0s= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="KFVPW/L1"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835713; a=rsa-sha256; cv=none; b=FH6Xv1Y/SqkpvQ7tz0QkRawJtGD2N6ibhH9lF4ZimGe79PRrTjydrohR7CMYEGb4bNZIpG jL1Kqus3nWVlkX1zR135FdPv0ftqIF9WY82aDZDtbP5YE31h052TEEiVH/EMMtYwzam8d1 PYY61ZVBBBYe44fRRcCjgFt7afgRWYA= Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-56ffd7d7fedso42547117b3.2 for ; Mon, 26 Jun 2023 20:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835712; x=1690427712; 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=qrvvNogNsRIG83AHolsa9VCJSL8m6r0U+Sd+5GfHivE=; b=KFVPW/L1EGxf5onR9E38PakeUBm7Bbz4cFtahphLQ1sSUVNZGd7nER5RaL9WyA/UoL PgHHcs40P3f/vASt7RkKBQRHT9dThfptLWW5jKgWLlumWguDDfYLL3SZytXiaD4+4jm3 +atBVT37Sy/bJdoy89PSRnhwLs21WCXUyqFfA474pZoTc/BYDk8coSLDXM596R5kRLhl TefvIuFAqXot7lehideoP0lQvT6kZ9W44JAb3vqqx0E/oORJxSklOEhBggPE04qM7hKm 4F8j8xTI+8DdC5lHV59rBabQmofEn421JCLtxF3k9d/+4bYzPJjNOJQB3f4xHw6c3xwN WsmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835712; x=1690427712; 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=qrvvNogNsRIG83AHolsa9VCJSL8m6r0U+Sd+5GfHivE=; b=k/LA3zWuT/fAIOd9hhsCs96m6dKfEO+a73t4akPpr7vhfYbQxo3d448GbxwPEDwT3s NkQuDvfQn7e9QZD3YpI98aNYAPYaIRBHfZvRcIHjaVTSO+uDwQ3dDG2e1qOkD7MV1C9q QZpm34RyP7Km1rkL8Zml1aITu9B4c6qEQkp1wNZpQXLlTDFxHu3UvlerZU3+THkSf6oS eZ+a6KB6Oa50qVDTMiwjq0JLhBEV77OwiYRbmq2dKRb4kslFasdZ8rdYP6OwzB6n6lmq ch4euMzmCoThzBmlIpIo09t63aONmS6NmR1W78cSVajZ6Sn7S0b7suGwRFjbka+C9aL6 f7ow== X-Gm-Message-State: AC+VfDxET/CCK4g3X76IO3SkZlv4bHNN9FKYr7/KDb8rKVld6wpDKmQZ qoivDCZtFRqk+mhhbAe2BGw= X-Google-Smtp-Source: ACHHUZ4EjEEup/VuemcyzWvx8SgfEca6vpQ2dFXd0lLvBvj7yBbGJ1thxu6SdSgQ7bisiJP7oRqBcQ== X-Received: by 2002:a81:7d84:0:b0:576:9b21:2411 with SMTP id y126-20020a817d84000000b005769b212411mr8527217ywc.20.1687835712129; Mon, 26 Jun 2023 20:15:12 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:11 -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 v6 02/33] s390: Use _pt_s390_gaddr for gmap address tracking Date: Mon, 26 Jun 2023 20:14:00 -0700 Message-Id: <20230627031431.29653-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 3A9B520015 X-Stat-Signature: diipd357dwpir7j8yw18rixoypsc3tpc X-Rspam-User: X-HE-Tag: 1687835712-613150 X-HE-Meta: U2FsdGVkX1+45jr/dpLV1bL+0dj6lZcQDGOC/bDXWidU21fCueoM7dnQ2iRVNM2UfNVTHUkDjfh64j15EZWbKGrmfBUqmIKxP//IOixOFEVJJEdU2ao3CVyZV7Ps6B6c7Y1QTo2MI2a/y8N0wvYJxMlIw6xpSBiARkgcqAv/zmLgoJneabzMMFOkIn6sLO2fq+nouV2Rfd00rxDB/e1O3lBoSBkUyunDDsEaut7jxJtdw+x3tLetAEMuwT/fKWnlpFxoY70n2bxdUPddHuZ3Sx7HKyP/I7ywOnOSf/X+ep4LZ47zsUe52A+RAe28SMZhsPhrUWmtGygKihBWeo40NFFCSYOjyDlqrRC+yGxwdaIpF01/AUuAlu3XhEWHSwsqDkU6ZPMWEfKtOHR9mRkTRXnqCT2SkSVP8QBziEyRcDu25GwN6mTwMQDY+ao2vZQ6cwzyUIQWpOO+84j34MnLRF9fNpegMbRC2byHpaeWqBX8HP4oIAegteUnmNcszpBxigejc/G5FKKH1RFn0Yb1Yo8/9vyxsC+5AOEcNS1aIsTJ8Gbvuufs3oJlTayN6076FEJBIfRXl21ofI51WrhBjCmxfREdlbPg4S+DPAJ5rdIGczzq2x1bPWN23kOugdRnyj3kIwGrQeqbRh83NQ1zSluddTyrHtew7uy+V5m9gHmglDtkyWBEysxKGPRre8WGMiFjWwizp+WrVe59q/ZUQhPapuR60NCKs0Lr2L+Ei7lEWBrnAh1jcI7Z/zQHY2OlWV2V4MalFmOqYxAasnS6sMZHnz3ZGAAx28IrkCAKg+EAUULAGJavUATDwL/muw8HdiMRKbNtYJbpwjXdhL4Rn17a3vTnvtNBWdTJuh1rGCr/Y4FWSSx7LmyrC+ZUdweGUs7yTXyZRw4tyvIBxvUvmyhK70VI8QPpSn1E9BzpMfXYI90DWB1srKiVBy/tK06SIHt4BNfBEazs2OoleLO oGVcek1u ss+aBmcXpDH39llXuSWzcg52sZTTflqEc5w1Sg4XwPcWXntu7fYMF6lh0bBAKoQi6rrAYrKl8gQmXYXVbfxgzcgovx7qWFu9cwS1riY0EfEPkaBIfuhCzg0aLvAjsg8O/VW3BySVLR1zAyjfrWtQmhUg7Rwx4/UirHS6I0RKCItTokD2BpCNGkPjU4WnBXdaXWa4h8XnHlf5BM+jPRX/OfXOZPZkEKthJhzLdq1ImMFdPTtE516EL/PXEsvkxrAGVfk8X/ogX1I9VMd0Dlx41K3PRx+L77PzhBDM069EVLQuZcHRpP3lZ/rIpdhHychQ+qPq7ByWNQqOhZwfqPQGDvl1Uqbu6Xg0lSvn/JPzv2Ai/sJC7WyGa90wfbhfbGxmTjGhIB5m8FMu2j8IleVfxGLDs/eVYTatUfvECsDV14k2GytEGKbj8TZ78/3lcWSu/ZpFm3Iq7YhJWY4+ua7AaEPfiQ4hrlm/wxHukYI9A2WgmhanjUGmqcGCHW2qv8LoDpS6yo/tkznESc2kEiDd/MbnE2xBQsnDABbYXw1Eifq65YpSz+QxsCWMfQt6dAhn2QXUyA6kfEMzWiJ8fXgGIkU86RlSANElDOVlsilBtCrUCZVen/5ZxW8/oJLatdizkYWwjo+5jGbwRHeM= 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: s390 uses page->index to keep track of page tables for the guest address space. In an attempt to consolidate the usage of page fields in s390, replace _pt_pad_2 with _pt_s390_gaddr to replace page->index in gmap. Since page->_pt_s390_gaddr aliases with mapping, ensure its set to NULL before freeing the pages as well. This also reverts commit 7e25de77bc5ea ("s390/mm: use pmd_pgtable_page() helper in __gmap_segment_gaddr()") which had s390 use pmd_pgtable_page() to get a gmap page table, as pmd_pgtable_page() should be used for more generic process page tables. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/s390/mm/gmap.c | 56 +++++++++++++++++++++++++++------------- include/linux/mm_types.h | 2 +- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index f4b6fc746fce..beb4804d9ca8 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -70,7 +70,7 @@ static struct gmap *gmap_alloc(unsigned long limit) page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) goto out_free; - page->index = 0; + page->_pt_s390_gaddr = 0; list_add(&page->lru, &gmap->crst_list); table = page_to_virt(page); crst_table_init(table, etype); @@ -187,16 +187,20 @@ static void gmap_free(struct gmap *gmap) if (!(gmap_is_shadow(gmap) && gmap->removed)) gmap_flush_tlb(gmap); /* Free all segment & region tables. */ - list_for_each_entry_safe(page, next, &gmap->crst_list, lru) + list_for_each_entry_safe(page, next, &gmap->crst_list, lru) { + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); + } gmap_radix_tree_free(&gmap->guest_to_host); gmap_radix_tree_free(&gmap->host_to_guest); /* Free additional data for a shadow gmap */ if (gmap_is_shadow(gmap)) { /* Free all page tables. */ - list_for_each_entry_safe(page, next, &gmap->pt_list, lru) + list_for_each_entry_safe(page, next, &gmap->pt_list, lru) { + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); + } gmap_rmap_radix_tree_free(&gmap->host_to_rmap); /* Release reference to the parent */ gmap_put(gmap->parent); @@ -318,12 +322,14 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, list_add(&page->lru, &gmap->crst_list); *table = __pa(new) | _REGION_ENTRY_LENGTH | (*table & _REGION_ENTRY_TYPE_MASK); - page->index = gaddr; + page->_pt_s390_gaddr = gaddr; page = NULL; } spin_unlock(&gmap->guest_table_lock); - if (page) + if (page) { + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); + } return 0; } @@ -336,12 +342,14 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, static unsigned long __gmap_segment_gaddr(unsigned long *entry) { struct page *page; - unsigned long offset; + unsigned long offset, mask; offset = (unsigned long) entry / sizeof(unsigned long); offset = (offset & (PTRS_PER_PMD - 1)) * PMD_SIZE; - page = pmd_pgtable_page((pmd_t *) entry); - return page->index + offset; + mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1); + page = virt_to_page((void *)((unsigned long) entry & mask)); + + return page->_pt_s390_gaddr + offset; } /** @@ -1351,6 +1359,7 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) /* Free page table */ page = phys_to_page(pgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); } @@ -1379,6 +1388,7 @@ static void __gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr, /* Free page table */ page = phys_to_page(pgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); } } @@ -1409,6 +1419,7 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) /* Free segment table */ page = phys_to_page(sgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } @@ -1437,6 +1448,7 @@ static void __gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr, /* Free segment table */ page = phys_to_page(sgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } } @@ -1467,6 +1479,7 @@ static void gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr) /* Free region 3 table */ page = phys_to_page(r3t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } @@ -1495,6 +1508,7 @@ static void __gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr, /* Free region 3 table */ page = phys_to_page(r3t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } } @@ -1525,6 +1539,7 @@ static void gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr) /* Free region 2 table */ page = phys_to_page(r2t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } @@ -1557,6 +1572,7 @@ static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, /* Free region 2 table */ page = phys_to_page(r2t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } } @@ -1762,9 +1778,9 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) return -ENOMEM; - page->index = r2t & _REGION_ENTRY_ORIGIN; + page->_pt_s390_gaddr = r2t & _REGION_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_r2t = page_to_phys(page); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); @@ -1814,6 +1830,7 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); return rc; } @@ -1846,9 +1863,9 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) return -ENOMEM; - page->index = r3t & _REGION_ENTRY_ORIGIN; + page->_pt_s390_gaddr = r3t & _REGION_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_r3t = page_to_phys(page); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); @@ -1898,6 +1915,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); return rc; } @@ -1930,9 +1948,9 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) return -ENOMEM; - page->index = sgt & _REGION_ENTRY_ORIGIN; + page->_pt_s390_gaddr = sgt & _REGION_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_sgt = page_to_phys(page); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); @@ -1982,6 +2000,7 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); return rc; } @@ -2014,9 +2033,9 @@ int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr, if (table && !(*table & _SEGMENT_ENTRY_INVALID)) { /* Shadow page tables are full pages (pte+pgste) */ page = pfn_to_page(*table >> PAGE_SHIFT); - *pgt = page->index & ~GMAP_SHADOW_FAKE_TABLE; + *pgt = page->_pt_s390_gaddr & ~GMAP_SHADOW_FAKE_TABLE; *dat_protection = !!(*table & _SEGMENT_ENTRY_PROTECT); - *fake = !!(page->index & GMAP_SHADOW_FAKE_TABLE); + *fake = !!(page->_pt_s390_gaddr & GMAP_SHADOW_FAKE_TABLE); rc = 0; } else { rc = -EAGAIN; @@ -2054,9 +2073,9 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, page = page_table_alloc_pgste(sg->mm); if (!page) return -ENOMEM; - page->index = pgt & _SEGMENT_ENTRY_ORIGIN; + page->_pt_s390_gaddr = pgt & _SEGMENT_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_pgt = page_to_phys(page); /* Install shadow page table */ spin_lock(&sg->guest_table_lock); @@ -2101,6 +2120,7 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); return rc; diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index de10fc797c8e..fbbe4e93a9ba 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -144,7 +144,7 @@ struct page { struct { /* Page table pages */ unsigned long _pt_pad_1; /* compound_head */ pgtable_t pmd_huge_pte; /* protected by page->ptl */ - unsigned long _pt_pad_2; /* mapping */ + unsigned long _pt_s390_gaddr; /* mapping */ union { struct mm_struct *pt_mm; /* x86 pgds only */ atomic_t pt_frag_refcount; /* powerpc */ From patchwork Tue Jun 27 03:14:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293720 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 B0A5FEB64DC for ; Tue, 27 Jun 2023 03:15:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 43F678D0007; Mon, 26 Jun 2023 23:15:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3EF4A8D0001; Mon, 26 Jun 2023 23:15:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 291A88D0007; Mon, 26 Jun 2023 23:15:17 -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 1BA638D0001 for ; Mon, 26 Jun 2023 23:15:17 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EAFF71408BA for ; Tue, 27 Jun 2023 03:15:16 +0000 (UTC) X-FDA: 80947061832.05.B17DDD8 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) by imf15.hostedemail.com (Postfix) with ESMTP id 29E5EA001A for ; Tue, 27 Jun 2023 03:15:14 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="YbS6It5/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835715; 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=g10wkISUfh+NWh/zmhT9FX+m3ZttfvdTUqPKBonJP24=; b=BHyeawmBzr3DdGDOUAS82Wr2tjCDTFr6Eg4iiicNcvKg25z63pFUEsWriRKmquYxsw0UFp SB6bCcPyDT9AoVCF6hMdynX04OV3E5+vzcWKE+u9W9JhlBtenOr2QvAjvLdDOaL6mH0lVH H6+NtCIeofQEFsZJ3W7I64yInB1uoVo= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="YbS6It5/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835715; a=rsa-sha256; cv=none; b=bxwQRtzBY13qhpcsZCKbjbxFUkPkqWkTo41UiZDP1SHC5tVlpoZ84VEMEE8T2gAcprPG2m 3UmBnfYYSA5dyTN79/x0WiSIV84O6V90+dXHJmcBk7mBTGhxMzfOJoeDlC9WF1zm2c4CMX IoWAtPEqRI89ySAZoX9ZOhNkKcS9P+Q= Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-5700b37da3fso32873577b3.1 for ; Mon, 26 Jun 2023 20:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835714; x=1690427714; 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=g10wkISUfh+NWh/zmhT9FX+m3ZttfvdTUqPKBonJP24=; b=YbS6It5/jG4gj9GV1WnqlWfE48J9CdnxNvOxOEYb2jkpFBwkcijgogv5/2FTyBYSJu izIlhC4BKNDwS5s1e4kK9kflroiGbN+V3CM6t7L2EFgtcSkg+ReKLemBNYF5Y3oVXg4d FUK6TJROlYVwfl34r2gL5piZl88lZtnh5mJi4W6rFRki4guA/8D+KKFrkkfHcSu1EJOJ fncA5E4mKOaGZV6UHnLSf+mughQQ2/sG6vdU9OT//BnRvDPbrV7dVSZuLKiGxg9g4JB4 L4rqAG2yhTX1HWLW8k7KKi4wHWH5luhyXPrJQJ+E2hOyRozoqBZDlMJstEk3Y4X/0/Xj 8nVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835714; x=1690427714; 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=g10wkISUfh+NWh/zmhT9FX+m3ZttfvdTUqPKBonJP24=; b=PeqArqWSEQpYD7eu+HD6GQvO55rn5hAxAtIf0w4zxytUrCmSflghLEP03WQ0nq5QBw whOKUmyg72YjcCNMKrWz4BQkuocuB0qK+wCYubELoJg2jiJJ21D1f19XoqwZTkRocBL9 iE5dvOAsLujAz9MFeoU5s0fv1Ta5sRie0yhTzYWc0i1UfUs+q4/XepFWcHheuhrGjOgs qh2Zoa+D0vFSuju50DptwWwsGOWXlJOZeLxMup3ky8v353HXkTrPw6Dwbre26qtmdvEd oofPLu7cQj+5Wz6rLHKz7iZI3cMkAM4xk9AD9WyOmrzSSl6GY1Ew+ZOCcdWHGveRFJx3 RHCg== X-Gm-Message-State: AC+VfDwiMI7vXnvnEUVC4YGayluZqpcFo8tOcQs7ZRbOErFCmt2nrvDB rjmA/gzkFRNGVXyDKRZcLy4= X-Google-Smtp-Source: ACHHUZ4trddfgXzjmNYnvfIX3UyOWVfVwt64/0k1X+1Ib62f54dPN/U9UUyskS0pcHiYwtqCWDYcTQ== X-Received: by 2002:a81:4e44:0:b0:56f:ff55:2b74 with SMTP id c65-20020a814e44000000b0056fff552b74mr21585770ywb.37.1687835714203; Mon, 26 Jun 2023 20:15:14 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:13 -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 v6 03/33] pgtable: Create struct ptdesc Date: Mon, 26 Jun 2023 20:14:01 -0700 Message-Id: <20230627031431.29653-4-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 29E5EA001A X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: kk5b8c5wkdzmewqmjrdoyu59hifk74pt X-HE-Tag: 1687835714-919877 X-HE-Meta: U2FsdGVkX1+bdsY9+bAeMMZFhxI1iS26okC5s1IiEzdIbNyxcAJ+yZbcReoYnm6XuTBZ7TtLL868bD118bTivJlB7ER9Ce+aKfuUToSzB+eYoC+njrva09TuLQQksm+ZKVOxDl6fk6TEfa1zBmlh/cr7SK3COEW/FmIoqf6DwwYwO7pMnA2oZHupS0mYTAoWI1cLv8+qyPTenyf6J0lqF02xknZguhpSuvM6/E2uC7lMHbe+TZirvL1a6ccDjcuvEQWLF31A+kVnHDINnFcWalRrLX0Nbt8rWL9M3XGkeZjjbvgFhTR+5oXD8l1StGT2q+Uc7JjdLroaZHqGmnzQnHN/wkU3Irngk7pTKM8hA0GER9Cnac2xA6aFs3FKsmpJ3c38i5eqPqA3KUACECkygoF5y2ceFwv8iMK+rmUVSiz1DW2ZHT5BczjTz8OlqKQ4zT6zr5iB2DW/BR3eenYX40qjHPnJ5bdzvh4JQw472e2GF0414rBNOjPTrRCLgZFqQ1nRLsW1ftwNJbZ+PCJ3XxDp1ifBtL11fYjotmTYZMHF2mqwdUOMsK9RR1jil2rYKm3zSRn7FlQYcHHJktW3ZxghmhuZcgT7Jfoqeg9URQcqkvVeluUiPQEJQp6CTRUNu/snA2O0uLlk81x9op5JFhZpVzydg4+IxjoqWsGP7uyK6gmyCJI2RP3zvxTEi3iap/wGx6N/dCNnn86ckDHuehp15HUUsH6hpur8R26HyKppIhU01q5nr4iLEf/sN9oZPpzrj3yf5+fra88I++Z7QroTMf/wkFyeZmQTetZaR3RSkNp3RkwEDcmpFCHgmr+NpkZahB4uYBRw+1GHLYWtkvCBXlbwbNUGocIognGm47teT9sO3DJUzXAXM2dTkP4zenVlltXlOjsAiHTO1Bwfg66FSNq683eClr+/cnsaZGGPTQz0ruiqYl41vQsxp/ezhUbEKqGHwq1d2lY2ccr CA4nBGCz AbTmOUixULNOPoLFcIgPyS2morxNCbr865vaSF5HsQNc2oAqoZ9lH5yJ0LTSq268IcqWwI0bKxTsImHx7TJlc+V+wYU4LBLhEKHpRlj1rF5AFOmnc80M665wpPOYbnjc5ZJijK399hcowYfmxvvilJMFQt+cuI4t9Gm0E5+lTCJ/zH/osqDmkEqWJPrncgX0wwtsx6YMHxgqOduPpIIk2XZYCHMKWYsCyOvaZqBJ+3mI3HoN+YA2q9sCbfrgbfyYdNWctYZTKnA9Tl7DfNChPUlh/0ybff8Tiimiqa66q0X2jRPbX6xTjcsNWqNA6Oj05IDwjwtWz3Hr5KCjW1oC0vJURTFgF6fG9HWEY86bLI04yfn7Da+Advv/oiApwgAxhuTi891YBJgY1qewrbKPZUc5SgtPe1ykqXJJam6//JP84s4rX8Q8oMHV4+zh0WS7bHGYgLsP9Fc1gEJ/jEDWMkURUDZ+heJnysu+HDynd0sJNeuLzTN4610yLkn00pr1UgkKq3VPA3AFrRSKluQwSln8oLCGhxWumadboq0fRwD1sJySDk2y78CK96BsAsrH2MJacXBnOlrsCW9KDN3fwg9zNfQ== 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 | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 5063b482e34f..d46cb709ce08 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -987,6 +987,74 @@ 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. + * @_pt_s390_gaddr: Aliases with page's mapping. Used for s390 gmap only. + * @pt_mm: Used for x86 pgds. + * @pt_frag_refcount: For fragmented page table tracking. Powerpc and s390 only. + * @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 _pt_s390_gaddr; + + 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, _pt_s390_gaddr); +TABLE_MATCH(pt_mm, pt_mm); +TABLE_MATCH(ptl, ptl); +TABLE_MATCH(rcu_head, pt_rcu_head); +#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 Jun 27 03:14:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293721 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 D8CBCEB64DD for ; Tue, 27 Jun 2023 03:15:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FE7E8D0008; Mon, 26 Jun 2023 23:15:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AE908D0001; Mon, 26 Jun 2023 23:15:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 528648D0008; Mon, 26 Jun 2023 23:15:19 -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 411488D0001 for ; Mon, 26 Jun 2023 23:15:19 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 18983120613 for ; Tue, 27 Jun 2023 03:15:19 +0000 (UTC) X-FDA: 80947061958.23.D6273FA Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) by imf15.hostedemail.com (Postfix) with ESMTP id 3FA9EA000C for ; Tue, 27 Jun 2023 03:15:17 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ezZY2RRa; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835717; a=rsa-sha256; cv=none; b=sN6TPv0Z5iVnZAVAfscyWlmGhIjdPXraZVfRg27ve+M5P8zJ/wqvnWaH2Z+PwEAV1pPzgh kxTEG6/O5o4SqKreq9lvxW35NjpxESm9WLHeSDQBFuGnZ9J5P8GJIcTuq724sHFqdkWVUP VTdT5Yz6lNTkUjLlz05HFfHU80obHkc= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ezZY2RRa; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835717; 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=HtFJ7gYDDt6nFtJ3t4rf4iEtrxS/aE7Nt5tBsex6r9A=; b=wEyDYZyleQlTyxcfwwUsiFG0+AcL7LOBICr9JdvLhtQk2EmqDzlCT8oSjTWMQMfF1Cntw+ kgFDCJSWkDLPuG7UxTukZ7z4OcdRul3dxfhUHnk45Df33FAz4R/XIgaWZ2DgUrNbz83DGY FepPxv7bqMMJNedkVGWsJZFq0NRUfJ8= Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-5704fce0f23so42032547b3.3 for ; Mon, 26 Jun 2023 20:15:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835716; x=1690427716; 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=HtFJ7gYDDt6nFtJ3t4rf4iEtrxS/aE7Nt5tBsex6r9A=; b=ezZY2RRaBsO8vupgw2jirYZqUqmGibvIwA82DEMWpf56igWuBXAqitT4X8HFP0H1em qInNajfNuzHXRKyCsOjr1ow6YjtmBJmSGwTpqkLixyNIhU7k9Ph16qz2hibDBlk4ocWn RdQq60FSFIq8+C1zjLLZN/Rg7C2lIgGdw5ZwRyR727fqaxVVL271FHYTSlcEWFbnTW+n ai4y6LrhJ2fQPdUOuCCIjPAYCrwucE/VRobbMg4Tdi7YBB6HSEEQoC+LDsht9wreS+ur 2ZI4rM/c7NVhKyeNzOFTFN1TecKoEZQs/ZCcRhwVVJL+smX0rtd7NxGtRSoeSJDmpM8H CrQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835716; x=1690427716; 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=HtFJ7gYDDt6nFtJ3t4rf4iEtrxS/aE7Nt5tBsex6r9A=; b=kn4K1/66JT+OZnPLZsVT0ceT3/ifrBzO2WerDOnrjZ5gqssv2Cbh8ZM9IuvSqkr1s/ HZ67DLwOe9VKbhr2AKkKigC8dIJaTA+7TM20S2xU/tmXAZZqS94LzGV4GWVE2yDhMZaG EeI8teJQ0RW6YagQ3fKTsoMjMfFVoNeFqREEzeqacCRtrbKiOhokVNNIKFEQrIXHv6o6 QGRAn5EpncD1ynl0l0gPqjjk/esnoajGAxZzMvhw6DJoaNKj15+Kh21ayW5KrWNr/WYz jE7b4tw4xnqyWZpwjs+Z+ZUc75eUIg41njFdtCzboKEiISNt1ztxDEu3Wu45CH74SgbV dsWA== X-Gm-Message-State: AC+VfDxpIpORhnDYo/uwbQwENJ2anbdv3qEwR+zJ8dU6L6jabINn4qCz ohY536CPLO6mKXCUcOv30gc= X-Google-Smtp-Source: ACHHUZ4EM4P6arjbVFZ7FT16PBM+ahxIjoFzjt7cHsivb9z4gadBenbNhcBrFTzqfItdDpBTwEdG4w== X-Received: by 2002:a0d:c786:0:b0:570:8854:8e9e with SMTP id j128-20020a0dc786000000b0057088548e9emr26427874ywd.33.1687835716265; Mon, 26 Jun 2023 20:15:16 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:15 -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 v6 04/33] mm: add utility functions for ptdesc Date: Mon, 26 Jun 2023 20:14:02 -0700 Message-Id: <20230627031431.29653-5-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3FA9EA000C X-Stat-Signature: o8mbwsj8zhwjkoxceswoy9s3489mbixn X-HE-Tag: 1687835717-630047 X-HE-Meta: U2FsdGVkX18WD0tIXiGAS9jckk4CQ4CHZok6loItl014vBQTn/9edSSDy9narI6oqabO+52Vx1AqAR1T7ynmuH08nIsxuuQ/A8hUFuoU1WniNIFj7g1aNOaYBdOohcejEBHb4VY+QMCS3/5mr5HPsiSY4M6M0D9UXWnGQ9biPid6+t5bjTay6uiJ3ckcCJxp75KuYO7X3deaHdiwjFPYvEbEJsV5uaZnS0reZ02g8Au6sad/kplQGJghqyicwFHGgPVXJ7omaob4qX5Ika8cUAwXSvNozBAqfNZEIrDaI5wXpCXW67z91kKIBRhlLMugUssfjN6CpPnqiqoxvB+6SYRJp16d66+ZZLzvpNlJeDcfU2uQIAFTtZXbTxwE46Fi+sra4El9myGq+/69xIvQcf40ACwYbF9W9ApQUGdKvEvc4TNwiLmUVzP5SPhOuhTDO2P2VBMt75dKCHtG9fsVWNg8NGVBUk4JO51bkG+vxQSNzkCMj9qpE/ueEzfMJMqG+kCZ2R1KN91/eDAiPB7wXAsZMTUHaPLUcxnuMMcpLWuCG8TWceQhAn2t01crtBmcIcLhK0GXfPk4XoWEH6UcLhJPICVeXSWJd0gpQJRlBzk/JiZaYPbWZxfwkKcvUrdlh9OcVnJWKVEn4AzI1aTBAxFo/ZGBnCMV0EuVSbQnCACLweLmkVoT+6JrgvuJvgo+CPlSa3qmQi/gRa/O0H3YKmWaQBbqcCOV2sxNak38qq+96+1/Fu/Rcvw26aXIXXqiAyYoBQzymJ3zg37gEiV+OhB4U1/c3rxta0OsZSbgVqN3lmRq3XsPNLgImhr48JiOg+JZjnXFb5JKKkUqbPevl8Wp8DfORfsWGWuOIQcGeKU+LQ0/cFOBYYjT9THgaA9Squ085yvCo0g5FCSzREPcn2igsheJgJR7+3MuwocZExvNpmE4N874UUveYxelKg/5wx4+9W+4FJBYyTu08ZU NZfGBJa0 xwNpjea18IHRa3KU1CQtw1uL5ZZxisJOFPF5WGSPZdi71q9PcLG+Taw4qCyftIoso3BfsYCFkdO3xzCDbPhTLScpK1Fxx5ZSvmfgGMz+3QJOVXepqHZnA63dNeMVqOwapAKrGvTG0BjTffbBmyRIcxqm5nabmPB19CwglS7kbLZd2CDBYtrldPTcLEohYx2bUPWnpNV3tLSrl4YCvRCpjCg2sCZIbVOjGr8MsfJL2DRXcInEU56jm8541xVPdkzrpJ1mmdEXGAyo15w6QcTW8yPb/t8TTToIiImigimucxPbdWMIJ+4JPNqKmm6H1UaVvM5EV8r3aq/moI1HI8ogTYsWLobz5mwXvo4vSBdqOXTYnr0/QVUtfAEL9BYKLHyQywQUd4Fok95EqFr4WyR8hAx393RB9I1iGcgmRAEVJxkDdh5IPzqMcw8X5mgpSaQg0/6lKUqUBpfP9ow6+OcnuBTMbrVqwiy6ewiJMVWEH0miyzTAzpTN7uA5/xQrCwCavnPtBTVjQrxUZRT1PVtsgGWJbPg== 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 | 56 +++++++++++++++++++++++++++++++++++++++ include/linux/pgtable.h | 12 +++++++++ 3 files changed, 79 insertions(+) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index b46617207c93..6bade9e0e799 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -481,6 +481,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 0dad5f40ef96..14d95d494958 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2744,6 +2744,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); @@ -2981,6 +3032,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 d46cb709ce08..e9bb5f18cade 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1055,6 +1055,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 Jun 27 03:14:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293722 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 5BD57C001E0 for ; Tue, 27 Jun 2023 03:15:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C57248E0001; Mon, 26 Jun 2023 23:15:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB7698D0001; Mon, 26 Jun 2023 23:15:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A58B88E0001; Mon, 26 Jun 2023 23:15:21 -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 95E6A8D0001 for ; Mon, 26 Jun 2023 23:15:21 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 68C3BC08AC for ; Tue, 27 Jun 2023 03:15:21 +0000 (UTC) X-FDA: 80947062042.09.2D5BC44 Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) by imf12.hostedemail.com (Postfix) with ESMTP id 730CC4000B for ; Tue, 27 Jun 2023 03:15:19 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=MeM3v1Kj; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835719; 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=5MMx6i8bJUxARp5QNqsq1CJUY3hOxlwkAEMcUNtK7dI=; b=xg6v4coi0VkKlH/8r6zc0LfZGyl+ncWZRqT3qIukK/0ZeRyYjdTptXfOfgxy5b6q4qqSzq TuCxfxr6IWMoPODpIwpgObuze4pQDh9+L1FSg849eGTJyFBoVMLHYGWRmD34ZJGD8uQ/Of Xl5QiVraomSscKhuIWekSVc3RwnaYYw= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=MeM3v1Kj; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835719; a=rsa-sha256; cv=none; b=WMJcQYKuTeT+zw1zWpO9TnJBxGjn2FI0+4LLdmpMmXpSpapB17OdIR+67aCkaLzNTyF/IF BK+537lKQefE5porZ01Rz5vmqOJXkE8HIm6DoG9SzN330ybFX6lWLjB77qaWgLeHwa1qMY Zp7fJUWDmfJlUschV8ubnzcA2giZHZY= Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-56ffd7d7fedso42547737b3.2 for ; Mon, 26 Jun 2023 20:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835718; x=1690427718; 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=5MMx6i8bJUxARp5QNqsq1CJUY3hOxlwkAEMcUNtK7dI=; b=MeM3v1KjtFoJ68g67QFEF1NyVxMiMYgvdlNUvONCKTcddCTBLfXbCvjdDQ2rkMkntp NglXMwE26fCvz5F9nMSZMUxoetH1ZAcsVpi0efOXfEwN4DA6ftYlLFo1JApHI/tubC37 33sHqn+NMB2tr9HBuBdSW/hwIa8uL6U/SOUDWuLzyTAiHAPzWUOM8CjVLD+EbbHd/5kR FnMJGohaY21AmJl4Lrba1v1FCtiqCThvY8//FgKgMI5nMolrkjqa5ElszWe7So6X4/NA 29o+uMEWd5I0Ihfj0/TIUUwfyyspThDiVrfoH9mpbEwmREVQeVNhmFuIVnTUiZMir9ah 1F3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835718; x=1690427718; 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=5MMx6i8bJUxARp5QNqsq1CJUY3hOxlwkAEMcUNtK7dI=; b=Tt01k4WES8lBJvaAN5cAVlZFaQNl1A2MHBv3HUx7hdFfF3hAdhZMbIBXDppFgHBJWM ZkpQMSYpo3gFHmSwDTRFahGh9k4dOJeOIls5ITJwgEGhftzGoAxsB9L8RdcWmGhDVqQV EI33dcAnSIpYsQLg2zGk1Ol2Oi5WPohasM9i8dtiAp8rEAtm7DqkEA/Q7dwufuwQPlFC rBqEAS13i4RNuUqUBBDxsfMBcAw+9slRhImCAkFYM9u5ZJzXjT+XcipCVKOJcv8DgOci q4txOLSh/YS7vVf5/W6Y32JfRJ0kJ55ytNdK3fPtc5wAPeK5xtp9za1dyoT+YTOQNz+R UGFg== X-Gm-Message-State: AC+VfDxOCEGvXFrDaQLlz3M2UGvlYhmdVqxnFK3lNeidLQUqpBiMxwwm QeQL+12enFmRWvTSzlFzaGk= X-Google-Smtp-Source: ACHHUZ7jG3JdEOLXHoTlHZs7iMneXhbSi5TTL08hXZ/YgCW6ZXi6BK/DGPcEgnHcQP1gwkgg+JH2AQ== X-Received: by 2002:a0d:c506:0:b0:56f:e627:8545 with SMTP id h6-20020a0dc506000000b0056fe6278545mr30778532ywd.39.1687835718493; Mon, 26 Jun 2023 20:15:18 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:17 -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 v6 05/33] mm: Convert pmd_pgtable_page() to pmd_ptdesc() Date: Mon, 26 Jun 2023 20:14:03 -0700 Message-Id: <20230627031431.29653-6-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 730CC4000B X-Rspam-User: X-Stat-Signature: 9j6b9b7yxhxq5geqy9tsc3zo5hrypk5a X-Rspamd-Server: rspam01 X-HE-Tag: 1687835719-807233 X-HE-Meta: U2FsdGVkX1/oBzPFMC0eD/jfvTw28ascdWbEmWD/tYcLS3lUttpFX1k8PfEz3LTqEGiFNUaEqaWGR3/BVFpJTh4cz4ZREe/N32fHFmQUEHzBQ1mkTnzNFCFBkM082Gx1hOyY3DyinghrMkee9RzHU6pKgSiM3GGtufjAv5h+I9FGn/l9TLToWtHJSHqMJjd9T9aJNmR2n7xMxU9B8ewzIc/BB7GLU08hfWFNPyH52wCXbM2/X+drMEgaCHDoPGIyrTa8Dg8rbx6JdkUAUWvT7uu94yBVlUtsQYgVM0Zsl5q9WPFoYBss/iR2AMrVg4lp/MngJObTkG1Rl4fIrOBltfnbe3biTMeUPA4hotg3hJeo7I1LRYNnU4YDQhesv0q9OLJuGUm5e4gNigPxYl/qz6n6Z3DDNU6fghxGlz71VQ1ecR3Rle7yNzWUe8RAh85ej1gYGy3u0H74SiUonv4fg1ElhmztBE06m6IDPToRvX+ikDQZVp8cgMDOcnUe99KLisaIWfeN/8kcYIucVZqH8x/wWtkVI/7Gu2iCEJL6P06E1b0ee6NZ9BmLoI35gbKzVyu72nu356JV0LwN8VJDh60g8in9rjXCsh/SnDHOwus1vZyhqX+SGr0Wz6m3iBN/7NLyfkejQImUoGok8Z2cci12O6mNmYlve2nDqjMlmknNTK5Z9Ip4/mq0nEbJlz0+jm052iA3SBNBSwx3KYOMsuzSN3F0owuYr3wYz9A7YMFYiWNym4ekjEKDpkDakMka2X2TMuLJBR30Px7rIGQbdmYvTkadX+zl1dqUviCKXRn8Rcec/YIjSglm99v0jvTpX23BsYHq+Dj5cC5Kt1E6rdQTENsp0uJHbWlocPZ4eif7wt1FxrMnsKeIsKkyOD+70dIiDNt3zl2MSBj4tcq/iEn6WNBiiy7xjoLHtxhg8eahviIPBIOO7LokknprWkCMpwXPG/7oX1MkYe4PQrF rpL9F2d9 fjqwXMfaPXXFFb77SX6ZQegX7hMmGftSnx8V99fDfgZiPGLp/E7Q+HSWvLyvZeqbaoj39dtzGXdGtIoJwWiugz+pjeQDAOug9HKBGrHRgeRu6UKIId6FMBeHD7qg4s2WYltvPgSJNLZduFY1OOEd7SlxsPeg2mknjON3Lt++3mlDYwMVjkxYfoscdJh3BLAhPEL6TAjmluVFrKDfRxJpqDvFl9hQ7caV6HhpnFNVcmb9ssxaYx9upPK3nPLMDPykcQcUB4ixyOPy+U5hOH6zHsgeOrOXcg2oS51T8xUC0mpBBhkeON/uqZhzbVC3BgDZDOMRhgzuxNhZ9ced59V1EtPRjJDpPaO+3tX8ED8k/IiowKil+WwhUj8CREgZzMXCWAuR3jRIAYVY+e/ld9qcHn1gohkk+BZrdGdPyqszI7S6TDA58IDHmUpSyoU09D+1xJKQJ4X9cuAPNReB6eSBJ2LFRx4Beva/nrwylKpy63jvLMV8sF6N2B7msRbMXmPy4kbwKkXk/dQyRvZ/XHeLwToamnjF9ANL25UoaHUi/BUaK3kNLIgmuZSOSU1QID17NizW4/qe6J7SGDx4JTW1FelJvflUVRoMyGUSinar1HcUUTMwoaD8DosOk9Pa5rbIgvkMTKTW4i4H5j9c= 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 pmd_pgtable_page() to pmd_ptdesc() and all its callers. 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 14d95d494958..1511faf0263c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2915,15 +2915,15 @@ pte_t *pte_offset_map_nolock(struct mm_struct *mm, pmd_t *pmd, #if USE_SPLIT_PMD_PTLOCKS -static inline struct page *pmd_pgtable_page(pmd_t *pmd) +static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) { unsigned long mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1); - return virt_to_page((void *)((unsigned long) pmd & mask)); + return virt_to_ptdesc((void *)((unsigned long) pmd & mask)); } 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) @@ -2942,7 +2942,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 Jun 27 03:14:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293723 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 A42D3EB64DC for ; Tue, 27 Jun 2023 03:15:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B1DE38D0001; Mon, 26 Jun 2023 23:15:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ACD088E0002; Mon, 26 Jun 2023 23:15:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 920C88D0009; Mon, 26 Jun 2023 23:15:23 -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 806208D0001 for ; Mon, 26 Jun 2023 23:15:23 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 51A2AA0816 for ; Tue, 27 Jun 2023 03:15:23 +0000 (UTC) X-FDA: 80947062126.26.EB572CB Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by imf10.hostedemail.com (Postfix) with ESMTP id 70C6BC000A for ; Tue, 27 Jun 2023 03:15:21 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GRJmT9zZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.177 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=1687835721; 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=sr5TgrSX24KD5rPSp2rkPhxpII4heal/IIgk1FACoIs=; b=UA6pRbS7ZifQIAsGcK3e6oPGHYPEuHwug12igBupKw7gU5/JhRt9awEz3X3/RTBcfKn7Yt HY8iZvwq8V6Tzbzjt4h1aTFElv2ZoIoPl5k8kPwxzoKZOd4Wg5YdvfKcROoPCeOHIJv0qz T2gfGWdLMny+7W+LEjQCuDyPPbHfKo0= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GRJmT9zZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835721; a=rsa-sha256; cv=none; b=cqrVethji5YbL6glX//Xs3DpC3JS3yaPfYMBao51p2GJ/Fmg4dk/ZdvGobNCpJn08wHiC5 wJcUDJh5U1WE3i2qBg3B3xNcEJlLEC4KIAe/eIJujm/ep+RDfDCVllqlsU2o1gEZnPo4qK VnpFqZEoWBwj1g7pO05oFVT7TbeOUoA= Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-57045429f76so40108947b3.0 for ; Mon, 26 Jun 2023 20:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835720; x=1690427720; 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=sr5TgrSX24KD5rPSp2rkPhxpII4heal/IIgk1FACoIs=; b=GRJmT9zZCc6VZLx9VY+7Q8GbOsBn33lZq/FXBv0aXORmxRac0rj/lSqIwgsFHnmh66 6cAHAx0KI5Lagl5OZRxl+lTWKC9rW3K7h91Q6uOR2njTfEcjIvHn1/QWkX3jlNssdRYv kPZ6iyIVFwiYJpTBLvXR9/yIre3tRTqt009ghcdse7E6cPjs19QO0aXvNJJOMDpClaY7 t8HHPKKx/NAZrk3fhoJWolRioMxC3Zc40A+aLrsXlHiTMIf/9zaAkHOq7TYNlbv+VzGn jItTpyFNqlbWxSgJZgFIeDKcVXb95B0vXbDJ5HgCdgCt4hiGi9xgNTBoUpG/3ZX1ru9x fM2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835720; x=1690427720; 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=sr5TgrSX24KD5rPSp2rkPhxpII4heal/IIgk1FACoIs=; b=SlhQOXDaFYQA/VnhnZF/JgKx+otNwrqFiTgEnDrpH4aPt34ubAA6W/s76P69+Ra+aa 5Zjl8mm6hbVuJCkT01InKqmuclWr3Df/l/8UZA255JMVr4fPQrnGuHm+CjUGiA4pkedU 3WEXbOflPfuPb1sWWR47kccG8pWMmH3qhZUldAfKasB1OpxAX0K9SL1hNL8DxhC+Bsyf 7633QHwEQFmigtVZrtQnh0L1Q+HnzqNKCJ4w2SD+xFGnI2KZ66bTqigG20tHbN3gPmTr jlzpBBYZTsOIzMnHAaAXBIpPotdzpMu5UqUZ7RGaIZIUqsjuM+z3NChMhtTPUGr6f08J BlbA== X-Gm-Message-State: AC+VfDz8UUPIaxvgf2mo12yYB6US8ZE90k3+Aw+GycpHDmfjXccORePY 5gNcpgCZPTT7nof7XttXshA= X-Google-Smtp-Source: ACHHUZ63yguTuEDNtqBAUu0oFztqBMiblJl9iKmWyGby1Nlfce/DGMkGkkGcggiUUjYXFR4C+z9ptA== X-Received: by 2002:a0d:d78c:0:b0:56f:ff75:abcc with SMTP id z134-20020a0dd78c000000b0056fff75abccmr30306915ywd.29.1687835720566; Mon, 26 Jun 2023 20:15:20 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15: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 v6 06/33] mm: Convert ptlock_alloc() to use ptdescs Date: Mon, 26 Jun 2023 20:14:04 -0700 Message-Id: <20230627031431.29653-7-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 70C6BC000A X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: qmm7wpb6jsjbnkztxddh31tje6f68gyo X-HE-Tag: 1687835721-782438 X-HE-Meta: U2FsdGVkX19mHhmKtZb3G3LQ4BiLuSoUGdDjBYfDvDunT6Azh2RaP3szkuylTHGpQmiajgko2ls3YvV6PJihS7Cq6QA73bqQj11/n3FVbEcmVvYa268jj5Sm5AXLREQt9+u6n0RvIAkDj4+eZAfnayUiM9YWsLP9h5fL/UXmgn8BYyKGE54Jq9Pwu1wdtSTKGTLUKcaql8DWdrjCyZq6cYfh+nkKkcwaBtw3xlTIY4gQhFkOzFBD1GA8/VvHC3b36Xng+sGqF3wx/OS51jBeSwqLRqMK8t5x99i0TduC7T2t3LK8QaBWg7fpboBe7PKIkUw1vMjtu6XFP0xVu2SekPte91J+0LwUwSxCCKgQlvxSaVPODM0vE9GsK5FvC6jxZu7CUGeN778UM3E0qV8BALPcI5n4jfAoIAD78nFXRzhzNn4ttfXtnK4CBWupC6IHpaLIJzEf4f8f6SHi4WA5xX4YiAztk3UM/CUplE0ZYhsdLAFRS9ILS/b768HEtUY9xBuVVEv/zO9wYKhlIG1+vEbV6tBQE8M800lo0iO+T2GMhEwjen8xo0zyxG8y+6l4H6ejQFF2Rjsw5ztUycXqM3uTi/qvpUJzzNcSpBw+kK60ylxaF85BnoI7QYfbdqWKyQ+aFQI6q4ebFdOp4geXhECV4p68etVoPnC0G3Q2+mkk0lwLdhNv4JEhfpfkRaq9i9Ybx+dZ9IiIfNmms1hdeASBPA4LwBPCVa1V2g/z6mJrcFvTKU44eK1xRrreF/7wl3uH1IOUtInoUoDDFIWJdzMp+dVXCocrYKrhm9Km0n81epD6TqqPzWkJ5nJqX2UoGWTErM1/w1f6tZYxEYl40Tr08xoQh+GQf4VLtuM4BqMaP3eHUylo7ynL+kvcWJmSHczZoGm/a1HbpiM6zaksqsL+aJslSJbP5s+pDWpbb0aLegCvmZKLAKorURglBRO/n71pBxBQyoJ6Qur1oBP hu+YFnv3 yLuekAQ9KpFp3crq9f+20F+w2cpRGayu42P4oAy+Hndq2zTTfU70uUj9bgHAsJp1HzpyGuie+u2iSZG9Sd2ZVZs9kIJsQXa7WZw5LopjhqVtTu2EgKw09OW7C7/lixsv/rVxH47h6Fc7jgCzY1zZBGz4XPjPAt8pD6KzKN2bHwhObmWllPvo8+e5DF7rQN/hR1klkp14ZxLDqvmtJQFiQS8XF6oS1e3vc9ziS+OyvSRKFLi/ddl+60XJ2hqJ375tf/W3TYCnyXT8SxogwnU26DhZOrhhTXnctnoRKrCKoN/PiK2WSfO3zHaM/i6AC/fBRMX7YSzU36U8F1pBkTLiKxaWTw7iHsIw/woODzGn0/Zm0BFRyVxoVFNlsRKFSPq/S9lGM9Zdu3bb89vedibVsGIjeK8mT/xAbEAwzWFoBxYNt4bfBCOFym/oUENC77aNLMXH3IG1lfQdGmW6M3z7X7wJ8UuHF7T0izGOYL9RFSU0FU67Hqa61LXezwAl1BROXwPeSbb0DCKAZrT0KehOYl4XATBot0mfs7pUKaRXZgulpAZg++k4zheVrMAwHo0zX2EIYJ5NzT9FLZCcU4OAqprXwTh4cen15h9uyXGkOVZ184P9ONo6Kyv5HCd676NZA0eSjrwp1dh7extA= 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 1511faf0263c..39b0a4661e44 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2798,7 +2798,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) @@ -2810,7 +2810,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; } @@ -2840,7 +2840,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 80faf3e76232..2ff14f50c7b3 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5920,14 +5920,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 Jun 27 03:14:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293724 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 CF753EB64DD for ; Tue, 27 Jun 2023 03:15:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BBC2B8D0009; Mon, 26 Jun 2023 23:15:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B42138D0003; Mon, 26 Jun 2023 23:15:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A31448D0009; Mon, 26 Jun 2023 23:15:25 -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 953998D0003 for ; Mon, 26 Jun 2023 23:15:25 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 55E3B160478 for ; Tue, 27 Jun 2023 03:15:25 +0000 (UTC) X-FDA: 80947062210.18.7580679 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) by imf04.hostedemail.com (Postfix) with ESMTP id 9285840009 for ; Tue, 27 Jun 2023 03:15:23 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dOSQZ2Oi; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835723; 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=Z9Q71kHk0zB6vt5ahL9ZHs7069+SCA/PofhBzVdlAuY=; b=1K0P73oEZp2h1E8YauOs9qIcEXeeLblrEQsNxVUuj/AH1pHr8Mmy44QuEj2CvpIBk/pysc dkAhZRCgt4VGEPjSjmw0npA/mTKy9Zl+mUvt2NG08fBUeAXezYQcoA7lRim9wLASAUyK69 aM8idjDvncJ8sgcSz/q/gPKUP4OnMDY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835723; a=rsa-sha256; cv=none; b=PqN838UTLFZrbsmxKFu6Hms/7DtDAcEDKN6aFEJ+e3NCChI4JVQNYMSQo4DX0km/wP6H8z U/ba8gwebjRXSj1e2elf//sBehSy5ylGrj15FvPrwwZGkA34CRM8hgctpAJKGCIuyXG9US P3abbdPbjxlHiLoHuXl/hrROGRD7ito= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dOSQZ2Oi; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-570002c9b38so42369067b3.1 for ; Mon, 26 Jun 2023 20:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835722; x=1690427722; 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=Z9Q71kHk0zB6vt5ahL9ZHs7069+SCA/PofhBzVdlAuY=; b=dOSQZ2OiXRbn7dKMKT1JXAgsN/C3jxCnB5LBHCK9iXILo1l4gDWq1J3cX5+exLYTxn wYoORsV8t6fPDceGwULdTPoZYpfiYfI04T4bOuvjwcHJfivuVIRVY0M+R3Uhc5iOpVeL 0vND8iKDAhmvYQiXoqAJRaFlNkMa3Bk4ZwjVbqbFjHFv+wwgHdDhUknddaUHcnd7Lv+F XfvU3AUvFbk/B6hNpVu5vRnlx39aUpFS25FcgH8ICpzs8p4la51sSmvC+1TP3EUm2inI tzhySMFhH/VY7MUDkzq18xgDM3Cn6KetwRARgLmNOPJ/2w0oaiVuiWvL7GVUeKg27bSV B58A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835722; x=1690427722; 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=Z9Q71kHk0zB6vt5ahL9ZHs7069+SCA/PofhBzVdlAuY=; b=Ol+7BZ5W0H+GyeQk1GmEOzVltIH+iYlJr2FCUrg50RpPPEtEKxU7IDfkt1fDrcWq1K dogEbicstClLde4HUlYuYbSKwgGCieNmMuHhthciJUjh5aXhefR5J8bPXyjrv0GjrG9A +EJPC+ZCYVGgnhwcUwJccHaKFe/AynrXD+DI3tTslcnzbF5AdagTairMiqDrnSdZeyV7 vcZ67YNq9oaymtniX6yVmIcw4zTy78hfy4Frak6uWcr6IXtUBVhypgpuJ9srQjk5lDJl PzFw8OVkBRZRS2+lvPI49s1OC6YU+AnM9onlqV2uAauj4fqD6ifq/t53SaOaszmGYB23 K82g== X-Gm-Message-State: AC+VfDwi9JNcrETcL6AbHNhnVuSpldRTPgReS0YTh2swPdcv1W7CsihY kUR9ylMBxFJx0k6IiiogXLo= X-Google-Smtp-Source: ACHHUZ5sPmbirZ+Hp/U6Mh5uEO5OmHRgtgjjLF/hS5R/U+jD4/eUdYkFVTE6CQ/xsnAMAlWUQublhg== X-Received: by 2002:a0d:ea89:0:b0:56c:e4b1:19f6 with SMTP id t131-20020a0dea89000000b0056ce4b119f6mr32348296ywe.44.1687835722632; Mon, 26 Jun 2023 20:15:22 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15: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 v6 07/33] mm: Convert ptlock_ptr() to use ptdescs Date: Mon, 26 Jun 2023 20:14:05 -0700 Message-Id: <20230627031431.29653-8-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9285840009 X-Rspam-User: X-Stat-Signature: eejjazd415ubedeircpgzuo1ya638zba X-Rspamd-Server: rspam03 X-HE-Tag: 1687835723-137489 X-HE-Meta: U2FsdGVkX1+zwAaKr2X6Dkbn7D0B4K9Wghk3FOiGKsKTSrKZYPImgnuda29IEYdK7Syv4X9+onhbdVPCgAI4AZTFeE6mMlgZnTJKMabIbjRaV5AxvKXzlZVB+uifwgPBpgS3eeVN1Lxrc13MfyFsOaLN1RtUDF124Kjk2VsmMG1bvpzyf+j3bT14zQ3iUw8kikz9PULMBM9EYJjRVNzwsSwhg3WUXS6N3vzVwam+2iZWQq1EIk+JpPkEBbo9bVM9DunEIUuBrm/9EaR2yJ3kQQPyinokZjGTO1q1hXaeWtyNj9zlmKEtRTl9WKdaiEcemhhJ8W2Sm9Dc7DSnM50Dm2IAcrmTK1OhsctRKxv0qzni6y19QSCP9354LcTBLHtd10NiNRcDuElrI/Q3qocOZn4kl9S34yXJ19GzCJC938H7HZOwuuoEJ4ugF8JX5/SwezengTvdHBKJsXg9mNJkVGDQJT54FbTF3vx+vTS/rc9UI/yD0R1ObkBySWGnl1AdeJ60uQ7RMcprydgiI5Acremvppg3BU0/tmp4q0aMzNzDu+bz/8b1opfGLm1DIGXqqpGYLlrm+/L3qQrCTnz/U0Z39TEOgaVAP0F3zVtxN0RNdr3rP7x6O6V9OLpgPX7CX1pDw/H/GnTDS4CVVvJYJI1GpnadmKi/ydvRCagw2e7CyrfZIwstx7xap40+u9smausIwy2JQrJzLMbjJC6p7iSBho+IuC2vWBuoRikTQ5WSe0tYQsJe7XVH8IHnmAL6LeIE2nl71Ei5WSFNsOMdB5QxAhg7XVbPUbtjPC+yCaJoFYmnAVS0+abXChR6XHH7R8jCJAwz4THFL7CNRTwnQgaK9drdckclFWjC14PYMevKgSu2Ewn9qW6ygrSMKOwUWrzpP5prEChl/al8cfx4yt2P4Y/o1KvztoLD2VJ+Ac7dmx5QquiiMoMzh/0eSbxzK6lk1vRwJStEbhrOPEC OkrrMkwL aSxtOPAlnlTODvjNbkeMS11LA3b7Sp9RW+FoBoGiesS819dIZ+hhaR+3Vpk7zFd0L51gcFdTrsYtmIM7vsX0y55Ba5IiZfcq9uVl971cHS/FQ76S1rMJwuKq044J9ZZbdZcoKa8lxv5sDlE+MrzSS1ybOvm2GfD5OnYFfkebxyZwJWAtLTTVV8wAPGQMtiimD7XyQ76tGtG8NM4iVzegC7BfDQm2gDBV+EquRItKNJsvmtVj6mqX1LcB3x+H9v+hzea+d/ckJzq1q0KfwzLZarlfGRszQ/iBrZ4TPV2kkvFvj7T0oWFslO060BPA/bVMldpROlPo+lfyCdYhLeeiweHH7ZK7F7pG2u4fEwjQrIdtPihZrGdl9w2jMALbySpgYCi06QoEAMEB+YqYoOXiKj5sIm2HTYwTdCdvyJsKHf4W5U1DKva5MF2xlkxCJp0AtzVwRQRK3NfbaTh5Mum5awlJ/rZYDutjiuWFfxk9ywtrjRwD1UVQoK2MwviRMHkPkBrhrH45Qan3antJnfc+C/Grbcs+5i/WrtLZMjfkOSMJUGJugGXhaheVE8BeRUgR9TVzgNiYDKwT7RqmRhLBMk/jl/aHBrQYXnHfoSciFzqQdkAy9xcpQ8+p7aOdxw589y5ZwR7kAPRFXgWFc8Syp/rdsCGi2frWkWSxauyLGcROjBFuK5Ziqsd6PtTPZpbtr2IeZSnvA7tAGUbvDBjxIn2iQ0Q== 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 39b0a4661e44..0b230d5d229a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2801,9 +2801,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) @@ -2819,15 +2819,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) @@ -2842,7 +2842,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; } @@ -2923,7 +2923,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 Jun 27 03:14:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293725 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 92475C001B1 for ; Tue, 27 Jun 2023 03:15:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B6F148D0003; Mon, 26 Jun 2023 23:15:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ACD7C8E0002; Mon, 26 Jun 2023 23:15:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 96E658D000A; Mon, 26 Jun 2023 23:15:27 -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 89EDF8D0003 for ; Mon, 26 Jun 2023 23:15:27 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6705B1C82CB for ; Tue, 27 Jun 2023 03:15:27 +0000 (UTC) X-FDA: 80947062294.30.55764FB Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) by imf01.hostedemail.com (Postfix) with ESMTP id 9FD3A40012 for ; Tue, 27 Jun 2023 03:15:25 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bw9pNUcu; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.181 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=1687835725; 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=QwvXTPG+SvX1bm+f7lh9ddV99LBkA8HMSnaL5DvtP/w=; b=4GBm/KiPAdp1d9ogH+8yyaejZBZn1jAzw5QmxO1DItPRgEEGjhblSGbfkn9Kb4CZkYj9l5 72HTdfZLAN0NGt0FjA6BN/k6ult6jPGCY20/79uE2AQj5njml48JSXWgxvGildhVJHLHJW 1yNis7K/kUfnKDjpbQpkqI0kp9UQ7VQ= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bw9pNUcu; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835725; a=rsa-sha256; cv=none; b=Dzza8MwBZhJsavBchpcNp0ld6QtVcoH1KUu4+eMl96X0DfOe1ziNLL+vGd0LGfKmjIz2w0 VQNvgUe63Eph4VKd6NWJdvHxf/+KjKdds2Go07hofIM6jdK53wxKlMfk0LmUj/76kjyJYE IHO+BIbF4pDFHQCotLuOF4c4/hTM82Y= Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-576a9507a9bso36780337b3.1 for ; Mon, 26 Jun 2023 20:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835724; x=1690427724; 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=QwvXTPG+SvX1bm+f7lh9ddV99LBkA8HMSnaL5DvtP/w=; b=bw9pNUcuMxpubm9pq3maPyXbc62B+bsuNNloL1m8ijygS8iq7WYtlX4XdEVQIeg/Zh Ngyg1Az+rnDUxxJdpkw2Xv9RrFezRnlEtGz+ikp5CpgXDK/wyBh05TsohR9gIqLikIrz XQJZpHLygL22WsyZKTUtr35hO5G+O3BbEJWU1trW1sFmIRDgY2iyZUpnQW0acaV8lKSP bClQykA4VjSGm4LzvwTtemLaGQIugu/qzT0WXVHTnnvGtI1PeGca+HTzzD6jettWBhDo 8pn250bIB0NJGxFmMTfFNawkBicAYzNWGl1omwNwRWLI+9cdDNXLQFqbUAr8KIK7W1AA kzkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835724; x=1690427724; 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=QwvXTPG+SvX1bm+f7lh9ddV99LBkA8HMSnaL5DvtP/w=; b=AI9hUHRyKyEidaTX1Zxrk27bHiAUAl9p9mqy1UF6HGfhGIMlF332a78LoCPfJlK+29 FDVafB+jP8+BX1c9rm098YZypr9lOQlmOfOoXNsw1QhZz0Fp1upmt2f9B8bUtvkFXFZx ZZbHSjPzlfQwQ1CkNHje4qp2jPP9lopAwKSFpsi3906QQ7kNEkOQhOHRSgOibYqR3KQK TB/WJUQYc+4EfQ2BkGv+JOrfPc4OWzd/2LqsLB2Tw/aMym5z/5s9DdYQudrkA+gPB4kZ uy6SskNBfxmHOND00V5hiSBnprcpUi01QwBGf94h7UXNq3Lml5wLhDN46SDTesevHjR8 oxMA== X-Gm-Message-State: AC+VfDy4Yg0MFuKRj5nu4t4JWoxp2f+GcPUzrEX5t2Y3sLC94JeJU7dd XkoUoXgf3th2SJTRaq3b/Xs= X-Google-Smtp-Source: ACHHUZ4U3kYwykXpP1FzDZUmgCkvLtNAT31XIQI7+ns8f+sP4iaCy71EJqjX8aE3VjJuNDesXn/JrA== X-Received: by 2002:a81:48d0:0:b0:56d:6dd:c1e0 with SMTP id v199-20020a8148d0000000b0056d06ddc1e0mr35914739ywa.21.1687835724632; Mon, 26 Jun 2023 20:15:24 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15: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 v6 08/33] mm: Convert pmd_ptlock_init() to use ptdescs Date: Mon, 26 Jun 2023 20:14:06 -0700 Message-Id: <20230627031431.29653-9-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9FD3A40012 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: yqtptswhs7okx85w9b1tiumods1aksxg X-HE-Tag: 1687835725-465330 X-HE-Meta: U2FsdGVkX1+0A2TS3dA+T0Gnhegabo7t6NmNanQxCQeQyg4boZz60P+UM3qbnXxAFDKfxuvGTmSfWmndwI6A4og74RzDDr+t4Q/WcDQbL2jTYY+TpnQ5zjHQkg1iRfA5pu2zBZq39mZFWPA20B8aRdzE0JD1g7M3S7D/PgZRRg7IDzSMPHbQXdqm0FW6SpTy9/+v++HbIjBPO9d8tX3hTHS6uvm8EZL0b5LnNaDXUinRwhFkQ4Vb5btMxU5iRZmKcsmARH6lol5q4bN7lKyedXfiFxQsTcy1kx2VRyMg8Qu8f5uAL6+I3WGdNJ0K8oW1bGFP8N9jdtZz1zdUjR39AAcFK78+m+GMbin/oFN4VQJ4HLct/ULU27RByRGSP3+M4wTAAqPlCuct6byb8BBf3WSA3/kve91mvD7+uTj7LKPlXxiIaYul84Eg6/ys8DU5haSn/nXNR3Zh7jaJFQ9Dyky7JYck+tQBakmJonX9LORselZTAA8h4kFP0pRhsQwQOkoqT3NGmHSUxA53PuDddeCcYTZVxF1ZLBYjTjv/o7W9UVHubOMH9Cy2iwGV6lLCtf3SFLJDlnKenrFeK0UcqEAeNehE0bgPWngP5Yxr3KCnyothKjx6NKEuoTQAC9x7icrvNq3wAbYbuDWM0okp53JvwXaIaXZrmAkwcsfsKKxAsdW8m87QeTwlADrYifb+OgFsnTOiETITjhgKGIXvqRXVta3uffZIzRt7ECP1UvsI7WHWdhjYIX2klQG1VJLLXgra9kTjHI6qDzNpurUifv5t8IiCG1uN3g/uRZKQCPrBs6zw2sPELRx1Dpq8c4H2aWImU0ueLNXpGoTe8Fpnl+RnvRhZM9I0qH1t80EmsIzFhH30tYomgrd8lE6l7MOYLe+CiulG9cEzz7+jQ/I5JC22ONmYSYUJ3LQzG0N/F/tkHM0theX9QEzV7+r1uU7sWiKUraTFOUslhvq8xcs /i02pAlc qTctOqPtlXw1oIGyvyvM3g5IKOpOLGShDb80vVG6XOqW81i3u/zcLjOlEJdHzmGIifkQg/gornvZa5DRihP/yb71r+fQCqI/fDiR0dMHI1fKKUTO0STjiAm7hLoHiD7Aq0CVY+qZOEhxE0UrXrO4usoStdZ5K6xS5tBhD++LRiimGKVZuhnH3ZTFm9IpBlzN8iYMC/TzZQ/jqkiKNmdQfM7Td5j9ownDKY7dMdFLao6JrD7JodKqZsssWbkuYkgyVUdpUwtuxsIwL49aVen9DUtB799E+MoEwtJpq4CLg0KpWm/KHq+nO/o/p3T4bS9Npt1PiwvWTn7B1KR5WEuZj7Mshe5uINX5bc0ydzQeQIPT49eKBatfMjp/ogNUHipqZd4VT7GpWdF1hSuWNDJ6pdfrVdhlw7GAjhNy4pbyYS5uZDiF2S7WuR3rC2k87qqB2je3AHk7gXuEUlcH5iJ1dJJ7iyvWG9nfmp5BDFgqX4HmC++e6Adwq4i5MJOsW16FNMf6wcpdXV75gcqXaoI3f3pYaE46gmhiHcqQmhaprkQxGZ+pWkEM0ANhxLoJmtG99miBHtijkXxPZy9RBa/TiNYxIR0XiXHUvGvi0DymYaNFtnMsB8VN+HrLwO/I9OgemS7l4QItfDzlU0TWFMHDg2wEPnr1qKS8ev++50wuZNsCFbBdETA8lF4SZvfOBpNf7bRPOuKdIT050PBiVfRRCyvsafA== 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 0b230d5d229a..1c4c6a7b69b3 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2926,12 +2926,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) @@ -2951,7 +2951,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) @@ -2967,7 +2967,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 Jun 27 03:14:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293726 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 77FA2C04FE0 for ; Tue, 27 Jun 2023 03:15:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D69B68E0003; Mon, 26 Jun 2023 23:15:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D17858E0002; Mon, 26 Jun 2023 23:15:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C06398E0003; Mon, 26 Jun 2023 23:15:29 -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 ABB668E0002 for ; Mon, 26 Jun 2023 23:15:29 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8BD3AB0056 for ; Tue, 27 Jun 2023 03:15:29 +0000 (UTC) X-FDA: 80947062378.20.E039BC9 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by imf22.hostedemail.com (Postfix) with ESMTP id AF124C0005 for ; Tue, 27 Jun 2023 03:15:27 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="pvA/vO4M"; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835727; a=rsa-sha256; cv=none; b=QJelwAWwETwpC8wYNtTC6xycgH6M9pbs95OVYSwoT6M9nGOzs9A+FnXRzMjg512UtPB5nN P7EI/KPKBKRVDJOrdqvvxr9vgNcS61jwTgN2JxpWzBbG+rKBwgcyZxzYruh6WwV+aqiDdb lxDfog5RJQF+1rLHLgJ1DT2refQOUIY= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="pvA/vO4M"; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835727; 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=uRcW1jW+95PozpJhE7MOWGztyyXp9a8KAqI8T3AvQGQ=; b=tFYza1jpg98PG/yM29QzxmzW6SnMWScUqSkAaGnr0dp8GXWsjl/BSXDO0zqvdXmlGbG2QL iUk4vgVDk5USv9V1AuGIX5QnLU2ShgjJDzpB++p2q/FyE7Of/lmOxLM3/goOOMJFmEGUd6 0FUdMOvVrh+AHS1QxzR3zNGmOS37nvk= Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-570877f7838so42432517b3.0 for ; Mon, 26 Jun 2023 20:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835727; x=1690427727; 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=uRcW1jW+95PozpJhE7MOWGztyyXp9a8KAqI8T3AvQGQ=; b=pvA/vO4MDeq4kIIhsE3yrV9+ALefWilKkLuNIgHhecd9VDeKpQ3CrB44RRLXN/wH9a v+3v6EJOL2IcXShzxOvXaOjl2qaDyEgyn03s8SsAgafbqCa5mGXGEFvhH716JQIAT0SC QEIWs35jWLlJpDE0C433qu5q7ESJ8UkDS3w921ZCRctPmdDsHkPUrtmlpYzw5VwqW3do SQRdIAIjkZikdiXvEEkKtp7sFgpQSLF0GRJH1HdPtksJU7st37GWKQiDw1MyawGMKHo0 s5ztl+d6CGvn0kzD8aZyh2iX1osumXcuHPhisUrTXBEX0Rdvq7Iup64Z2b22TeYu/gRr mzYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835727; x=1690427727; 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=uRcW1jW+95PozpJhE7MOWGztyyXp9a8KAqI8T3AvQGQ=; b=LrwdVowL0oY1ipbzQZk2/dC6x7H+15wXEUv9DpsLpPrFHEfCLfkNkEc7RHJeV9Kz6m gtrucbUc/Pso8foggKV1VlN6LMUVoBoFaDB4Um7ku6TkGE/XWSyVq7M+DHSfvXWgPWeh oBdSNbgZteSu9pujj06KKvjBP2Trw0aGTJeBQicBcCuY44Eqy8iW+ro7+85XuPzugrvg ZYHlDEdQ3VuNfW6KXm+FgqslqFx17oCAEvE70ytaKCAu9TyIsaM24LlcUcx4YS8Z/91+ Iqs0msBiiEySpE5mBL9yp5j23Ve9UgK/uZNkyzEzUdAQB5ljSIbOHKZm8aotFdrm483A CBtg== X-Gm-Message-State: AC+VfDy56BQ2dh9iw7jpY8hM7Dffqb46B2VJq2J7MBgrOmUBgGFGjWMb lvWrCW2glQpRjpuM1ST0Wwc= X-Google-Smtp-Source: ACHHUZ44nBppmQGdd8zdkRU4D5yhqKKKAoy0EjGlUrIReqb1/1yiuyQcU5hRXay6VI94GfMmMF8RKg== X-Received: by 2002:a81:c203:0:b0:561:da0d:6488 with SMTP id z3-20020a81c203000000b00561da0d6488mr27417977ywc.50.1687835726781; Mon, 26 Jun 2023 20:15:26 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:26 -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 v6 09/33] mm: Convert ptlock_init() to use ptdescs Date: Mon, 26 Jun 2023 20:14:07 -0700 Message-Id: <20230627031431.29653-10-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: AF124C0005 X-Stat-Signature: zqkmkkhacgphj8irum78xnqxuorbby4k X-Rspam-User: X-HE-Tag: 1687835727-360062 X-HE-Meta: U2FsdGVkX18YjYf90BiesHweqKITKVX/xHawJ/N8tBVo8pjZN32yTKLdSD1woj/g8XNAqg2s9kX734lN/7DtVufCArg/I3Y+2MKESn7LXXvr99aovZHCVJts+2FJV2tHZRzTa2/j9YIxylvHm6yXrQUIsP3V6fzyLmQh+Fr5uB3laL+1t1e5MmijQl+OIsiPeL/iiZpOdTNX9uBv81VeqtXVbY7Oe8g8FjHaZQAyF9Irf+FngiOHXs9AAWJ9KhzVuBROOCvah8+22YOxt/OURHtIwHCWPioG5jA2kRLL19zwk4/bOjaD7mKgnft6MWthlVldxgLY70RCSEmJflAg6S8nxfAmk4CQxW1tEbhYAH8HnRSx1MQuZN2AzKSqZp4HC5pxTQL+MA93PkiY7C5Eat5x5s6EB/kW5kKq5cvHiLgbOVx9r+xy4bCfjGUUaGU31ikeNHUUCn1i5sdQl0LuaURS6eT1R4HInasRoD3mMslpRe3MeiO6aAcI1fyUhel42nA1yjZILUR6ElKl8HQqqY4BYyTUVMKSoUS3LlIsmZY0iC/I2Af82AXhLfwyIQwyROYdY3b+e0Dnm83nllmLhkWeI4N2Z3DNnHcSH6Ij7yLm0/LJ6hlFqWUIaSKCMw2RCnENpR8L4FSxdBMX/p2pWSfi6kGY1X/pcKIWcfSxkjqnsd3TRJY/0+P3mfocW5BxDy32QoYsCUPSAJ5E1a/bueMvJ2aVL1L4AbOtwsTdjIMMHKaTwrHFeNds8TyYOM79c7UK85ZYKcft9fFWksi91cWKhDAxKw/M7IR1xKCPvH/whmzDose0HW1nh78hizrCg6js4wDDzdSQuOZHiSRiYOrWBZUDrkC9W6u8/EERj2QQQ/fOvXO7Xopp3D0wxkFSrd6zUpyS86rr+CF5K/1jjn8M1dwQjb9cLihrcWhWDg2gVOt8q9uzpwCToSrgolVq1aT5+04/H4VhwNAG4Fm e0DhMfte gmpnnXjvxPE1bDkblsiroNTTr1nuikkpQdbi8MOpCB02/qSYkIOqjDOvSrDmaZp7RkfNKnHBVLq6RepPyXop9Db0z+rEHKMq2znQhx+jeCPyQaXYX27JpKVI3NlfrQ1AiWlDE5ZqkKXSXc8x3KaJRVYnSbzcWRW6mN4/1qrqeZtxt0y96QwlwjonJfi4tiHakS/21Zf0WskT7LpHIIkWPRsURmErnEDYg4u5iCN5uQ0tvIuQVK6ViIXVDGXr6cwlqTs1vwz/Hj6Z4mH7QJwuK2xYWQwnEjm4A9XpRG0mAkLwQkLuiomS31w/csES3F4XE2V7b77nNeyVN6zVsMaFlymrfQHKbN5/JoBjlBQuE3uKl9DEaCihn1+6rwANnjEM3MTw0HEtQvC+nHnEa2+WFcoN0P6sIWwfKHfpIHH12i2A/6NWWsEx5CWcESk/WtUFvnvzyLqaKosOI5PqlvNqpvN7fYl7oCN4hRVSNRKMA6A6udouy1OzOTLKkc2PiYgvzjcRaDkaV60Mv/AnAl9/RcIn8aKOp1NfmMeizKZhBLRuGOTabw3EP8dCJRHjaC6WcxjhFpFlhl15WXL+XndjtSGw5LOwiitCMJQWKNRrU3Vofm2p3tjakcUPpIAqtgleYCkTEDbvZbC+Nb3Xqgj/BrzwLrLr8mLqEXfxJPfUliK7zDk9ApXOfGKoPjUQslhceh6zKd4+F/QL5uEbFM+GVWPKNIA== 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 1c4c6a7b69b3..4af424e4015a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2830,7 +2830,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) @@ -2839,10 +2839,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; } @@ -2855,13 +2855,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); @@ -2931,7 +2931,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 Jun 27 03:14:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293727 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 DB0EFC0015E for ; Tue, 27 Jun 2023 03:15:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E790B8E0005; Mon, 26 Jun 2023 23:15:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E283A8E0002; Mon, 26 Jun 2023 23:15:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC9498E0005; Mon, 26 Jun 2023 23:15:31 -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 BB8898E0002 for ; Mon, 26 Jun 2023 23:15:31 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9C5F01204B7 for ; Tue, 27 Jun 2023 03:15:31 +0000 (UTC) X-FDA: 80947062462.13.D06B03D Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) by imf18.hostedemail.com (Postfix) with ESMTP id C17081C0009 for ; Tue, 27 Jun 2023 03:15:29 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Lg2sjw4F; spf=pass (imf18.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835729; 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=wSwuU7fg/k+TT5PagWIdYLap7GxOydHG9fnVI01D6B4=; b=yaJ9jTcw/sdBsgZhMdWT91XKecUVRgvH+MEbxvYDDDbVXgEVk8xkNGj9cThIlb4svC7JGU p7VbviXNaQAMlJrLNXGhNvB78QKpdalH/4nQeTzWDa/Ac7/wS+7y1AqStnFiEeTL1M4r0i Izv7w1qac5w0IrOEyRJi6/rvGieV0E0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835729; a=rsa-sha256; cv=none; b=7dqfCLBrZgNStgcxcUgXncMHi3q2pxsgq6QIIeReT9L12DwLzJlHW0Iu9qcLM8aF4m71I+ 5dUhBX+Ca210ysa487G2As8pg1IHWdnfnlqZTnTK/p8k+JUTfMNiIzxemwKySwZi5ocTsV 9qPW0vpZxlTQR7wUz13OEQRunZ9z46o= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Lg2sjw4F; spf=pass (imf18.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-5704ddda6dfso44575267b3.1 for ; Mon, 26 Jun 2023 20:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835729; x=1690427729; 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=wSwuU7fg/k+TT5PagWIdYLap7GxOydHG9fnVI01D6B4=; b=Lg2sjw4Fq7Jsh/1bPb8/Bz5bb4WbWygT3r2OYZVXGMBEwfozbqxm0/F6bIElAKjdHD k9tw765etUmPaJavNHOgRAh4TrN9WtYkyFJDXO4e8zB0CLQ7CKYG2S6Z4giPdak3TlLV dBQDIQS2mzx3Rkho31FJSGH9B3yVhFoSm33zMOn6yvA7Um5yH03kqWlR3ymYgVkxmZrE IJEFqdSDC0V+0/+0zxMFLR8Zuzl0eiDJ5KrxbBEu73g+J0vEbUyjW5NugtcJ2jWIZ/MO 3IUWIpYlYW1hiX8BTPI8estSfzK1mYASEDhKfgKz4greHIhYdQhx0bK/LpN/7ezGhpY+ FpXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835729; x=1690427729; 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=wSwuU7fg/k+TT5PagWIdYLap7GxOydHG9fnVI01D6B4=; b=a2vWKE4s4x/zKdYAivC1PZYkkG+gN8S40A6c9yuqFGnSna6G6tQh66Cv6y7zrFIwJd OwzESU5u1JBbuckYaxvnxjIPXgbgAqfZQy3FkHPnV3R7Ip9iiXxa4wQ2ZkEStPHPw0/q dEmV6aMpg9HfCL6EhgeDs4mBk46C1N/hv+cgsULrItXMgWf0gWA20m7QLxKqCNDXwSpc 1xj18l4ZuI5pom+assj6qc+mJxYHrnDex8QYez5wJkvXibO196p/TC0z0PryxACzpV5m Kg1PAocsXj/8ztSlCOLKLy1zmCsa23fmlKuC+vwTD0WicwzwS+xk/3YmdMW3qQlw5VBl q0iQ== X-Gm-Message-State: AC+VfDxZFkv4Amkbupn8sD8TrbKu7QsSeHYQsUPHExona3Rcne1aOdJA ZXdyKvvvai9v+ybVD4dD7dY= X-Google-Smtp-Source: ACHHUZ46AY3BqwTWqQUYpGbmhIWT6fwcR58AoQIOUKYPJMkYvs0jOnx1fxcN7fC61p35DP7uAiDexw== X-Received: by 2002:a81:6887:0:b0:565:cf47:7331 with SMTP id d129-20020a816887000000b00565cf477331mr37299896ywc.2.1687835728818; Mon, 26 Jun 2023 20:15:28 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:28 -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 v6 10/33] mm: Convert pmd_ptlock_free() to use ptdescs Date: Mon, 26 Jun 2023 20:14:08 -0700 Message-Id: <20230627031431.29653-11-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: C17081C0009 X-Rspam-User: X-Stat-Signature: 3dogizsn9b5iwn9d8bapceurpjrn4qdp X-Rspamd-Server: rspam03 X-HE-Tag: 1687835729-474352 X-HE-Meta: U2FsdGVkX18hxQObz9BUw6LK8Ous8SJQDcSQQNFt0kW6skOz33v0eDZs0UNuak+oyJplFii20Z7zbrItdQS2/deImLDhuS2/o1CHOobiZtz+1QNXaCsNkMeFK+f7YFtZfjF+AJJPG+mWKKvJZXU/LIEY/DtUm8CB00PniHKHY1G7/khIEa2inkqPxvgVJIJlYCqyPopoKVEYKEAlS6yPSbRHxKCMazmXgZZ1k1u8vbdteFXg5hQu+BQChGFqVWKAVxVanYrSdz105TjwuMCQABUGpCHqCFdsNaDp44WFjkSICO53LhgdaBkO2WklAEr/UItMSi61/ri+v/z6HeTcZi0ryBnJGZHXNHQ58aHjUMi4EZ2g4vATmc9Y8Df306p72A1LHc3aHU5eGCYslzYVdn64o9j3w29MpfQuRcR3NNIVJbBMPl86n31nWkh1npV5UoyD0Sp1qRyM5ZzyNdgq5h40kOnh1TTHiAkdIutLMuozsB3F+vkljO+jimntRJOj/gKEyPLtZ75UO0R6aXjPz64BDQDpsjqw4gg9+HVJ71mernAJYOMEnQ8Z+FiAtGRyjwgZLlfqb02puUQw4wlkP1CgshXQnlLOg5CejA94iSMBOQY13QzoCbvKRX6V+Bf6wonc+ECF+HZ2YNnCW3dfHr7SLkLle/q5CNuzvhywngmW37z7cBTx2x2uaAZCeRteiWhYoQgLfVcpWAHES7AFLgezYNR9csRROek0pGHo2df/eLCbwW4bhjj+UnimnZKItNxN5fsGsJ8dr6CuXQGALYHQrjaeU+p5KWEk4qzEkQgg8mLNI02plW+3PaM+/uuvt7R2hoYKAK/aA8k88MEoOXyJWG/BHSHgwfF4USvQNbqtGsY+HZ/GLOiarWZJtXYdosdvX4PysjW2AG6NwsyksipDielKez67k0K4mD+0Fecob9zDmgN5iZ1/UV5z4JwX0HVdVlDHhMV/VfN5KR1 H3zUxd/k IlmJODd/4XmgQX0EPxHiEkDU2GnQbiZu8SvZQuOfcJQmeuEpXTVqk/0C+bEpo/5B0Zh0SRJenjwc+XfFjCSB50l2sVXVda/0wr5w13v/C6Pmys3HUAgZbyBE1K+KeabC5xyL9mNzrH037+ZS3vkToHsx8t3oQ/PYTuzL6Wp7wAZ0zckspqB/u/AouJwI4OTYnN/U6crlVwORyfEczg3Soqs1C6TBrl4NkHN/gRYnW2I5cyJLuUhLljAoFCWzZ3oknsa94mUsAJxPkkWCisaxAJEUSOm4lgf4Oa4VdrpK719ZI+OJDjkeMTdjXntN0VPqYM5jXubIvGw7p6WtmO/mU0UjPwL7oAf5Q4BbV8OxIMEovklhzxFMxxhd05VM6U3LK7okHtytJiTftwEy0GHFIceYJxapHAtidkz5okYz0KiDSOkcTXBp297cpOwXbIK5ezWJbfydejmqYgoje68Jje3PFXkQaIXWXKwJsTobb2k8VX14dZnIEZf2r2+YlJcenNbB2y0p7/LYzOVkBZidz1CpVV9i59Pgou8fg4EwluqlKHMiXL6yd9XRYtEFYz2Uz9kpuJgKbqZumD+T6uLQgcj54aFl5FkBODOTA/g3bjo0Dshla66vEYpfi+ojPcqevczHUMisDy7RPhntZfuTAaaCgYbgC4+kpmpwhgykXRKLC5hZxvqgTHeazQdme+QRwDynvX8vXryxJGLHrKJzqMR/+rQ== 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 4af424e4015a..0221675e4dc5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2934,12 +2934,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) @@ -2952,7 +2952,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) @@ -2976,7 +2976,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 Jun 27 03:14:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293728 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 2D0CAC001DF for ; Tue, 27 Jun 2023 03:15:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA1FD8E0006; Mon, 26 Jun 2023 23:15:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E029E8E0002; Mon, 26 Jun 2023 23:15:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7D118E0006; Mon, 26 Jun 2023 23:15:33 -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 B5D3B8E0002 for ; Mon, 26 Jun 2023 23:15:33 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8C943B0056 for ; Tue, 27 Jun 2023 03:15:33 +0000 (UTC) X-FDA: 80947062546.02.2055122 Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) by imf09.hostedemail.com (Postfix) with ESMTP id BFA0D140005 for ; Tue, 27 Jun 2023 03:15:31 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=NN6JuQbc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835731; 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=bhgUYiKwQSwYMGFv9d1r56wjiuPfdLCT9N5JwdJpvSY=; b=4qPTbuKdHt41agmUNJXriapJo8p7AJuN2w2YCMNOgfJXPclXlkLdf2n7+PrAhd5MKD/6gM 51dqhPHXeITV3ESUlh7jjUCNuMA3FNUwJ+81XsSkZZJrVEs+AiqzOLh0HlcbldNSY4opGN 9nfl55W5EXDNOY2y5gJLIgnr9LrGjz0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=NN6JuQbc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835731; a=rsa-sha256; cv=none; b=lL70++9m25w4nQHwpKjNmsKOjo/l7WuPRJM6hUztGxUHlwQXbpHREXossKI+QPg3EctUOn D/fJ/Xi/B1BLpOGg+fOoM9klXjSb6l/vVFE3kESIEav2ZR1RMkZXaHXSi9dVe8mLQaipiS FSa826e8kgd7EnLFTRAgJ46/+PFzpPU= Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-5702116762fso43159227b3.3 for ; Mon, 26 Jun 2023 20:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835731; x=1690427731; 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=bhgUYiKwQSwYMGFv9d1r56wjiuPfdLCT9N5JwdJpvSY=; b=NN6JuQbcJSEhuQl119fqyrzmvfTJLSgZNGPIizHO44moV6zy7vRkkkGbpzNnm+T/zk LfpssTQxYHLCLcRT6ur03GhfUH0PR3hr1gEAZWn4KlOVQ/bRaXKu0XwyzIXh7FK2T78w GV5aBHngJRtwmpryMrqg1wnpyNcK63Z6rXozTP8pqdze8wtkdCn+4d6Nxd1VmHHTwiSp Hj2gVskjJaa7d3mxLgebdTWNoaiyWHEkTnVETMwzQNfFNqae/PKVEKJL0sEqbBCs/7Gc Lg3rR1WUfvzFXQfsjuyOG1PSX82wJS5wL2NRG2ks6qk/cPnX1GTuY36dOOOiPPB0JsGq 3KdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835731; x=1690427731; 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=bhgUYiKwQSwYMGFv9d1r56wjiuPfdLCT9N5JwdJpvSY=; b=HFXS4owITNOCLKmNHrCHZI+UWU2XeoMOAq6JliAv4aQvvx3Ba7fDHoGSnWssFTUJ/x gxd+YHp+w6CeCGf5LT9/gu57Kl/vrPIEE4bkuWVrruH44a0sh7Jw1cXiD8cCOjNcGUEV foIxV+pP7+N/JoGo6hd5H5WStfU0DspXJbhx5v6as/9L5gKPMLGlh91o1H8EO/t1mTYq 43iyYYP8g4Rhn2nbs7PzvJ8alj1INfkEG9+WsB1wBN5f5Wsc7CY5eP7s2MiV6Lz6bsSc KzgeQI0g4ENLNDP08KYr7quXo4O1mKmnLHls65XSZsDjtoxdIUvVLfmyJICN80ryWKOE 6nKg== X-Gm-Message-State: AC+VfDwNvLx7yaSMhhaEL7nEo6ORfkKpgqs1vlsXVGNSTIScc4WnXQOB wZpbuHdYkHIrQ7psPfwK/5k= X-Google-Smtp-Source: ACHHUZ77IlfDYtyaiNtbQBvQ+hst+uMDswEhJokbRedTnkaskK+XBmCINjFgoTdvnk/TaS9G8YnT8Q== X-Received: by 2002:a81:6cc3:0:b0:56f:fcb0:26f6 with SMTP id h186-20020a816cc3000000b0056ffcb026f6mr25623334ywc.52.1687835730840; Mon, 26 Jun 2023 20:15:30 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:30 -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 v6 11/33] mm: Convert ptlock_free() to use ptdescs Date: Mon, 26 Jun 2023 20:14:09 -0700 Message-Id: <20230627031431.29653-12-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: zfonkrbhwd3zgzhs9zag6bonedur347e X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: BFA0D140005 X-HE-Tag: 1687835731-163839 X-HE-Meta: U2FsdGVkX1/I68Ic5N28KGdHLTaMTyFZQ4FzGb35a4dAK9vOvxJZ47UJF/VxpBUFgrixbdXGyF1LHbFNS2WpMLu4Z105iHxiMIHQkI/3KyeoHT/kKJLvifml6xQ3mhdqWwiTbqR7xYgpl9ks5j6g6jFeiaW6jXhud3NpOCB3sGhEsmAOU9la/IPJ6Bx9J/Ce8VZ6cq/4aTjwWJfLlH3li8MVopehrhcqegxIgbjeT2iVVrL6wpXdAPfnZrWU4mI9E+nZw+ArrOAR5/m9BXF1GRby7lDVR9qQS3XdvupJI0P+bEpO5w2dSg6SniJzFt27enBm8NrrrA9CHiwsNk2gSLQcqr79Br1ZAA9R1LQgD3KQnmceCQ/gMQXbQQsJL8XgumKiCxRJvOlSEbFHvn0SuWtkzq/YnPqyDYO3VFXFlg+hjiU8fY7g2I2vGdDgFmbzpT3BKR1LEBPlqMAj4DL66ALj2YgC1Db56wNbvS7cOHWB6fppyRAFsENoV6szml8z7YSlPxg2XhMcWuHf9rJVfgTHqNFY/IAthpxInCPtOePM0xmwGtfRrPIkzQa8Ud+8IVcw6L1PvNNqdkL5m5baHbKIFBcwnCZYXmHCTB4ATsMdF2z2hDabfAaGjFLCUvvxWY7mBnNgXQgvCbRjLWW0ML3XH1xZwi3p3JGxcaHkACh8/OAYqsWg5qqsgSyUbxWCnOHAQ6dV0NEb4Yhq2z3PidmSGH1UdVjp7c7zbqYElWcUntYvtgRH4DMO9hsQyBLOI5tpbCB8Xii5pvRk3r0gnlAxslTQ34E5Eau4sQftDnaNNlkBi6GME4Q3LtKhgVUBBLOo427ydZLfNnhoi9nLSVH6fY304CVmmHV4lLlsUwy6xyThXmMpsUp9W09pOq30sMww0S260v4ZiOgZbVrSwXVvka7OhhnvGPKR8dau7cZ6JHgwi+uBvZZJQ/eNsiJHNbwt5ikrWwi+8c0NnpC TC2a4h+W 4D6XxlTO6Q09PJyWhzF3jgIc0xxsXLzaORPxrjMEJSqhhEee4/ii16T5+zlXdFOnWVlQ2Tq64xAoFY+uI7yog+40Z0wM9M27c3m8ICspCC1pxA1iYdB/J6+HBdJpwKmG+G8zfR/fNtF2EEdvJRt65hr0qWf0sUwyBjdw0e4PaBoBlgWGTwG6uvJiSOFcddDYiIVR/NXO8FBjdDx1nnBA5yjqaG6kgIhoLqHOTPmUf8dx7MkexbryjMZ0izQWf9+BTCvDf81RMx8pG1B/wVKbJtOzqjme1BuaJqzYM7elDEVdf38fHrhM9deI2wHRI3ZIbVRz9Tyofkfi6yN4xGXl3YM6Rdu3SKlBma1Yn626oVo97DIZPVp/DxvBRNOXofqAFGWs3FcYPuw0fUJFaceZqird4+A43YcteeWxBUroSfnm+jj+0eLP3JxzXR0wfS+eCfH/uuymc1ytCuJEKZGt8fpFIi+vCQfEXgOUQmIdagE+WmgeFOjPp0vp/G8MroJusJfyd2/NHsHOkyvGttkcbriYBJRBYWUt0HtbJO465ivYHkMViJJX5B1/X7C5I5ElObh+Th2+Neni30hWsg5E4UZi/NLWqwwWUZwnUGvTJqZk5STJNXIK53C8Sl57OS0mXGx+VKwtY+AZ7mxM= 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 0221675e4dc5..69e6d6696c44 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2799,7 +2799,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) { @@ -2815,7 +2815,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) { } @@ -2856,7 +2856,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) @@ -2870,7 +2870,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); } @@ -2939,7 +2939,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 2ff14f50c7b3..8743aef6095b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5931,8 +5931,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 Jun 27 03:14:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293729 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 BBBABC04A94 for ; Tue, 27 Jun 2023 03:15:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37BBD8E0002; Mon, 26 Jun 2023 23:15:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2DED38D0008; Mon, 26 Jun 2023 23:15:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F13238E0002; Mon, 26 Jun 2023 23:15: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 D90BC8D0008 for ; Mon, 26 Jun 2023 23:15:36 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B0EB5A0877 for ; Tue, 27 Jun 2023 03:15:36 +0000 (UTC) X-FDA: 80947062672.14.14673E9 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) by imf30.hostedemail.com (Postfix) with ESMTP id E176280004 for ; Tue, 27 Jun 2023 03:15:33 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GTe2EUys; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835733; 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=RnNdr5PDFTKJu1h5zX1p1xVUKJvhUfKvVUh/w7ZbrdI=; b=T2+kty19NnC7Y+HHHRNgBuy9UfXxtzMcFwB3XVBXAsoqtS6ppER9hSvAV/g8v002W6ZzrM imjTDeMOg7755raTS6+7ogYp6HueXYddo0JWiR5qx1SSKyI8G6UfE5BMIBLCwMa1FpGvnp NIao+WrjS7/yKEtlzEwYdSk90YH5i7s= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835733; a=rsa-sha256; cv=none; b=8Kx3FXrH5VYSkK+x2apmipB7IUQytuZcD58AWeTzg7uZc3auEQvGmDGi5APnoeY7LCrwbE B+d3k8Y3xA4l+jUHYa2G7uD7lWzTUejRbIROPOhmRURMPmoHjvhmYQIOK+oFBBe/Zyuepv noqS/9XLXNnRE9+T4DfE+hRwbR4Ngr4= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GTe2EUys; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-5702415be17so30769927b3.2 for ; Mon, 26 Jun 2023 20:15:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835733; x=1690427733; 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=RnNdr5PDFTKJu1h5zX1p1xVUKJvhUfKvVUh/w7ZbrdI=; b=GTe2EUys5qOsmL9h+39HkmdbRnOOR/ecm3IZWO97nmipqYf9WxPQOFqim+diknH7FN cktZXimy2BTWcqn/5d10bb15uuq3PUdsia+9j36BiOqVzXj30Geeor6rYSL1Rhj9WqCn LmJ9N5OLeEYa/H4vUyKvc7Otfz8SqaPNrXVtQODdE9ilutCJ24KAZJChe9ZmvWB1bUx1 7bpUWrAZkpPXIiT5JcrWxhsn1qZ9K0WItSWhparWMs+/rm9Q3PdTkYO+KF0D1GfwN1hv 0eQBee2svyGNdGSpwEO15WqpXr0WlpHBW3JMLWAP0NGZGcgLzbwqXYAJu19e1eeZo9JE G7Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835733; x=1690427733; 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=RnNdr5PDFTKJu1h5zX1p1xVUKJvhUfKvVUh/w7ZbrdI=; b=KN9i3t7jOLlrqSYXfE53xQnSb9t024HSlP3XmRsL4aa7EVKr0BCicPUBfEZzABsvcN fsTqEO1N4uR6ymRKLmIBxoNj4CCvljtCzhb3kq3E5MstKvJ7qNziUu8d2IbeGuNI1481 tK0UK+rU4mf//uwCuLenqLEgF+mAYihK3ZgSe3xXx8aujFKxMZxEAZPMzms6hJnZQg5L usY75VDaeZ8kQQvUPV8HAFsOynEu4CR7CKlsc39EcnnWy1Xgwzk8DzCEcPU+JLESPIL5 skbLv51vqmX1bDGVLYvygjV4OTO1f2Y92CvsDvfz5cblzqAbos7napDBms1O+E5Hsdj4 QR/A== X-Gm-Message-State: AC+VfDzcublZsoE7Ldkl2UhX+6c9Ao0XmLkpIsjIlLs0BmUgMW1u949p ibSAYUV4cc12RKsSL9rja1o= X-Google-Smtp-Source: ACHHUZ42Y/0xAZG9OHSM8VrbwgLQ6VZ3weOziZPodRcVkI1essgSTHJwJyadoUyqzcMtcD2kr7P2zg== X-Received: by 2002:a0d:e005:0:b0:573:4d89:ecb5 with SMTP id j5-20020a0de005000000b005734d89ecb5mr19780303ywe.39.1687835732948; Mon, 26 Jun 2023 20:15:32 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:32 -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 v6 12/33] mm: Create ptdesc equivalents for pgtable_{pte,pmd}_page_{ctor,dtor} Date: Mon, 26 Jun 2023 20:14:10 -0700 Message-Id: <20230627031431.29653-13-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: E176280004 X-Rspam-User: X-Stat-Signature: 6mh8w9odsr7k9tdn3at13h6t6nc4ziz3 X-Rspamd-Server: rspam03 X-HE-Tag: 1687835733-285870 X-HE-Meta: U2FsdGVkX19OFZhx929N42+xTrJ9GX+NvghnoSWdrRBgz0MKzE2qjkxYrq3mW9ch4HkYFFxeHNe4DdOxidToYH987t+Yu01gxwgsQ3ZdMjC4R0x6M+5bUm5cXiW/qQESL1+1vh16OfTgEOc2Z1s94E/m5+7Pwjbk/JLT4/rvD/r9+W9fDt+amgIphTd02nxZe+3ELj6rJmJvF2HEe3en5FLHElv54GU2sz81KRvaajwzMnNh5HBezfxVUrrhnMPOA39oA+03YQ9vV24ZsnzrfXzBtA1bAAQKcHXNWnGGXJSigPXniFJRb2CPXps2XxiadETlANxLu7mxldMIVl8lq2Ks1nIFyvjLusDGpnumfnbdts9o5cZkQpd8nFE0m4SiPs45s+sa9OAjK++YyvfT0XrehOtZ2vjO5AxKDs26OvcAIgHSEJjHPMyfFxWdl2N5we6QxujEenohzoxa3dbtB6oQrFWZuR0DzTdfJCXYq5yGY4niF7F6AuMSWF8jMXN5R4ns2wI4luyDPM/pD/uiEvklDCQjNLsgWRVHvTyUHlf8HehZlREA/PEiH4vFGaqs5++BIh+2QFY2zSFG3LqgB0617y8/owwqGCzg/sMN66gdK2ctImfupNWgYoyjn+5/Z8bt01SurOsKVhDeTXp0EG+lt/ikHVxKn5q5LLKgZJRNGZhR3/krjwClA+94G6p8LHWH+lR5AoLSTeANYBDFI5rM6fL4jpOngkvoPCyOeiAMTzOD7354GQv3ptIdvpywmwjg/nU25KVE6SdfiAjqp+vZrReU5y5hVPhegT48qrkOW1bcLtoT1Fn9UhiQzJcBy8xyMF3k0eTkCNBNzaxfCQi4nUpzNXK2EK47vk9GqavvlROr2cunh/ijWAThXVryZWQ1QVlRBQeuYBL2GBItPszOhoIwMuoLnJweMUGTbOEx0YMphYsC5uNo1ryQsxuT9gFM7TnkhPqP9kZ2lxE 9hh/DyUg FgIR9YEdmVSEo5e0F5l003WS347oXAsHmGcv6OkiHujmp7RNFuVFz3aejek02zoGysSsKJhR235cmU/MTR5vZyimNEEVFdLoZHFVzzuFvrkhLH9UYatbTwAX8Zzhh92dX+s/A89+WIl7A2nwS0zFH6/ul9Q+OIFuwNluJb6EAVzp9rKKcqTZMv5cNYG0aWTyqvmwZi6p1HkfGckuwSsANV/vdkv+HfoRzx483LQRAqf5HKjr94iyF4Hc6JvNMCgWPP81tI3u88mdJcYFDYjBxUDrseljgAg1Jm6WNJYGV+pJxKxSv9yP1zEt8F1LMJsBeDCeXu7z0CKOYfYwbfyBroOOKB6Rpe6Omr4SIkZnJ/gIcNVz7ahufTf/XCgDPyRlmUyCyW2RzCI3bYH/hgUeatkYboeGHIrmoO6osIBdgIHY5DSCNI2LbiV73wp8mNEraHugfLRKj7d9P+nofqxLCWnRpTwTSwcFm9tQC4WNUB7qJEGGZD2fX5+MjZ0hGSEQN2j8bghLzXRQwyqQaaaso/NRSU/ytu0IcYai07IVBeCmb1ptgZrBp3O+MpgGGwetxGN+3+p6vYpKffPhXQQUqmAz9OcGDZqO5lHzg3GgGRCJyIJs24LgZZtIOho27Ip72JFYUnuDKorL6n8M= 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 69e6d6696c44..356e79984cf9 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2859,20 +2859,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); @@ -2965,20 +2979,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 Jun 27 03:14:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293730 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 02CBCC19F4F for ; Tue, 27 Jun 2023 03:15:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 502B18D0008; Mon, 26 Jun 2023 23:15:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 491E78E0007; Mon, 26 Jun 2023 23:15:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28FB98D000A; Mon, 26 Jun 2023 23:15:38 -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 076AA8D0008 for ; Mon, 26 Jun 2023 23:15:38 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E19D71206AB for ; Tue, 27 Jun 2023 03:15:37 +0000 (UTC) X-FDA: 80947062714.30.EFC1707 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) by imf15.hostedemail.com (Postfix) with ESMTP id 03A7DA000C for ; Tue, 27 Jun 2023 03:15:35 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dat1wDV0; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835736; 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=JO1uHT8He+Av5NkiVAKHRKBK8X3I83QFDr1CeWVeYZ4=; b=NUe1zhbylNLG1Yix1BdisPmI1JnQw29i5N+GeWctPf8bQwcsQbYlrCGEYYy7XfNKU55Sal NbuNs8+a5pX/stBg3sSXZLfBjfNc7dkdOORv7sjNoqPjHCy7aAmpuaSIGkBVT1SZPlGIut 7TDZrftYG5zeegtH3b/0AeyjieiO55g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835736; a=rsa-sha256; cv=none; b=zbx3+Tf0mQWVKzz6wsCZG3+NgoMGiGaSxFVlQFGK1c2UqEQrBLO+X62LcvcniKitB4Uhsr G7GphUdnmB3dG9G5gSAaVOxSM2Bxyj4w3WZvRsNThtzGJZFpOZYTE9UGYonHFeLpFaWPy/ RXltOxfPUIOYsNuTvUrmheOD6TkxEKI= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dat1wDV0; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-573491c4deeso42151347b3.0 for ; Mon, 26 Jun 2023 20:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835735; x=1690427735; 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=JO1uHT8He+Av5NkiVAKHRKBK8X3I83QFDr1CeWVeYZ4=; b=dat1wDV0hFLhWxYH0r8ddz1H8BGcTEWHVyi5Rs5rk43A9IksDrk+3mqoUiUkRQ1bdc PR81Ap1TsQpZ2VWOAqt25hxf/tbd3WLQzV54B0l4aeb76JcfUJ+wAECtozZ2I0UZuoRC uh/oOwQmqyqFuyDBqIX7eJx8OEjtqbDmrxv7FxX1ASzR4qd3FXDZ91LjXYV0TyzIprFw kPqkd4c0XzfvJ4/7zzjtkJRieqZM2Ms5EHtEVe+Q06Qv77iK8p1yxt5xwpUsINGiVcuX C3CUZrMaWADT5iPU+9qU+7PbI5xUFKj2+rJ+T40oMZKgcYMP/C+Ckh8hFjolQrjk+muF NBQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835735; x=1690427735; 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=JO1uHT8He+Av5NkiVAKHRKBK8X3I83QFDr1CeWVeYZ4=; b=E9Q5ED1R8ml20qrhvu0mvqvAnIlPusp8hC+ocbs9h4walPMeL6IXDxFrKEqmzrt0Vn 2rddKx8E4ZBamT76P2ncoNV261cqAi4lg3rlpHDnVa1x5qlk2OKXaKkwcogA8WRDszw6 UyLCXpaUeU4Xb3K2aeMQgAUEAq8gUf3NL0aGR2Gk3Wa27GD7nfp9xWv15/qMlcWV25wT zk2EnJrV+JEvDIhyfDvBsdl87tiN8EsSPC+M9qZ7IaYXzMUYBNqxIY6X6dNuvJVtvjz6 0lbt12Gxou7HmNiOvBjmqdlOpQcRi5g1NXyk9yh+StuqOdozUJe2xW5AClSmJwTKS7F+ 7/hQ== X-Gm-Message-State: AC+VfDwpJ8mbUBZprxoOD3P7hDXe0hzf/se9XBd+kQN/uIuS1yxl628U 2qO4q7HItAGBb/J1MI6VQFw= X-Google-Smtp-Source: ACHHUZ6zABvTWGv3CxHnfopD7sHdOjFX2mae0AdIm6lQEgrZTtH2zvRSehpouTlujo5zm4bK/E+peg== X-Received: by 2002:a0d:f306:0:b0:56d:2b76:1d2 with SMTP id c6-20020a0df306000000b0056d2b7601d2mr29033748ywf.10.1687835735078; Mon, 26 Jun 2023 20:15:35 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:34 -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 v6 13/33] powerpc: Convert various functions to use ptdescs Date: Mon, 26 Jun 2023 20:14:11 -0700 Message-Id: <20230627031431.29653-14-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 03A7DA000C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: hqsz166r7pzg1m8udhp9y7j7fhh4wfn3 X-HE-Tag: 1687835735-865339 X-HE-Meta: U2FsdGVkX182GGBI1LS0g46SqofOYCwKQWkA5ujs5CkVxJ6vhgqFRM0yW0tned7HlNlZ4Fj9yEO8EkYME3BOl5vPthztDkPox0nvUXfOJH1CeWYctzoOfPA6Esj39bTznhkeF6yYV3tGvR/PB1Xn18U8lprCFAMNL9OLBbfkUUAq8CboZJ7Py016Gejyicc1UgYEZOXK/y2Y2rofaKw1bORIcgnxRmTVRUxYTuM2kAW+XAJ3L66VOIz3nSsJYkWM3BzsHO1IoKkj7tSVYdNOAvthG94IlOaECAVdaT5jNjuIQrPwZ8ll3aKExgEWyyiyF952NmldOHMGWzC01OapSKw4NNcgJtQc3OLchQVLLFJ4YTp9nPLCyhU3AB5MCUBKHR+os4yYcSt4d3cpaoKgXBIuyla8FsMjC2Oibn6EZciOzBTwhw8TkUEWn6DQGpuoXDzlQdHpiZKxkUN35YEDE1bak9R3YuXKwdXI8ELVJfGncmwq80j2rN5wcYlKDnv9D8raKS4u48symjIghpOed4YXAWcvzj7bBwSy1fZXhioK/TANX/q9+HgOLLXIYstwH4LWCww22T+ZGNm5Dfw9z5DmCBzFdMqvAH7edDeX6T0mF/QHvxVfMeoKU1drz46kw3BA7T0cKFjmxV2xmeMIkgJdMY5JAejtmjNxrxSJTe1YzhlWKsvmTqRC0disOCctE7KcrZguzC1OYHXL0SVh0qFwOeWAUVQQMJs2duet+WCVwSMxS244Dso08NAmS5q5TJe8AUfluipmToOdQ9dSHIEHlG9mOyPNNABZHCWh2OVRx45tW7b7YJSxm2frM0HH5Cw6jo3CPVVj5SbYKwCBp3LzzsJhFp5Z3uJx/D1fA367U5ltjUnPgzeJwJwvE4oN0AFPusqck1k6QAcuKx/yVZ8G2kxr7a2vvqo0N8oHgXnDv1nVYiV249kdokq1H2prR+ngU7j+rc9tyPoBDUg KZG4mK4v TT+EOS3UvD7S02SmcIaY2b9EUD6h8dA5ypvb/CkeXXyoJi67KUu/+/7MCw8K/9EpjDnSCZgbwWyf4MBdTdeVWVomdKuvNS6lvCoHPSikaq4VDrF1M3YZWDwtYEc5jl4y1NzjOkn9gf7jrZk5nFxfLrRs9pEiQ34lbOAS6S97hWtEAVyftiL8IFqu7i4YwpjNriJ/YTFqup/RCzuKfqNVt8OFR5HKEhPB00kw0wEwD/l3n2syxpG/ZPK3rMVRdeoTHt/B8WK+5eeSsnE7AUVpU6zTguzGjcu6ymUqI9WS9eEy3Xo4OzTQNBQq+EQUAAp8+c58rvYdq4Tqx9N0/mU/R2FujWVXSZyCIccTu+W7wWXV4M1VREebcW3/2L+GMiM7i2NYhFuboEmqPjmxJ7bCgd38unHoOYx++bwLlYrZERl856MPFqXkOcoNH1BPonlzaHEpHgLMUHMsC/RG9K0tpa0QQ2YSGG3FwGcaQsXw67/1JAZKYZe1D67gPNmfGmiT16ZAIWYjxeF/ZRhPwUXS6OrehMhqcSKKYTVZg1c/jLrTr54ma5ig3/SwoSijX4Afb8yhAKFVsNkr93M/rtx2NfG4ZvOFiJ1jzqmAO5L3/lAWcuQtl7gv51uajLh4TnNL5zUSVtVsu7pB1Ixc7TvVeDcMWzd6TRv3Bk85r 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 | 46 +++++++++++++------------- 3 files changed, 44 insertions(+), 44 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 20652daa1d7e..8961f1540209 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,15 +108,15 @@ pte_t *pte_fragment_alloc(struct mm_struct *mm, int kernel) 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)) { + BUG_ON(atomic_read(&ptdesc->pt_frag_refcount) <= 0); + if (atomic_dec_and_test(&ptdesc->pt_frag_refcount)) { if (!kernel) - pgtable_pte_page_dtor(page); - __free_page(page); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } } From patchwork Tue Jun 27 03:14:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293731 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 6CB22C001E0 for ; Tue, 27 Jun 2023 03:15:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DD418E0008; Mon, 26 Jun 2023 23:15:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F10C8E0007; Mon, 26 Jun 2023 23:15:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F5138E0008; Mon, 26 Jun 2023 23:15:40 -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 07F408E0007 for ; Mon, 26 Jun 2023 23:15:40 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D0098140890 for ; Tue, 27 Jun 2023 03:15:39 +0000 (UTC) X-FDA: 80947062798.24.839BFAD Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) by imf17.hostedemail.com (Postfix) with ESMTP id 0383C40010 for ; Tue, 27 Jun 2023 03:15:37 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=QrI1aOGw; spf=pass (imf17.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.179 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=1687835738; 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=hzV0IJE/TV8EY3HWGb6xX1d6ezHlCP4b9XYzz5/4U3Xw6BKtzEDIIxNs6bha/e7nSD1XXr Ob85hmVs49+7VkJS4QOVnm6pDoiHveTy+sTBEHFYSxpOpYVy7JaK/yrxaliWxNN+dhbBXA wgXJOmXVgsvhXDhS+JBnWwDJO6H/hhY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835738; a=rsa-sha256; cv=none; b=f8mOFx7xDPbfapDGKCT3aH80mpAhor0pdk60ysliRcDwpXqpgJ3HfxxW0vR1oJ4og6OeZL iCi024BF+MjBbwSImn6kxtN4B2o6MR/MSrYay4xngzL+buKH2sF0HhTzBl7qCkPzvzcfRw XsQUL57bYzITocz1Lf9dXe4vwoY35fs= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=QrI1aOGw; spf=pass (imf17.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-570877f7838so42433577b3.0 for ; Mon, 26 Jun 2023 20:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835737; x=1690427737; 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=QrI1aOGwmRyx1aG/1jUWgOOlctjtzMuSnwhAF489vBWlZq/T3WvrQqLmr1ZsHa3z9f KMuR8bUnQVshf/a2XJDnp4tBiTRfYlQJkd76z10JNyfa2AKxYm8pQZSInnTFwDV0P9Qn 6Ey5MjY+vGUMOaBE0CtREaS5w9oSlx1P3EZIsa6ss9NVkfJ+VRZ8LRFwypU6kVxWJIuF J8TvqLduMYlxzEPQNlBqIgKNLnzpQj5acaQr/A3KnaUPK86vURXRnYY+Ty7Rf6Hk2iF8 qfuryvFc/G562SwsCPua2Ciim8h2kDAtybagPQ8pIMgfSUCuDCG9cQelahJlIzPK0uv7 jK8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835737; x=1690427737; 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=ALMLMVeI3k0R/Wl9/G3whk+EM3vmUCuMaTlbwhEXgQPKwgKs+zOfMI23+Jm6VrWCuN RB22lZC4zarnFq9r+j7JsH9Z+pCYPldeK0fIVbmEvYLVkL+3fPSV7Gg+ks1LnbZMHi2x gFuJeVXAOC77Jklpwv1BvGtKWGT5GRqrV/BXKUF7e4Mezhj/VLjN91CS1Cp8cy5Scd/w ERCa1G1Ef28UUPX16ebvP2XTdrhzk3bxoNm/j5p3ZAwIbuO7S7KUhv5xgM3WQrMhhcsr tsLWYoLCP1h95xotwH+zI7qUMArT3mEXIzEwW0UVO+ZugrjIfx3HSWM4PvBwAhc9DXHw K6bQ== X-Gm-Message-State: AC+VfDz8uKxQBLxVHCjw3nv54ONV5XWeZbBUCm2zMIiMIRx+snDnvqST ZHpkCV7pgPSgot+SWku2or0= X-Google-Smtp-Source: ACHHUZ4JE7nBItej+vq0Vl4Eri4cTOSZA2h3Tcd4FX2deMd/F+CeONudm5Ey9sNjlWrn9sHNr8vp1Q== X-Received: by 2002:a0d:c001:0:b0:570:6d74:21d5 with SMTP id b1-20020a0dc001000000b005706d7421d5mr30801318ywd.13.1687835737124; Mon, 26 Jun 2023 20:15:37 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:36 -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 v6 14/33] x86: Convert various functions to use ptdescs Date: Mon, 26 Jun 2023 20:14:12 -0700 Message-Id: <20230627031431.29653-15-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 0383C40010 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: nh8s1amuejaczcfu1nxg41k75mrtb839 X-HE-Tag: 1687835737-96061 X-HE-Meta: U2FsdGVkX1+9qWb6gMD6/WrH1p5YFMLIzztlUg2LjebYfXLi5e6fb/5d0sVSF8MlMcnlz9aQsOepD/vOyyNp8L7RLghHdC/sIr+amqbnM2ciKUJ8O69bXH71ltX+prqqbbMVbM9uDV3rHi9PjxJAbD6ASWAGLuo/3UqQfYrYqDrfn7Ag4o1x6kRbce4LOo9pgUm+xgZhPZspDNkLnbNC480EJrncE0kUryQ8Py1oxdTetfGTr+aoTcU+scIF8udJyGC427gz68m3Gt8JI3c0tW69Y9XMZBIgeAMty0SxY32izISgK+9BAJ7zRzUhrxkTOYygXOVA6+Ysd0+b2NabuiyBTOmEcHu8TDEyGbS0XGwCA3+kATd6vr9OR9//P247xnZjxJC+B7HZVmiN3N3XRE2hpMt6KyH/SbgeayccTwPu20Pdo7deIQiD3AGRrct/wt1Qb372as1HbDtJsCp4dF4+a/LcA8c2VJXdYrpQLAKjFvUIsOHZjfi3JHB5FBTS97bA4e4R/ZimRMkH0EKKW4ETHpXtCRHIUalNW0bY0HFP35R2VwqFuREwl2rDyUJHg0DBcHqosaccZkDS1dS1wUhz+swT54Jx+y7eWgnjpGCYwrY5LszfLXegaz4IPbRaBRxr86B03AX2YcvnIbxXQ8YJOZqJ5l+xmyp/vz6oMtteIMnwjf+3q4IjNZS7egcaKFM1UeRucSot+7yunLKi4gZ3IWsKL2v7uw7c+lf7TdQJ2HQSCRnb2nKPBZoezIkbZl06g0ymNnukrLSBgtj2b3MVi+Yeim8g4U/Jq8Oj55I09eSUiPJpv1H4WzhffK6y37Lno9CUhlI0ZguqYiaQ2JAg2Qe/2eXK4daypu2pLhF3UdmdCMqqkD6mVdJDsD0QRPkg679DpKloOTxfrULJOWh6589eGX9QkIQRaUHWpZPQOcfcL5t7LYQL8+A2nAQzKKmYkAux3ioE+lNXgDG o1bZt6rU YzGqgGrOyti6xQ7622EcibfzQdmDw5U/5NzIlLK32m0TEJt3DFBFRqMLg8a04Nm11AlaWWrvGMGR4ciBjQzs68bHkEZDCK3WLd/UueR8Ok7ms/jsnxErDWcbmnK3Vg7DbwwplR1Oljw4bvbPr//C7zexbM/NmL0KRgIJOSVPoOaHIkyjLXUK2pv4n3nbflf3ItUxCmERFBsBq2ScV0Ntq7n5m9tZU70fKLkd3ACF4qppUx2xXDycycUMxMh62oHJv8Ghfye6TYOvrKio94bWzQR5FHGF53eGikjgoqycOdZuhMLV2l1MgybE8BkWaTSaBGWIl5rCt3mANFsClaG0Ya2Q4KTFxnc4KRyYeoa/NU2xTyouKDI+OoTCEhikrIBRHebfws5vFDf7KnIZC4yzbjoR7lsPELY3udPVK6tMVdLvPytGuwCcrK2txMEpo4K2pZMT4YZLiiNSD3qBslkL0auH5Oz8u9+8kytLa+hgW6f+QcwmAHvIFwKxL/gEuCaqMtlvBlmZsQWuacghIV2O6oGjOPlY+DJtgdAhBvgOqKspUJgMtQGVOK7/OciwSXZ2vBxFcYUk3vVbkCxpQlrKfgn/RQVfezb4q71C+ 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 Jun 27 03:14:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293732 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 B4F2CC001B3 for ; Tue, 27 Jun 2023 03:15:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A119F8E0009; Mon, 26 Jun 2023 23:15:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 922E78E0007; Mon, 26 Jun 2023 23:15:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 614578E0009; Mon, 26 Jun 2023 23:15:42 -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 483668E0007 for ; Mon, 26 Jun 2023 23:15:42 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 20D001204B0 for ; Tue, 27 Jun 2023 03:15:42 +0000 (UTC) X-FDA: 80947062924.09.FB7CFE1 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by imf01.hostedemail.com (Postfix) with ESMTP id 548DA40006 for ; Tue, 27 Jun 2023 03:15:40 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=C9lK0LHu; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835740; 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=xnT0OuFQgSMPBMpNBMcjRtrAID2j2J/z+99kPRjsdFc=; b=smUVALdsIaVroZgicn5bNYM3vUW9IroIX3+rjBOab6NGIjCaVsFTW9VqqKGEBoAf9YhTDA ghgtHpsqkINaIwYRB6ZCZMJIGL2BKo969g7zZOfTW+rK+yuCJuXHMpw8UJ2c3DuqSoEABm 71yZmgbfgV0Z0qlTvyRHRfVlIdUgc0Q= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=C9lK0LHu; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835740; a=rsa-sha256; cv=none; b=1xJ6t7NLbOyi2gtrHD8mwWddTfhcczPZmiutzFwai2vnrqh6ZPQJW90SX7JD7bJwXu9+Ae e8nVcbIOqIbW86jdSraxTmETLZlr7xeDf2VAsbUuoWLuXfO4NcXn5wZJxT5boo/ue3bXSK EgNwCamDQaLch7KyC7qfT20SLoeVruU= Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-5768a7e3adbso46469467b3.0 for ; Mon, 26 Jun 2023 20:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835739; x=1690427739; 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=xnT0OuFQgSMPBMpNBMcjRtrAID2j2J/z+99kPRjsdFc=; b=C9lK0LHuN5lKypvu+Aj6aeuTYWXXF635p2/pwdffwMnvgLPQ5DfNtjJwGjF0xWaGtG k4CBfAborCW+hCWMhZ2oUELsTotpY/LgKDoPzYRghFuc0ywrV2kgKg/Bf03R4RrxER14 8aFizXA8XvmvkijHxeK5b0ar2PYZmVlLjrBJOqZ59csukgFcxnmc3Xf5i7RxtGtOgHDV jxfjAgQfXU+ZB0gWRP2dwNno3Yad8q9D+y808smsM+9/wszItlWIKVHjO8VqsouceqTf m31MSyOhX7e2LHwarw7nCVK/K8Mtdnr1+ICaXDV8yqHnDrMeoBLMORe+kyEQDKvPPqv1 8mBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835739; x=1690427739; 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=xnT0OuFQgSMPBMpNBMcjRtrAID2j2J/z+99kPRjsdFc=; b=TI+lUhDVGpJOP1ywpC/Y5+gal4KHCVpfsuUNce5TAh8gLEpgEMQfEP8INSdFAooM/a 2ntNWPbcAGqocAt5UZF8CWUPQK/ZEzPG5X93AkYb6x25I05PtB4ZdRGX4aitCufPj8pW g3ZJEqeJXUfPfxS2lhxmgNDPPy+Rxcn3Dk6nsB60bfP+byVgh6wFJ4QFbgA27RhCWNm0 gICujYi37Iweh0dFDpcflrsf+otyWIh5F3Y3ds2xAqQNU0rSScrRcu+KuJCXFwQzrpxR Dvn0bYDxoeDDTTHoGXWjQgvfI6MJGXXbYp1ftouKw1HofuMLPBvQHzm41Dv08px+AnOJ 5D0A== X-Gm-Message-State: AC+VfDy9s4ZXaWTLxj/giez9f4bFzCRxiBigQVPAnnswrf0W6PFCwJDI 5MsrDQx5wvfYtHXlOGq+f0E= X-Google-Smtp-Source: ACHHUZ4s0sSEGcPfreheHOmEbwOCo2wccO0ZlMx4KueotfvtG5g+MVgAzB4cpcvHGs8z0aON7ghJ0A== X-Received: by 2002:a81:a191:0:b0:56d:50a:c0bb with SMTP id y139-20020a81a191000000b0056d050ac0bbmr37686199ywg.25.1687835739285; Mon, 26 Jun 2023 20:15:39 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:38 -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 v6 15/33] s390: Convert various gmap functions to use ptdescs Date: Mon, 26 Jun 2023 20:14:13 -0700 Message-Id: <20230627031431.29653-16-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 548DA40006 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: w75gos7ke3wh8gemsqdf8iymf36rnjmm X-HE-Tag: 1687835740-557350 X-HE-Meta: U2FsdGVkX18tL7mfXfXFKLFCoJIrXsosf0plxnHoeRqMzOmY63ATx3SXy2dJnavS0/JrWUWaOnyrt3VnZO9wJT8Avt1kDEZalQAWx0l18X4PNRnBzXbi58zKUQkw712LCJPqFfU9n1fun5TUZSGGQqlqWztrVz5576X5r5X/kfrhQC/bdzIR5PflAYJSTEv+XSwNalXTPShbr20VMWAlo2hSsc2KSsqHnX+vDkluhjwEuAb7H8SM2igT7HNww0bzzfY5ubB5Wqh+ggOPs6dBUjvHbjZwJnISlIqMI2nDo9CklaiPxrlYRB/hQzJ2oho56J6M4nJ1n429YSw8dfHmLOVNz+vlPDAMam7s9QzrkAQwv24qNOUoymAgV7XlvDq+1bHNV196OcpSVnwoRO9bS+rENPUTgjA1U39HSMpZ5aD6u2SECQHJHo/JdXSFgX3OVWkSAwQeKzYJMWFVxc3FYmEIWWmXZTQlG/XAj+hvlJ1VUmccl/nrEFSSvjhXFQTpWwZc0PYx4phAyf12pjMYClmGDUWl7fHAN7oNtAla/e0aroV4mhHUATYIkicGDhYOrtmynoxcyh9dlkPJXgAit7H1jqHuBKHjcBJe3s9Uqc1Gjhf4z4loIItahk0e/prO/XOEf3L6lZGAXTGfrOwf2IdZPM8ATzeM4C9D3O1Q+eUkNuXd/n4IcVN8YfwCjaIdkJuOu4qVF1mkNJHiFGsIopzt8X+iw7ygyHPeCofnLfyRwGyNg2zcSUZ7f9qqUwv0xVtphlQ8Po4Kj8h3nuUYO1IBkFhQIe5sCFz7WIMElpwnQnnwxG033WF9Eui7Eux94OmMCBVHBSEMECLgPuNU1BubIpRc9pmcKq1KTW8TapKtEE+PWy1B2Ya/6ZNvpo1ytO5dvn3fGjxfzM5oDOsF8G8ZhgepORSqXWS5QDC0Oibl22yiY+EzTmcEsjmk1vZqH1JkLb+a3aoBle6YE0L m14NQ+ln RMxJcUCFwoJacUMD7d2f8TsSRwiEJweSoCFiz3ZSbVDhv1Cca41UX1AHihWq+a+ry78EKzqb9T3vFxYh9ozjs5wcpnGKa4Fv1wR96Zpp8w4vl6aUuQlY7LZfNUmQdaL/wwNdg4Fgj75dpg42ePZeqJva3kEJkK8t6dZM5XxNRm47VQy1wHTnAK+cxrAMH2tueeprZmwBpxLjRy7WCYOCwlJlsfhDebuYaLc98YzjKGd3YONE7smDAmpdtk6MVLSJkq/fPCjmW46SUN6E1NNp1z2uVGyACsEzwhBfKfUjN9MlpXyEcSANx0e5Le6TbZ3c7brUPgbiGmibc7gGWXGxNC9xRYWAH2ezW6qT7Ip8Bi3GBB/CRS/yjgT3lS2a7Ss0lpnD4mJxMAa6QZCfGi6BSt68xhaBwFkq4HLnzls4OfE20cWMpKYQYudvjrMOoukCnu8rS65ZH1dVx6q15xnKO5m++8iEWyK47aJQrAGyvjmhgD2SU0AROyONXGmVLVwDxmyaSan6CGEQQhQoYFvgMPjFC5YktfTcV2PMqQZegkeBSPb6aNZlVSdXDnSSUUfdHy7zpvu/6o/8K0LwmtCx4r/+nM9izU3NWkkPUK52RWjbjFS85geepBjB5+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: 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. Since we're now using pagetable_free(), set _pt_s390_gaddr (which aliases with page->mapping) to NULL in that function instead. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/s390/mm/gmap.c | 217 +++++++++++++++++++++++--------------------- include/linux/mm.h | 3 + 2 files changed, 117 insertions(+), 103 deletions(-) diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index beb4804d9ca8..8dbe0fdc0e44 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -34,7 +34,7 @@ static struct gmap *gmap_alloc(unsigned long limit) { struct gmap *gmap; - struct page *page; + struct ptdesc *ptdesc; unsigned long *table; unsigned long etype, atype; @@ -67,12 +67,12 @@ static struct gmap *gmap_alloc(unsigned long limit) spin_lock_init(&gmap->guest_table_lock); spin_lock_init(&gmap->shadow_lock); refcount_set(&gmap->ref_count, 1); - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = pagetable_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) goto out_free; - page->_pt_s390_gaddr = 0; - list_add(&page->lru, &gmap->crst_list); - table = page_to_virt(page); + ptdesc->_pt_s390_gaddr = 0; + list_add(&ptdesc->pt_list, &gmap->crst_list); + table = ptdesc_to_virt(ptdesc); crst_table_init(table, etype); gmap->table = table; gmap->asce = atype | _ASCE_TABLE_LENGTH | @@ -181,25 +181,23 @@ static void gmap_rmap_radix_tree_free(struct radix_tree_root *root) */ static void gmap_free(struct gmap *gmap) { - struct page *page, *next; + struct ptdesc *ptdesc, *next; /* Flush tlb of all gmaps (if not already done for shadows) */ if (!(gmap_is_shadow(gmap) && gmap->removed)) gmap_flush_tlb(gmap); /* Free all segment & region tables. */ - list_for_each_entry_safe(page, next, &gmap->crst_list, lru) { - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + list_for_each_entry_safe(ptdesc, next, &gmap->crst_list, pt_list) { + pagetable_free(ptdesc); } gmap_radix_tree_free(&gmap->guest_to_host); gmap_radix_tree_free(&gmap->host_to_guest); /* Free additional data for a shadow gmap */ if (gmap_is_shadow(gmap)) { - /* Free all page tables. */ - list_for_each_entry_safe(page, next, &gmap->pt_list, lru) { - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + /* Free all ptdesc tables. */ + list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list) { + page_table_free_pgste(ptdesc_page(ptdesc)); } gmap_rmap_radix_tree_free(&gmap->host_to_rmap); /* Release reference to the parent */ @@ -308,28 +306,27 @@ EXPORT_SYMBOL_GPL(gmap_get_enabled); static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, unsigned long init, unsigned long gaddr) { - struct page *page; + struct ptdesc *ptdesc; unsigned long *new; /* since we dont free the gmap table until gmap_free we can unlock */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = pagetable_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - new = page_to_virt(page); + new = ptdesc_to_virt(ptdesc); crst_table_init(new, init); spin_lock(&gmap->guest_table_lock); if (*table & _REGION_ENTRY_INVALID) { - list_add(&page->lru, &gmap->crst_list); + list_add(&ptdesc->pt_list, &gmap->crst_list); *table = __pa(new) | _REGION_ENTRY_LENGTH | (*table & _REGION_ENTRY_TYPE_MASK); - page->_pt_s390_gaddr = gaddr; - page = NULL; + ptdesc->_pt_s390_gaddr = gaddr; + ptdesc = NULL; } spin_unlock(&gmap->guest_table_lock); - if (page) { - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); - } + if (ptdesc) + pagetable_free(ptdesc); + return 0; } @@ -341,15 +338,15 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, */ static unsigned long __gmap_segment_gaddr(unsigned long *entry) { - struct page *page; + struct ptdesc *ptdesc; unsigned long offset, mask; offset = (unsigned long) entry / sizeof(unsigned long); offset = (offset & (PTRS_PER_PMD - 1)) * PMD_SIZE; mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1); - page = virt_to_page((void *)((unsigned long) entry & mask)); + ptdesc = virt_to_ptdesc((void *)((unsigned long) entry & mask)); - return page->_pt_s390_gaddr + offset; + return ptdesc->_pt_s390_gaddr + offset; } /** @@ -1345,6 +1342,7 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) unsigned long *ste; phys_addr_t sto, pgt; struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); ste = gmap_table_walk(sg, raddr, 1); /* get segment pointer */ @@ -1358,9 +1356,10 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) __gmap_unshadow_pgt(sg, raddr, __va(pgt)); /* Free page table */ page = phys_to_page(pgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + page_table_free_pgste(ptdesc_page(ptdesc)); } /** @@ -1374,9 +1373,10 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) static void __gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr, unsigned long *sgt) { - struct page *page; phys_addr_t pgt; int i; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); for (i = 0; i < _CRST_ENTRIES; i++, raddr += _SEGMENT_SIZE) { @@ -1387,9 +1387,10 @@ static void __gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr, __gmap_unshadow_pgt(sg, raddr, __va(pgt)); /* Free page table */ page = phys_to_page(pgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + page_table_free_pgste(ptdesc_page(ptdesc)); } } @@ -1405,6 +1406,7 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) unsigned long r3o, *r3e; phys_addr_t sgt; struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); r3e = gmap_table_walk(sg, raddr, 2); /* get region-3 pointer */ @@ -1418,9 +1420,10 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) __gmap_unshadow_sgt(sg, raddr, __va(sgt)); /* Free segment table */ page = phys_to_page(sgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + pagetable_free(ptdesc); } /** @@ -1434,9 +1437,10 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) static void __gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr, unsigned long *r3t) { - struct page *page; phys_addr_t sgt; int i; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); for (i = 0; i < _CRST_ENTRIES; i++, raddr += _REGION3_SIZE) { @@ -1447,9 +1451,10 @@ static void __gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr, __gmap_unshadow_sgt(sg, raddr, __va(sgt)); /* Free segment table */ page = phys_to_page(sgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + pagetable_free(ptdesc); } } @@ -1465,6 +1470,7 @@ static void gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr) unsigned long r2o, *r2e; phys_addr_t r3t; struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); r2e = gmap_table_walk(sg, raddr, 3); /* get region-2 pointer */ @@ -1478,9 +1484,10 @@ static void gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr) __gmap_unshadow_r3t(sg, raddr, __va(r3t)); /* Free region 3 table */ page = phys_to_page(r3t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + pagetable_free(ptdesc); } /** @@ -1495,8 +1502,9 @@ static void __gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr, unsigned long *r2t) { phys_addr_t r3t; - struct page *page; int i; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); for (i = 0; i < _CRST_ENTRIES; i++, raddr += _REGION2_SIZE) { @@ -1507,9 +1515,10 @@ static void __gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr, __gmap_unshadow_r3t(sg, raddr, __va(r3t)); /* Free region 3 table */ page = phys_to_page(r3t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + pagetable_free(ptdesc); } } @@ -1525,6 +1534,7 @@ static void gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr) unsigned long r1o, *r1e; struct page *page; phys_addr_t r2t; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); r1e = gmap_table_walk(sg, raddr, 4); /* get region-1 pointer */ @@ -1538,9 +1548,10 @@ static void gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr) __gmap_unshadow_r2t(sg, raddr, __va(r2t)); /* Free region 2 table */ page = phys_to_page(r2t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + pagetable_free(ptdesc); } /** @@ -1558,6 +1569,7 @@ static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, struct page *page; phys_addr_t r2t; int i; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); asce = __pa(r1t) | _ASCE_TYPE_REGION1; @@ -1571,9 +1583,10 @@ static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, r1t[i] = _REGION1_ENTRY_EMPTY; /* Free region 2 table */ page = phys_to_page(r2t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + pagetable_free(ptdesc); } } @@ -1770,18 +1783,18 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, unsigned long raddr, origin, offset, len; unsigned long *table; phys_addr_t s_r2t; - struct page *page; + struct ptdesc *ptdesc; int rc; BUG_ON(!gmap_is_shadow(sg)); /* Allocate a shadow region second table */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = pagetable_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = r2t & _REGION_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = r2t & _REGION_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_r2t = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_r2t = page_to_phys(ptdesc_page(ptdesc)); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 4); /* get region-1 pointer */ @@ -1802,7 +1815,7 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, _REGION_ENTRY_TYPE_R1 | _REGION_ENTRY_INVALID; if (sg->edat_level >= 1) *table |= (r2t & _REGION_ENTRY_PROTECT); - list_add(&page->lru, &sg->crst_list); + list_add(&ptdesc->pt_list, &sg->crst_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_REGION_ENTRY_INVALID; @@ -1830,8 +1843,7 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + pagetable_free(ptdesc); return rc; } EXPORT_SYMBOL_GPL(gmap_shadow_r2t); @@ -1855,18 +1867,18 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, unsigned long raddr, origin, offset, len; unsigned long *table; phys_addr_t s_r3t; - struct page *page; + struct ptdesc *ptdesc; int rc; BUG_ON(!gmap_is_shadow(sg)); /* Allocate a shadow region second table */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = pagetable_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = r3t & _REGION_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = r3t & _REGION_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_r3t = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_r3t = page_to_phys(ptdesc_page(ptdesc)); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 3); /* get region-2 pointer */ @@ -1887,7 +1899,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, _REGION_ENTRY_TYPE_R2 | _REGION_ENTRY_INVALID; if (sg->edat_level >= 1) *table |= (r3t & _REGION_ENTRY_PROTECT); - list_add(&page->lru, &sg->crst_list); + list_add(&ptdesc->pt_list, &sg->crst_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_REGION_ENTRY_INVALID; @@ -1915,8 +1927,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + pagetable_free(ptdesc); return rc; } EXPORT_SYMBOL_GPL(gmap_shadow_r3t); @@ -1940,18 +1951,18 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, unsigned long raddr, origin, offset, len; unsigned long *table; phys_addr_t s_sgt; - struct page *page; + struct ptdesc *ptdesc; int rc; BUG_ON(!gmap_is_shadow(sg) || (sgt & _REGION3_ENTRY_LARGE)); /* Allocate a shadow segment table */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = pagetable_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = sgt & _REGION_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = sgt & _REGION_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_sgt = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_sgt = page_to_phys(ptdesc_page(ptdesc)); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 2); /* get region-3 pointer */ @@ -1972,7 +1983,7 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, _REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INVALID; if (sg->edat_level >= 1) *table |= sgt & _REGION_ENTRY_PROTECT; - list_add(&page->lru, &sg->crst_list); + list_add(&ptdesc->pt_list, &sg->crst_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_REGION_ENTRY_INVALID; @@ -2000,8 +2011,7 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + pagetable_free(ptdesc); return rc; } EXPORT_SYMBOL_GPL(gmap_shadow_sgt); @@ -2024,8 +2034,9 @@ int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr, int *fake) { unsigned long *table; - struct page *page; int rc; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); spin_lock(&sg->guest_table_lock); @@ -2033,9 +2044,10 @@ int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr, if (table && !(*table & _SEGMENT_ENTRY_INVALID)) { /* Shadow page tables are full pages (pte+pgste) */ page = pfn_to_page(*table >> PAGE_SHIFT); - *pgt = page->_pt_s390_gaddr & ~GMAP_SHADOW_FAKE_TABLE; + ptdesc = page_ptdesc(page); + *pgt = ptdesc->_pt_s390_gaddr & ~GMAP_SHADOW_FAKE_TABLE; *dat_protection = !!(*table & _SEGMENT_ENTRY_PROTECT); - *fake = !!(page->_pt_s390_gaddr & GMAP_SHADOW_FAKE_TABLE); + *fake = !!(ptdesc->_pt_s390_gaddr & GMAP_SHADOW_FAKE_TABLE); rc = 0; } else { rc = -EAGAIN; @@ -2064,19 +2076,19 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, { unsigned long raddr, origin; unsigned long *table; - struct page *page; + struct ptdesc *ptdesc; phys_addr_t s_pgt; int rc; BUG_ON(!gmap_is_shadow(sg) || (pgt & _SEGMENT_ENTRY_LARGE)); /* Allocate a shadow page table */ - page = page_table_alloc_pgste(sg->mm); - if (!page) + ptdesc = page_ptdesc(page_table_alloc_pgste(sg->mm)); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = pgt & _SEGMENT_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = pgt & _SEGMENT_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_pgt = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_pgt = page_to_phys(ptdesc_page(ptdesc)); /* Install shadow page table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 1); /* get segment pointer */ @@ -2094,7 +2106,7 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, /* mark as invalid as long as the parent table is not protected */ *table = (unsigned long) s_pgt | _SEGMENT_ENTRY | (pgt & _SEGMENT_ENTRY_PROTECT) | _SEGMENT_ENTRY_INVALID; - list_add(&page->lru, &sg->pt_list); + list_add(&ptdesc->pt_list, &sg->pt_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_SEGMENT_ENTRY_INVALID; @@ -2120,8 +2132,7 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + page_table_free_pgste(ptdesc_page(ptdesc)); return rc; } @@ -2821,11 +2832,11 @@ EXPORT_SYMBOL_GPL(__s390_uv_destroy_range); */ void s390_unlist_old_asce(struct gmap *gmap) { - struct page *old; + struct ptdesc *old; - old = virt_to_page(gmap->table); + old = virt_to_ptdesc(gmap->table); spin_lock(&gmap->guest_table_lock); - list_del(&old->lru); + list_del(&old->pt_list); /* * Sometimes the topmost page might need to be "removed" multiple * times, for example if the VM is rebooted into secure mode several @@ -2840,7 +2851,7 @@ void s390_unlist_old_asce(struct gmap *gmap) * pointers, so list_del can work (and do nothing) without * dereferencing stale or invalid pointers. */ - INIT_LIST_HEAD(&old->lru); + INIT_LIST_HEAD(&old->pt_list); spin_unlock(&gmap->guest_table_lock); } EXPORT_SYMBOL_GPL(s390_unlist_old_asce); @@ -2861,7 +2872,7 @@ EXPORT_SYMBOL_GPL(s390_unlist_old_asce); int s390_replace_asce(struct gmap *gmap) { unsigned long asce; - struct page *page; + struct ptdesc *ptdesc; void *table; s390_unlist_old_asce(gmap); @@ -2870,10 +2881,10 @@ int s390_replace_asce(struct gmap *gmap) if ((gmap->asce & _ASCE_TYPE_MASK) == _ASCE_TYPE_SEGMENT) return -EINVAL; - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = pagetable_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - table = page_to_virt(page); + table = ptdesc_to_virt(ptdesc); memcpy(table, gmap->table, 1UL << (CRST_ALLOC_ORDER + PAGE_SHIFT)); /* @@ -2882,7 +2893,7 @@ int s390_replace_asce(struct gmap *gmap) * it will be freed when the VM is torn down. */ spin_lock(&gmap->guest_table_lock); - list_add(&page->lru, &gmap->crst_list); + list_add(&ptdesc->pt_list, &gmap->crst_list); spin_unlock(&gmap->guest_table_lock); /* Set new table origin while preserving existing ASCE control bits */ diff --git a/include/linux/mm.h b/include/linux/mm.h index 356e79984cf9..0e4d5f6d10e5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2792,6 +2792,9 @@ static inline void pagetable_free(struct ptdesc *pt) { struct page *page = ptdesc_page(pt); + /* set page->mapping to NULL since s390 gmap may have used it */ + pt->_pt_s390_gaddr = 0; + __free_pages(page, compound_order(page)); } From patchwork Tue Jun 27 03:14:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293733 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 4ACBEC25B79 for ; Tue, 27 Jun 2023 03:15:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCCBF8E000A; Mon, 26 Jun 2023 23:15:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C557A8E0007; Mon, 26 Jun 2023 23:15:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5A258E000A; Mon, 26 Jun 2023 23:15:44 -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 8D75A8E0007 for ; Mon, 26 Jun 2023 23:15:44 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 699A4160478 for ; Tue, 27 Jun 2023 03:15:44 +0000 (UTC) X-FDA: 80947063008.28.FD52DC8 Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) by imf07.hostedemail.com (Postfix) with ESMTP id 9B3D64000E for ; Tue, 27 Jun 2023 03:15:42 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Y29oLBo5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835742; 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=TkWAvuRnBcdDxQyUnHPccd2fzUbRvSLtPtfAdfkK0D0=; b=QdPilzhsPVNJgU7oeiaZSZJSbpviNXVZ/yqAolED6FoLIVjsRALP2g/U3R6QTwdQ94qexB icWk6MHFqji1c9w/fsUkcRgoAVRZMpSGeq/dmRVTOIpBevmR6FRaXzS/iQuTLUy/fQi9kJ jv7vIDd/qnrTGU+tNGxCjX0UtG6mQ6E= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Y29oLBo5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835742; a=rsa-sha256; cv=none; b=WUk/avy2ackwzk5dSyzlxef15QTf0C6RjiRNolhfnvXCnjOjW2Q4EpLQa02AxQeQG4Vat5 r0K7I4RAnAvqaTBghLoX3+XB4Y27K6+uS41/KDUuqxGifQOR/+jy7aY7qwFjYs3TWF3ZrL ncThKmt7M42l8V3njeEdJs1E6MQDDpo= Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-570877f7838so42434047b3.0 for ; Mon, 26 Jun 2023 20:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835741; x=1690427741; 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=TkWAvuRnBcdDxQyUnHPccd2fzUbRvSLtPtfAdfkK0D0=; b=Y29oLBo54IelkOx322p2iVXWfA4IaT3l9yF0tlkE7TIOLncY8qGbD0oBXUadhtPpBr ox9bcqf07tpeqzwcnY+iasgqeZXejAOVjtaJjAsb7WJ15Uy0POLJ3MxCZns1FcM5WPjP +JbOozXOilFCizwLt/mpoCnI1UBR9D6cbicNOi3gepwC7mGMoITq+lzxvsSHsVo1SDEj Mu7JBT23VNXCvVL/f5whQ8wp1S6+w1a74gEslVRxsbEnv+d7SoOA5E7Rsd4oM5np6JgZ 2uL9Cbj4u7ByOSSRN6KflmiiGBGWbxgqL+M+RNd5GWw1ztOmw5rlB1y9QWz6YFnxA8My wgNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835741; x=1690427741; 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=TkWAvuRnBcdDxQyUnHPccd2fzUbRvSLtPtfAdfkK0D0=; b=ev1Gu2YlKqcVL9o3f153BTZWNT/QH5D6tebx6wy/rFPIP+x+4JAGkQQopMnZuXK/jz MWr2h8H6UphJuVutsF0rJMStt6+DshgnkWaNtyY0Mk9Dr+VvyWMoEP77PKSp8NL6IyXE QGseIRpV7x7e8o4zfwGFMR5WTiKNruPuP7uIWMDn0D3t1F734KmAtUjOqsI3+4zQQHhn M7E8qsgGaN8xnvoxcontP2XLQSxTJZzcaIFV7e1NHXudBF7vhINwok2n25Ukxbyd8xB5 Wsjr/y9V8HQNCE9U2j/fohWkCitEt8JOdWnZww3/CPSVQTdf+rVH1zgC9G6xIBgeEGoF lZPA== X-Gm-Message-State: AC+VfDy2f9zbRE4fsA/qZTCc3K+8EPynRu2iysCjmoHcixCZP0VF2hYg dEr+AVAzLzs9IgMh66cULqI= X-Google-Smtp-Source: ACHHUZ6zo/heeKGErFKSgHt9WPTzp866BV9Vxkz2nD8Fm51KKhKDyA9uiul/2kgbaOeGxMWVqoUNKQ== X-Received: by 2002:a0d:d742:0:b0:569:feee:3950 with SMTP id z63-20020a0dd742000000b00569feee3950mr33893914ywd.2.1687835741628; Mon, 26 Jun 2023 20:15:41 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15: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)" , David Hildenbrand , Claudio Imbrenda , Mike Rapoport Subject: [PATCH v6 16/33] s390: Convert various pgalloc functions to use ptdescs Date: Mon, 26 Jun 2023 20:14:14 -0700 Message-Id: <20230627031431.29653-17-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: bqscca41cwhcq91n3mjn5idfq3qerpi1 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9B3D64000E X-HE-Tag: 1687835742-542058 X-HE-Meta: U2FsdGVkX1+PNl0V7nSWN2jwOxRvSVc9uWD0L1RFdNpXx2wUsnfy5qWYX73fOFqswP7SY6++HUlNy2YFqk26zpD1Igu4ND98a+C+ZgV3wMBhx6Cjq5LHjQk1ty8p64InVXVpb0qutSpxRCCpYWZvLgGeFGC4/JrAcXa03MN0eo6S2dF5xugzvaZc2A27y4cnTs4KnQRRGV141KfWZeF8D3Er0ay0Dcx63CWU+JhmBSRmro0kIdz8YNP2v1BYz8IMEZy+GzTgQIJ6Mtv8FHP62k0CGz1sVlhspzJtWUu12dJ50Dpy4BDIk8h/jGoAlHDEg/kbWJDRvD+KcDcZlN/Jwi/Uzhwck85YseZ0f0UxxyQUGLEbrwUi5JvHBcAGxobNVZFhbZ4Ll3MCWiuLXiyhsd0JWJxlgjS/QjdLoyBz5eEv+QJwIFNNA9QJo8Z4ajLldGknLAIJK80SzI5EeZ9X6MzDvEvWycxC8Kz+dfddaa+OdNSGfbwuJGvSZ6bs8SgYXgKgqGmBUk02nVdrfaqP9+XBXnU3WiXAmnce0SkACueWGBDqrd4CxYXthqerOgYwrPSkblv+0hLbcntuXHOp8nc3L1D77z7ybhpMMnmAlPBdr+ejpUAF0t1Tjq8yFwSJuhR9HPwM2B4yCpvUzZZU9pGc9P/zm5UQ7DCglO9BSIR37pUaKPEopbaq3K4A/6LwsYVH2CG4U1OetR3ZDVWjIooab15mq4Fqp6U0F9vGMidiinNhCGtlBozcgUaMLB12TeKWHZGuB2Qo+5h4vQP8CNscBn/oLBzoqlAccnmZiKWk2j0V0G51KAGUGiMCCq7tqgKigDraTaogVft3oniUYWnBlDQwd6ucPdTxo0fwuNt3utjxTAzz1Z9bHKXl0qbZGXrbuI2PuzxRYQBd8ImYklU41BAx8LeF7PYNCAgXHpf2YBXMla6xTFfq7/ecQPjptQYrOOweV8R561Ihz8L kftJy56h bc0FYOdOaYz/+JmP7CSwAlsPtTQh2EFQ3+yGoj7qkG1dugssSSV/xJxQq6JgD2FXdkPIux5ldsHaHE8m9v8JnFR+dU+uo5Fl/cQgIx3/93xzsiDZ1uU9kjw6+VLRcXRtXOw2/sC2hNc6ZnvK8C69E8IV2R4KSKfGaZq88V5N9KwDFYHp0VJ5w/AKlmNeVHtGMAAAlW4d0aiD2aKLvGsA6BW6qMOwxQmVa8MSa9HG7v1Bup5NEcKgsw5Vm+KwOU6eMUTrVHl6y+qk6LCGhQeDKnyKEJNZZFhUfh6Wn0xPd4tITy1RnTUQ9A3KCcDDfEMc0PPbmoexj6zxayc3Anfl7rj11wdLgS1igeY+2ivmwjD/Y8fbDEutFXa3mje324NUlbJaw5AQvp8+glnKGnWN1nb99jNe2+AaAl2hBqZIVCBHTd6ygbMIL/Jmpm54Y25DzlyExHOEZQxmHWZFquycPBGVtASRlEUtPLSEhV+QgGQmTrWwzouFZPqbHNzydIeGna9Rm0TK1aCpeoaYtefrdUD2qA9FU/PMFwi+unCsrlGYNSNQC10oe7cjXA0UpJJVUcBBOejKVYzD9SHuzzw7VwMabvQ== 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 | 108 ++++++++++++++++---------------- 3 files changed, 59 insertions(+), 57 deletions(-) diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h index 17eb618f1348..00ad9b88fda9 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 66ab68db9842..79b1c2458d85 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 */ @@ -233,7 +233,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 */ @@ -241,9 +241,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 @@ -255,13 +255,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(&page->lru); + list_del(&ptdesc->pt_list); } } spin_unlock_bh(&mm->context.lock); @@ -269,27 +269,27 @@ 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 */ - atomic_xor_bits(&page->_refcount, 0x03U << 24); + 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; @@ -311,9 +311,8 @@ static void page_table_release_check(struct page *page, void *table, 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)); @@ -323,42 +322,41 @@ 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) - list_add(&page->lru, &mm->context.pgtable_list); + list_add(&ptdesc->pt_list, &mm->context.pgtable_list); else - list_del(&page->lru); + list_del(&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); - pgtable_pte_page_dtor(page); - __free_page(page); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } 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)); @@ -368,12 +366,12 @@ 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) - list_add_tail(&page->lru, &mm->context.pgtable_list); + list_add_tail(&ptdesc->pt_list, &mm->context.pgtable_list); else - list_del(&page->lru); + list_del(&ptdesc->pt_list); spin_unlock_bh(&mm->context.lock); table = (unsigned long *) ((unsigned long) table | (0x01U << bit)); tlb_remove_table(tlb, table); @@ -383,7 +381,7 @@ 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 */ @@ -391,20 +389,20 @@ void __tlb_remove_table(void *_table) 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); - pgtable_pte_page_dtor(page); - __free_page(page); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } /* @@ -432,16 +430,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 Jun 27 03:14:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293734 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 D7EDDC25B7D for ; Tue, 27 Jun 2023 03:15:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ECB498E000B; Mon, 26 Jun 2023 23:15:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E298D8E0007; Mon, 26 Jun 2023 23:15:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA2B48E000B; Mon, 26 Jun 2023 23:15:46 -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 B2CEF8E0007 for ; Mon, 26 Jun 2023 23:15:46 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 87253406F2 for ; Tue, 27 Jun 2023 03:15:46 +0000 (UTC) X-FDA: 80947063092.14.CB5A5C7 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) by imf05.hostedemail.com (Postfix) with ESMTP id A5B1E100011 for ; Tue, 27 Jun 2023 03:15:44 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=HLcNThhC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835744; 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=nccUzLka7Xkr4OuMpYk05u/KaIGQrzDFYQttz/vcmHQ=; b=hu6/QLAXEHXhRmFNNPM67dVxzQ5wM2WaeZPp/3hA2S5/Gndz0CNTIe1siYfrVHW5eHaeSa wTAD3Ya5oQjLgwy2s9c6sv8Q4RN9LVNDuuDV0Vh3EiEJW+w1JBZ3nNidnAXQjF99dORhI7 7KEXVjRv1RthyOWLxq547pvb4NxasSk= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=HLcNThhC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835744; a=rsa-sha256; cv=none; b=7imG6gYlUc1/vFghGdXUMjZ0bXm3VlmbD5LnRqF/Z9ZjfNEEfyaq/85s0UL2+ix/svkXZN CHItJAWlJS+9LL8CZMy9B/LjuSDF7/6Y8crv10U3mIFJA8Ptso+FWAAkGX784+KE41CtS6 8WfTq71MDG220SSD+N6PxKMr+s0AHkA= Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-570282233ceso30915757b3.1 for ; Mon, 26 Jun 2023 20:15:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835744; x=1690427744; 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=nccUzLka7Xkr4OuMpYk05u/KaIGQrzDFYQttz/vcmHQ=; b=HLcNThhCjrF2lW2DbUB2arEo4ko3B6allhXZIcElXjdr6H7L2X1FZfSho548An2x+c a+9K7HsBcoezl8dCiHuvfAoLyrYuTYtD9E2TWwaVAxGHkBxxc2/5TZ6nFsMXNvk6remM jx+8EfWgo0KYBg7GjeDiKlLbwiB7jM460FpLAi7tKdSlKxxDWqFHsa1UXC/mbPJcCtbU yj4Rp4J3hy1xGdNYGZKCLJPZo1cDJDTZZ/8LhFsRol7Jja96ui1kFTq+O1Fx747WJ4sF vLKKmUtgz/Vt/5vQzW3HaVNESXDRtjCa2KGe7DVgUo3lXiMXBnrUqjQNRU6qXKgQgpLj HQ8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835744; x=1690427744; 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=nccUzLka7Xkr4OuMpYk05u/KaIGQrzDFYQttz/vcmHQ=; b=AXmz02nK/8Rsfb5k6FsRH5UJLo63AM10i+GZhvOrZjikOaWXS3nIzAum7N3Tdy3aTP +n1jjz8hf8SgzF8bmiiIlFicfpWPwcmmGJog4bbw9v6gBqjo6Mn8RHsjqjFBGEZlHTWX lrXZn9ERWKu+r29sHY+YTIjPboNbo3Izf/WB2QenzWt7mnc9gS2mrXuAcSG6ifqGGEXr zVsWAcUVaZnGN/OP06ry3+OE2yAoLCwIpNNPwkApj7RzS4Zi3jg0jpHqCIQZjN2SzbBr JozTMHV390NXFMwUkiy0RuqUykNTQZc2gIh0aegP+G3kne2M4Wc7mtC/runlOKhUhPp1 48AA== X-Gm-Message-State: AC+VfDzYEmMdakC665gAmZokAjEgRqeNyOM7gFiJNQpj/L6Pw6wq3Tqt R4fOH2yqDJy1AoIMFRgrQC0= X-Google-Smtp-Source: ACHHUZ4vo/lElRqyF24hRbACCzJ93507ECpcyy5/0zyyAPcDbkzDTEVAwpHPMKxzXN5UZzQtaYrpVQ== X-Received: by 2002:a81:6bc5:0:b0:576:8fcd:270f with SMTP id g188-20020a816bc5000000b005768fcd270fmr7059365ywc.19.1687835743726; Mon, 26 Jun 2023 20:15:43 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:43 -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 v6 17/33] mm: Remove page table members from struct page Date: Mon, 26 Jun 2023 20:14:15 -0700 Message-Id: <20230627031431.29653-18-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A5B1E100011 X-Stat-Signature: h15uogxn1onoj5sgtpjx6ueuea1qo7ws X-HE-Tag: 1687835744-763258 X-HE-Meta: U2FsdGVkX1+f5bX+fnIkolLgBmfi+lf44vwIhacaHIvnGdUY62WK41kOwf7U3+K+zQ2dq7bmITHZSuzwmuxQmG5BVbR4EkUFWS6bHhT39cuaAj108jsgj8/lRnJKO3iYQH9NnM11ILvMjHprsMnQwkzkdmNrrh+QQyTgDqCPeSiRS1kh3PsmCRfgAk2vtRZ0bVN62gUAylW9d4uO05p0FzQLqsF8+kO4WsWiMBcXhO+L6+wYw2i5NwgF+YxAIduiZVOU6DhIb6q4tY+zYj2WZRv3KEe+KWLk+gcuVBhx2hBVGRhkTeECZtNLIMDIhS8FPG58EtPDC+o5OcVItWsSZBRHnfNSbpP6tPMa65k/Qd71xsw5alRDZrMMpDaRR79Nl5cKZPF5QxA9Aw/JuVX/vfzfEQHP1lK6Mr1MqBdv5O7AHcnBjrUr1sPPQOyefFSWR3KXtPvQf1Qan7AIpSoQHQnLPZQoeUXC+EsUvAyzvtMHmrgI8NmhGX8d9sgnWOVZ1jyIPK9AoS4bqARY+nM3WcBvs+13TeWqdrSGhjHTdPZG9K/XXpEnm4CQ8La3CIKZXmJqAzFz5Hi+7QvGa3j+caaworQOunRbkH+UrftVJIKNy45+HPGSqNO4QysL4y/JChrgPxxtkBCAGjr+c/1A4g4WKDV/1rDEgNXs19AnpNI3VWVC1n70Ha3mRpXVRf4g+bZx7TaY5bau65Np+PMIudpqBT5TTjcYbPyyaq8fVka8pLg4MGAencHHENdLl5ny+Zptx0WGY7xeBT6v+Ar2AXSXJK043wFPsAYLEwLkC0sTvGY9WKB8lB34e0C2yPXnqaaIpgv7sWXZVdo6tNf81DO+EnOksqyHw3xIryRmLtmsTrNLKvff0v/5jo8+jaDGq16o1OxS0jz6lkoP5aX06Y4XklpwelY4RypigSeWK6aiA7vHCpo1h7/2HfAuXZX63R48VptYMIujHhLLT6Q ZxHt89BT p5ehkhrvfOuMkHvuCDk3nK77QKyQicZnFChidvL1V7z04Yd73pxx1hYJA9K6ZsB5gKrqSfPNhMnShEvP3OwfvThqeS8CzcNEBX3GUTCC1q/jE4EoyukzM4U0ZHYHfEGlW2jW8UUvV3xJNHjGa/wbofeJHnop4qBg/1FGVfSWkxcq/OojwxvwkwXCQfIvx4sQuaubvPJidlt8r/AAw27H6qNNW0ByKS7WBcSp6ANrJ2S3fOvXHMjXQ90cZdPVzczheZuGrLwyoHsDDT3UD6XZ6kELUlOmEdsJ/ZRSxXezqkQRpRF8egVAz2A78j877+0z5C/PQm5ZLPtFbaloUvSsiA0SiaqMrY5+sX3QXcgMvMSm9wM9tU/vw1maU40ERe5rqBYAzyxBwgXIbl0bwKhQbLQkCv09G4WTcyEtufN4NVJV+f8qalxQKS8bsSPcBjSH1qfovS1Jj3z5Mg+tDiNONkzjGXVyHMbWMvyd3ZkkpjCFauvrkcqxFnxYhWDWN29sCd1HKSl5MOrs4DEYV1AyuykgA6VIT7mi1SOYxkvgM7UcpiknFyKCnEFO1x/ewx/qzv3Y6/4QxLTJRtBFi6P5QsuM4kA== 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 | 14 -------------- include/linux/pgtable.h | 3 --- 2 files changed, 17 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index fbbe4e93a9ba..434e54440686 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -141,20 +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 */ - unsigned long _pt_s390_gaddr; /* 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 e9bb5f18cade..daeacfe3930d 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1044,10 +1044,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, _pt_s390_gaddr); -TABLE_MATCH(pt_mm, pt_mm); -TABLE_MATCH(ptl, ptl); TABLE_MATCH(rcu_head, pt_rcu_head); #ifdef CONFIG_MEMCG TABLE_MATCH(memcg_data, pt_memcg_data); From patchwork Tue Jun 27 03:14:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293735 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 1EA19EB64DD for ; Tue, 27 Jun 2023 03:15:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EEDDC8E000C; Mon, 26 Jun 2023 23:15:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E772A8E0007; Mon, 26 Jun 2023 23:15:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA28C8E000C; Mon, 26 Jun 2023 23:15:48 -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 B344E8E0007 for ; Mon, 26 Jun 2023 23:15:48 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8E41712086F for ; Tue, 27 Jun 2023 03:15:48 +0000 (UTC) X-FDA: 80947063176.03.B8F1965 Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) by imf19.hostedemail.com (Postfix) with ESMTP id BB1681A0005 for ; Tue, 27 Jun 2023 03:15:46 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=H1qFd5ry; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835746; a=rsa-sha256; cv=none; b=W7FoCVpXrbBX5aV8+UpJbq0XmYBKUaD3+cDtm+t/nOUTGHzCsMohs29z3v+ORULjAaxRGx NAtNzDbxXWg9Wb1MJorHIm3YWNXOUaIL73KQB6Ltq2ZaDHMgZMqqzm+5Y+H9B3xSAKaXsO jjTlhYFSw7mWVF7aqaS6J34gSP99XCw= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=H1qFd5ry; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835746; 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=RhEi3pOeUzWTN9pD/cW46G7u/fcEj80hylLPfoMbzxW7DL0zcYSsG1wPCQwbvJW7N5HJhK O5YYLYSkgMiojBMc7x0HtfpwOP39DiGgG/XSYibjKRLAifz0bgC94XAgjJ08eqdegZBSij uVy3fwLKu5M5iwykM4VvWfVOx+QubaM= Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-576a9507a9bso36783147b3.1 for ; Mon, 26 Jun 2023 20:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835746; x=1690427746; 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=H1qFd5ryATtw8t405nCe3wIlgG+rX1BXYLLKuv1YpYWhPdhPiNJLVH72Jw72yhkr/h 3iJdbhNcvDeJj1R/7QZzbVvdYp8+Ef/D3y8M93HMkREuKVm52xA1EryWULik3f4dSL7k 14E+NJ36RkQ5e6TdqjWSx7Fc6bbQU9Nra+93+Jt2nhawSIssAg+z8tZmqu6fpDttBNOM ca/S4ptlU/TspyqfylxkdmdBeNsH9f2Hrm83Obo7DrdaBuxczqOW9lHL1iMbAqq171gX B7pt5M7+TmTNcw4OD4CiyQ2ipIhxzKH/nEdZ2UyNN8D+QQdMlcx6LBXeqPnQpiIanV21 tW0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835746; x=1690427746; 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=HCDPC876W9ljMjgNNZV0qLtXENh/MIf5GJt5sLWvAvojFWQaz3Va0WdwWHpxK0AujX erRRa+Yeft5KzqPif/iUx4jb3A0Vl57H/QtUZmExRnBCqsiD4al8YKzFPcLlzAcAir2S y5ftAzswZj+wz8QGtAboWGZKNZSatxRL4QYqzrbRnHyPdLgxFCvP6jsqPBGVrp1IzwDh /idlBN1XUtWQPBdCpp2+K4iQm5eFYNvnWjOs4Xk26I15ZhKCIW95rxAx1cyhCGtoaAKQ RiI2q2cNzEw8Qw5tIx+z1U0Nfvt1FMnF8XV2QhbKpG8PrZk2yRbAMUs2uKuGO/rH9JvL CNHA== X-Gm-Message-State: AC+VfDwzwtM0oBCeNo+3vXhfEmDwGQDwSfLWrhMN7iakAKrXX7/iKBMD +YJyAd227AwBSltu9IwQD6gLV8s1OWYj1Q== X-Google-Smtp-Source: ACHHUZ6u2uv6uT2cSLb5CcuORgExO8yy2prZOQQwKiPsRPUBkVmf/UzBxwtB6MEmnnGsXK2WOg9dTA== X-Received: by 2002:a0d:ea81:0:b0:565:b76d:82c8 with SMTP id t123-20020a0dea81000000b00565b76d82c8mr32046751ywe.5.1687835745750; Mon, 26 Jun 2023 20:15:45 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:45 -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 v6 18/33] pgalloc: Convert various functions to use ptdescs Date: Mon, 26 Jun 2023 20:14:16 -0700 Message-Id: <20230627031431.29653-19-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: BB1681A0005 X-Stat-Signature: 88qhue9ctwyjhprn957zgt8k67rfwsey X-HE-Tag: 1687835746-401446 X-HE-Meta: U2FsdGVkX1/iqpEnNCy4UPZDZB9I1slBzGIsriSb5kUYMSjENkd41ziOB9bx/qfQjKeBp+OvF5I3k8J0rp26QUzZ8yy8Q7CofHCegcUyVqkCr+vaDs47zi/ZObfCAR0T0wVl5zGvvj+22Qz1MbHOyMbUcUm9tNFcjFFoPJQyyU+m86ssru9JkkDoCDMiew1lak9fcAG7LvGkgiACTbJjt8F3MveBPpJGaMUULgBOaoktEdq0NX03g2fsK+BtsD3qM8/RA9ib3BNW1eti9TYZKU7/3f9kTpIUBBXCRHEfcCFHuBK1JKQKBnu9DMCVKG72gzbFHo6F4X0S0kLkBGopFTZmakGGRs3BV89SIzrUPQWKXRoaXalkroyuQFJsCsxPWmQftyWbLXLJ+Vwk36j5rTWYYpqmxZ3dKW+FH1pmuymVf2c1B0mFUGBkKd8IrsFmWrNQZz+VpGDbdvJqK4tSuRcHXJH28n5vCfvWmvzLheTlC6r6j/rDnqbPkBTHVwUkAeq04wSJkMTXHdX8hjPnm0+ofSHhCaoAJRA8My2sgPdr3p1QCzu1pYu8b9mQTN4A5eXWqbG9ylixWPhjNHqiqWVg0EwI5n1DxwhOw32rvxQW6jnfRyQetixZOp8K2+KJRlwb1rQFq7BIkJsqknoRjYf2W8lFG1yCZOw/+8WbIQgknFOFcEi8vmu+i0haB6jvypvnEjUqasnm5eQeKn0VxIz/3+WBssdmLit4p/RarjelDNG5c4/GluE28ZK+8uJBX5RnlyIJdZpo2hKS9ExAMj4UXL5cbBfWWbW+/SumCKU6ajO3cfui89T+LKPQDzACVnFcxLBB8fRiUzyA0FU1dCGzfZDNxhq0Obc09fXGYbCdpJIyJDOyPb4lgFeFmh56P7dyv+sYd3duOMJpxxwZl/EK9ZEHMYbIZ1zFdDqXcSK7vqclmQUP4EV3NDsDHIdtdINFWjmKZrKVBbt+9qE g9T8v6R8 zgqLv+FsfcSU1H6z/cryBF1sJUxdGFbcp6KHJXvSwj6vHQkybaeEnnsDcOvXKbyq6ht9+BEVVxWig/uKjIAYpyAwr3HFXFmhhi8tPDusiboBe9LUMVv7cX2EXjHXDEDY1Kx+t53Q6sn0q6gmeFznvXPIrvoo3Eds98lgY4LYn5IuSY3FIlm6uwP2xtEn4vzEyVN+PvWod5EIcCG5IWH0NP3yuNz7N54jEH/2EJLs63ygE9qUN17/5v5203FDVsuRDk5+KaWrV+tVdEpMgs2JlthBHtOq9BIzCYuO++SqcPi7LbAGzZoBh2N0mTwPuXWlZWw4pm4Ck3xWf7khuLDcZikAAzya5rMkgeOciUZh1h3jgxsh59zGQiKrc87GmyrP2V0kTvShJlDUhGtGYS8RlbtdDsHjKztzRIQiVAItIs5cAE4Gid/bWazrTM1FvnsomNv9ZmQY2YJWQsxqAqYYMjU9wilQjGG1V6Sq7wXAlJSm4P43saWtjX3vQf9YoSL1d59nJnBU2t/Gkhk2GDKJQI8xCH4eVbs2lQKkK6N/X73BjpXsuQwI/8u4reA== 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 Jun 27 03:14:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293736 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 852E8C001DF for ; Tue, 27 Jun 2023 03:15:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3CC3F8E000D; Mon, 26 Jun 2023 23:15:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32C438E0007; Mon, 26 Jun 2023 23:15:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 17EFF8E000D; Mon, 26 Jun 2023 23:15:51 -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 0328F8E0007 for ; Mon, 26 Jun 2023 23:15:51 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A19DFAFEB5 for ; Tue, 27 Jun 2023 03:15:50 +0000 (UTC) X-FDA: 80947063260.21.2440239 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) by imf17.hostedemail.com (Postfix) with ESMTP id E602240010 for ; Tue, 27 Jun 2023 03:15:48 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pEoqTDJn; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835748; 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=e5dzlAAhyf9/TcD5Av/1bX5UwOHq92uBa8cJjLXNt7/lroHwUTOyoQFwsRBIL2/2wLNILl /qjcGq0GduCpBaG+Q4YgJSpFTxvybeNWvRkbR0Kwwv5jNM5MvZOcXAq1e9ranLmtLiA1oa oTggTJcWRf+pWjVxlOG6sIE6CJD3j9U= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pEoqTDJn; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835748; a=rsa-sha256; cv=none; b=wlJi6xmcQqL2d4WllAJbPt6FqSe2RjnxBh/Wpaun8KxyoGWseUV/rMH7u2EYas9eybx7/d /zDGLrTMnLh/DQ6Je3366sAIbGu5WvwZQ+sOr1mHX4COBIOkJuiU49cnm6Vgq05iFMNrPh Gfn7xTx4DobAdZNe8ssGbiMBEkkBZQc= Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-5707b429540so62184767b3.1 for ; Mon, 26 Jun 2023 20:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835748; x=1690427748; 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=pEoqTDJnBy0mCqMkui4NdE0+Cwn3eLpTYrB/bC5trNXcVXfSLt5Z5R8YIAYFQDP+fU oHaVR+r3yqYLt41ruRoFntv6iwVJI6k1WqPqr0CaczRFTmURyku+1Wh096jhdpaix/Yw TPjMea9fKHZjosCsh+ySOFuhqRhCq2RDcuYke4iWdPlhdEuluthF5cnNEQKZ+c5Hc7fG +fx7g6BPukH/s549n7Tu5GqJ8+5PFdtaVRB8v1bDc72Rwv3o28GHJ8X1zhRwfXU/u/w5 Ysny8z2GqEVJln+w7kgofDjg2/U0lPQrPRqE+xKNvOs2VewEz52G+iOBPJ4WaFg8E+aM IwPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835748; x=1690427748; 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=Cb2qlKuuW8pDIa6px528/UW4pf8JdZVMHx0Xp6gDx90yTuYtl30+NIwzpD6XTn4yjq XsMzwnd29ZfndUUYz8yX7e++Z9HXFS2uiF8fUznge/Y2OoJVbZ9kq84apJD7gXdGInE5 7l04ilFvnjCaVXedhLgVuIUd2p77UgvwBcsV8p9zgTytRdAdlvz/JsUb6kHXllE8MnX9 FI9py08ycEyw/i0KGKb09TyZeR5HfsG+YDv84FyUOxR42wpXVZdU4U/fFVe8/gtMsIsH q2WxlxJs9CYJJV79efqTEXizGFOMN4ZKpb+sdwImGkWrAMbRQB0cs7inmPIX7mIYK9jm Hd0Q== X-Gm-Message-State: AC+VfDzYh1c7qt1112xaQNqJ9TutfPGZrOv/xg7tDA6rUjq/2tZJLbFc PSD7iTbLIjPLHIDwk2zk2ac= X-Google-Smtp-Source: ACHHUZ6p2ufkJSMv8EFIrIVima6CHOhkXf0TNdBTXqyjA7XsBDI65pfDIOBZhup550aSGjYhkYTA/w== X-Received: by 2002:a0d:d988:0:b0:56c:e260:e2d5 with SMTP id b130-20020a0dd988000000b0056ce260e2d5mr41557377ywe.7.1687835748072; Mon, 26 Jun 2023 20:15:48 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15: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)" , Catalin Marinas , Mike Rapoport Subject: [PATCH v6 19/33] arm: Convert various functions to use ptdescs Date: Mon, 26 Jun 2023 20:14:17 -0700 Message-Id: <20230627031431.29653-20-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: jdambzde1p5ocbjadnshyx17zeo9aoh3 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E602240010 X-HE-Tag: 1687835748-847473 X-HE-Meta: U2FsdGVkX1+z8wswvNbDTrqBCMZeydxmQ1bzgzUnSWIgEzTHFEVZ1Wrp7PzgzSBFl7IT2G2PBTLCcWK8C7kBzqap7lhRL4i5OGmIfhtcG+6JPx1vSn4SZLYPKA/Tr/wpOs3YJvNDbdhlQ8EZWBVpfrGtv+2lXDwuEjrlg+gyA73JVImgj0b0CXdb+a8ichDABxuReadot4EPKhH7mD7HXr/I2ISMoRRqY+Fgmel/FRTPdeco8MGVsbzIQyiCcyuW7wgksFUFOaezmfOkv19unNOWG6OrrjMQYmkRl6jt5FiNSepkYcrZVIf/6YDeqwuoeBC2UcMoKC4bvkUlX6xAcExl0fmboFO/KVqTDp4GhK7Bk6D7ASbR+BiWRwnkT+hXtp/rvymk61myPsJ6TS+Hp2izfAM1KGZRzOmIxAz+XOCgvRKC66OY5OxBnd7u/+jvGCYPbzA72+ORGMK5+1U/W+/l97n6iv7XImCuSO9UVxb1ZkkXpm3R0WGRpV3g7fZ7kmFoIrAPjPPgzc3ItSWjLF2u6jZjXDw7pb8EXwCMSdJ266WMKeN/SeG3RAY29RTbcCsa7Z/GVZGLmvZ3ekMaA7ON0qJBLGRQ3qfz7tdioAf7tOZHYMGV9GPVskwtA4g5gCu8qlUsxFFVPl4cOqXPqPdqEbT8TSXN/Ogls0m4zHiSSoK0wksQcTKF2acFWP43vbJk3srRxRVayRqpmhOy5BcA2SgUOdsz9vIaegehbcqTjh/nsh34g22M/ORztFHNU5tHADaBMn7j8ycJvtgZl/oeiKGdX8r/1tsptA7uQRkhSt4eg66l9eUHEsx+J5Lu+h6f1g6SnSkSGUBYS77LLKmfMPlMQhtlXZIfTHftt15/fP1ok//+Vy+/ojSB1WfVFvWgjqbcPFuWst7q5HwtJrne1yY0AyXLVm1Lh6mAqv3/Uml88cHQBXSx2NPj/ZtvZ0Yjjo1O1g67pEBPneS 74bMzRiU GtgminSTAAuAOMSrDBgNFv5XN9+FnnbrGScbKWzPFHMP53xsvLe/voolfcWpqbQ2UqAQYkFRf+QdQex5Y1XLQsLN/obwt78GMLnGQofKOcan+T23Ffrinn5+dhXJpCyiKpeU8nRyh0XFsJapk9+bra2tmM60NuEmmswhfaYfMZhexYi5ecU4uxnfPXt4GJg1HZeSlYGrDU3JKfcP8DrPepsNMqLX0fReaoug9gdVAE9uTBFglGyqkg4CEW//cm5m+VWeq/uFPv6Gai1jkLlLHaeiRyW0vsecmO/ur95NNRuEaq+pnfNWxsM5btVSRpgqxlTYuajjltw1qdYGHSN2LshWFjkSchgxhbpJZFEKRdGmES+sFtGZsKzq5Z89EZYEFeBKJltwItYghfivJWlFTb6/f+Hv6+QVeQx0qQZWSfxkaHdBvKGu75PObZ5XjX/Hze/DS3zx1ApUDAqj+sIRn6Pff53VWbYKVv6efQZp04CvCRsiIDNUQIZ3HTcJ7qug1JE+TfWre8fNgcPGJxG6EaC9mfYjiPZqzEdcawFaS7oNTch0NmCf4BpwyatKkNgx8Assxmpl0VUgaHvMxtRIoqI1lCXYNaBjLQpjo9gmURrV+dWph6n4QVw6s3+ElKoeETW0z8K7X6cMP3PLtYnFxn5JmICkRiTK77KAo 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 Jun 27 03:14:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293737 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 1BE43C05051 for ; Tue, 27 Jun 2023 03:15:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 505288E0007; Mon, 26 Jun 2023 23:15:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B33C8E0002; Mon, 26 Jun 2023 23:15:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 305518E0007; Mon, 26 Jun 2023 23:15:53 -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 18D258E0002 for ; Mon, 26 Jun 2023 23:15:53 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id ED4761408B3 for ; Tue, 27 Jun 2023 03:15:52 +0000 (UTC) X-FDA: 80947063344.10.6AFB16C Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) by imf07.hostedemail.com (Postfix) with ESMTP id 331FE4000B for ; Tue, 27 Jun 2023 03:15:51 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=VXFgZtIL; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835751; 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=lnRVVDvBnGLi60Y26WyWi0/L0JN3WP37M1qumGLTvc53Hil0oW4nh/gzvA1i1VMiR/VuWl A1pDj0m11VJuWEaAwSAckw6XiQWweFA1kMRO7TvvMpUB2o6vmyheQSQlUHocVdzvmSeVqA SN6qP8gK6tHwVGpOv6gjMGHP37ywFlY= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=VXFgZtIL; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835751; a=rsa-sha256; cv=none; b=KAQuJd3b0jp5ypJckbKiptzP6ihx6CR1ixzYaHc2b35r9fnFw9EEagN/NnRw7EcwvOPA/i wPZvXX0JKREzwWoDcJuJzl5LfJTsEo3DFg5wr8deEkjQujMYG/bd0m87ZSbI9+1iQQ9yBE xk8vMMq41jK2DpEq+6DnFNRahmwJYwM= Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-57083a06b71so40015547b3.1 for ; Mon, 26 Jun 2023 20:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835750; x=1690427750; 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=VXFgZtILJXGVZEJYMvHJGtbDmmBoKn8mX0/dAC+EY4RvTpIsJK+gJ5UUjyLzd+tcaA Wa8E/Q/hReN0LGOCZNJ2CPK66hXv4CHL1RcwD7G2hwKgrVV+r9MdE8P4UKG8hPoTp4Um SIrbyRIEF8122yBtjbfkSdTM8KV9j17ll3YIHe1LlzxS/E/9XISE37/ArykIbO2T/+U0 rkTOBMVwTfe5aMKf0k+p5UGbW9JxArSdzVKMpa8hS9FCRAuPQzNFBaUszCNNpnt8LHI6 yAZrECaEr3SZfaO8vcK6fiSyK9T57SgwrpEkJPc2S/OPeKfITI7S9cxAkwbxJnf5XUxM do4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835750; x=1690427750; 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=SbhPLlQp3Qh+YhpLQsvLqxmy44Hdau8cQFpzXmFNytLtpfr2et3dGyvbalaYvX/8G/ c7wkhjO//+krDtlG3BaKXbDkr7LBP5nbpfZ4g8GGVBpetvjXHLm/Udh8dorb1bI8ocNa WeheqcOlyNciSQB8sgneFD8p70/FFXzn0U/W3k1ImijT4PH8lTzGebhfgC8Y81A+8inW OmbljJKyATi27ATD3tMyOI0wmvZ/nVk35kE9tjA5Zkrgi+5nw6PV5pjrC/JHw7bG1lSl YoXuc1kLUdT50KQFlCha1h/oEc6TDbwez8cXyKjgU7gJIRdXdf6+vP3GrYIlSeocph8I iTaA== X-Gm-Message-State: AC+VfDyDizwcSjc24pXAoxAf2rLpTQEbivJWdZ2c7Ox1W+6L9HLhFud8 fNBAW7rtIJqwOFXKFoXGDUM= X-Google-Smtp-Source: ACHHUZ5fFv9vf2BaGzqImDQ1UeHA1UgOFch4VJlKuLrykfvZA/f5SK3BTYMlrNUhfUsCVi2Zl8lSjg== X-Received: by 2002:a81:498a:0:b0:570:215b:190 with SMTP id w132-20020a81498a000000b00570215b0190mr27857555ywa.31.1687835750176; Mon, 26 Jun 2023 20:15:50 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15: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)" , Catalin Marinas , Mike Rapoport Subject: [PATCH v6 20/33] arm64: Convert various functions to use ptdescs Date: Mon, 26 Jun 2023 20:14:18 -0700 Message-Id: <20230627031431.29653-21-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 331FE4000B X-Rspam-User: X-Stat-Signature: snonetw7e5ow4tgqwz6xjmre5p7wss3q X-Rspamd-Server: rspam01 X-HE-Tag: 1687835751-894251 X-HE-Meta: U2FsdGVkX1/koKw7vRiMigaAWRRs1nATu+TXIMRcuMEui2NA573vtgNDfi+rQn2DeCK7858mseCWY0MUPedO3UsdVQ89H5ZB3aKXd69FrckjsOTMDttgqBm37zVWSIduKONCVVloIBqTjLrh74WpiQ8GfdtA30m/VS/uYHjBCkZ32vkeIAXEybVGvIvJgh6CRo96pN+zGykzI/bI8C7Hh+Rsj98ohnW28qksv0/aJTOsgxS9E+aU7BNQbcCh6ukwQ5+4tHX88fVSSuvtrTGqYOnT9FVxTo/n1n/poLYFxxfOoSKXprvQ40Ec3oqwbBwGklmgBwjzYkDBjjlfCQNzUajV34er4lG4dSYow3i1RNjmWE2KUYOxzwNtixC5bh3uHYTbLklaiTa1Ml65nWEB0dEyvF1eYf3jxpfa2RD6ag0cyoIUopkfrj3ysdWHiSp6e0M9szlvbGTWfucp6QFBLtEKolNHPvrVmbdT70/WrZ1t2Wu5a3d26thTWpFF26rFwWF/NNf8GYfTeMAVXoXJsd5oW+emfHBdjxVYry8dqrt0VFMZ8tKyBXMA811N5XLKfVni5JzVPmB8fOKM8q/zvUa621wzqZFMcVkvbwfDRaIsN8G1hqrDIGDENul67JajMCSbkckQcDoN4ZXwRChU5Pt8Q+SIHaImrKdC0Z1/T5Nbe04yA3NaAsfota+Eczb1tkuph/hraiElOylW1MEp4TQyJFdT2qjFK6DfrqKQXfEbxZQ+lr5fSPSOhWAHywG3Yzb6YUu/rX3hN1en7O/mpMhXsICZeOP1hr68E1BYPp0GisKmRBKxJVE6f/VMs1Ni5a5rRajPdNO9OyRDKSvBitlnMAhsMoGXeQFoxH+BG6/ESYSJvYKxZGBSp7F6B4jjQWoKzGLUDoVsNSvqgt88/rQPDsDUkCsQU1xy/xWuKPHh6LwS8NsAhbIrqu/w7vKeMhdWsYk3AbytUIBF5WH WvFnJIp4 O2thb4h5p4fhW5XqQbJbg3lkkwOZPq/LRfGykWPXmNyDAUh7gkUXTATA50fxqlj28Lml1ECDniwjWszxqkiTjpitpRCpWyN6Q0MaFH0hToaLiXthLBuJyeB90VTXQtvwsSWeF6cxYcrDJ2OKgVFGRYaef4mvSK5wo2UjwsYSjGvBDZNHFBizpx3dMr4DG662u1ReFsdD0/T95wwrMBZi4OuiDi/kS91si6aA011eRaeWAhvnoIUTguckl9qSiPT5X1kBSzfaWRRREq+qN0JzovRUIJxDOv5wnUeBulE5zt9uq6TdCRJLGv4yIGNSyMavuBAlgDaFswcJ/JrQqAFWq1djTkM8ngpUNn1JPBBIz0VGH2Q06UxoGRH3J8f55vl81KegLRpHjs8DK3GmmWz0ZosMde+lfTJkn0WpB8k12dq7kFW2roCVyOnmLmh3KhhfCYgxHqHfrpyhVOpiWOUZrf0AM3eSB986Tc+KT4Lv4Y6D8357/8qswnBeh96JL7DGBUwTou9Ezc1ZEjpF6eo7/AAh9xu5jM4jhzvqGhIICvVQ9i2yLf2thZNGAsGeeQKmkZHQ0e3mG6jw85z1mTe0l3RXyVyZiDkLyJ5Zwa+RHqdD7PHhl35xnoKOgh8XAhnfEWOpAb3V5gSN1Ew6mvfirAJLgOA== 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 Jun 27 03:14:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293738 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 36132C0729B for ; Tue, 27 Jun 2023 03:16:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 774B78E000E; Mon, 26 Jun 2023 23:15:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D5608E0002; Mon, 26 Jun 2023 23:15:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52A1D8E000E; Mon, 26 Jun 2023 23:15:55 -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 385928E0002 for ; Mon, 26 Jun 2023 23:15:55 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 0FA9C1A082E for ; Tue, 27 Jun 2023 03:15:55 +0000 (UTC) X-FDA: 80947063470.26.26042AC Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by imf28.hostedemail.com (Postfix) with ESMTP id 4A010C0010 for ; Tue, 27 Jun 2023 03:15:53 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Z2y492L3; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835753; 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=avo9tbj3NU0r/jHX8AqMcXhov1RLcAQGYrB1/Wj8PGgNHXVJzT3evKu2z31vfW/82PTUx3 DXqzL6l/biElcGPp2JFUVm1EUWGRELOzoWsQSEHzhU8sv/uWlGLj0/yqwDTSMSa3ZMoqM1 AGObp7V1Oqa0yaJwwY/lCNUQScFOyyk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835753; a=rsa-sha256; cv=none; b=WoP9S7w6Fi5AuioWI4c4hVrmE9xJBJTcUS6GCkDZzgnshqK/tupSU5ONVvNVkcbGpT/eIc mjqfSzjmzaUFJjpFnnT06Jshh9dYIOv081G6ufoZQ24KDxl6EoQfTyD2dtU+LSED3COhFk kANr/ct94FySakoOwFx7E22b4f6hN10= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Z2y492L3; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-5704fce0f23so42036337b3.3 for ; Mon, 26 Jun 2023 20:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835752; x=1690427752; 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=Z2y492L3/D8WlJ5Hq0dqKp0BKJYUW7Eb9G7qdf3vIGRQ+O8SF6z7cY8de1pnrMmDqQ +a96x8kX3opEhwfyHnlNFTWX5OwZauzWBj6C4ouPJiZfrfA0EmnR4gOkOWCXT0Tt5rk7 XHfLS6CI7/qHcQlfDrYckrQudKqfd53TugdHSOAC54JEXTOgwU9ogsxc/TSIilUUybaL /EAuzpcVE6dEZDr0iMV3l0ZL5CrHH5SQ2tSWsVIXTRE6S7JRWuiJGvbxR8kbv1x+D3dj SKo4oZP9xKp5iaeAAmMvP/qF+1bKjojF2HvsjQLLw57QGCxHLxvjF/rVFYkYGLWd7pTO F1LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835752; x=1690427752; 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=km6kTV1nV9vQ55bAj3sGZd8+6LPe/8kyvKwyFrdPbD2EvR9lRwGVgoORRYxOlrjb+e IMEBqpwlGmmzyDSXz1CLZ1zoSdTmPoS9RP7z7Prj7/IZvKa9yf6ymwzHIjwU9Fpc45Ij U7DYkSlb4XqAtuPfvQ/mSxEBpIKWoUWwX+Xf2n/6uQr3ILITZngCx5YXGWu/NAWW0hlA e8O7g4xuFkbawWXUL3EUJqHB2mWepS6jiCciZ8SdKkYSiD9fCHL+UTi/eWfIMuPynCSW jTSHC0ydXjvqFYq2clQY4dsTFaavI4gotjgZnpKpf3tyseRWEBOx/XacXTesYBG+UYK+ fvHg== X-Gm-Message-State: AC+VfDzlqLRAvkeo+ss8H40ByJNvAsESs3oChPbveEy/jgqC9oz1CApd RZcDCI7/fDiqVqsIsp9u6dw= X-Google-Smtp-Source: ACHHUZ5CQK8kRHJUPJM2uDCPFRj7p03JLp7keUZBkce6O+8d/iMl0gg4/oyJxvTRdTEHePf390CKKQ== X-Received: by 2002:a81:4689:0:b0:573:9751:ad15 with SMTP id t131-20020a814689000000b005739751ad15mr18645821ywa.17.1687835752283; Mon, 26 Jun 2023 20:15:52 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:52 -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 v6 21/33] csky: Convert __pte_free_tlb() to use ptdescs Date: Mon, 26 Jun 2023 20:14:19 -0700 Message-Id: <20230627031431.29653-22-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: ygyfhxoje1axckq139agnsgsaaoobzxq X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 4A010C0010 X-Rspam-User: X-HE-Tag: 1687835753-471574 X-HE-Meta: U2FsdGVkX19bpkqHiYv0OEEMO5EwgzzpYeAMWh4LGx66gYosqSHod1bLL54fPkdhocUbHCQ/Udrkus3zyBoNn5bV1lOEmYNQJbBNy87h5WmIpK3DjbJmwHQ/kf4G8F7RuY0bdEs6XdCUVU/tLtM8KbDORrcywyThCSWI+G+pUZ0MRa8pEYkByMsSgSaLa6mVepVbP6e1UgitfePYrzLeZ2nX+WbQOAVf2FGy8VYXWN/9+2p9OyzkQK7d9sIZxmPvu3Y1Bz7f9mUJSXjtbbFF5oxGoljdW1ZssQ1LxOjQD6eX/xJgAnIrEh9W/o7W4y9Yg4rBHiY7gvbTlJibyQYeO8TjXcRTEA5XDBq079pbYONTHk9EuSV1G+q9vPmkqkp7Bfr5Sw2W/xsmLVvTB+hWSuPro+QKH0+wDEehIbB4W1Q3ZhrpQyS6HgOQaldlt8S5AarqsZnOCcjnOuNj5tCJWnDB6347flvY8arTA5YmbvgF6cjxNqqoaIQtS1r2J61M0B4COnnyK6htXLoLP+wdIIfKlo/UMFKCClljdsuGCN+a5hKcTi0qUPNOsc8SvZIPkC1lmVpnIxEa4FJNRLduqR/3TkeWPwHN+wUIRstHECh1zduORBwmRrkOAUzpsbjDAkTkV3I0FMXltiyInGYRkeF5rb921ONYK+Kg/YttwS2f7bXagOHGHHbaQ5deSkmLmlHyIS9M4TbRBVmc0pVjN++1UOx7OQ8ZI1Vap6Cbc6rrzLNzJaJ3GMahaQ+ADDmLwT8tPgpJVgfJlirHi1aCP4uYqR+qqTuJpoPRZCnb/jt/ysP/FEeH3zQi5o42FG+pHFQZPtqWaF42ncrLEWuCPivyXndnGZM481fXpV8EXwbnX5UshPvGgNgWfXBed1KXFHh4I8cxKDKpHyd9f/LJ7hY5btgGwDwVNo0ONxCyUmqPFa7t9JzraJMd9ROT9PoAeDbK72bz5JBXfMqatLu Yl8lrXuz SfCW96ZX1g3eX3PsL33eBCRVQeKr7IbkfOtJFRQtoN7t70T7nSUs7dYNep90jWZ1D6NKemlV9mhSMjITEvgEb16QxYEMlMjNIBvwv0qIALIZ815UTYR1kPilZ0L9v3w/39Xzaj1EI+WoCZDqG+8WymrXtUWML8g664TjRlOg1hVfmCv7ya5C86tMm5mFnUR+CcpKePqSFqg53jpRm8E2ZkThGEAhloetwubG8qNbeYRDbC97Pz9QDCXrCrtdeMIDZcXd8Mo+x2FUcKzJUzAdXGy4af1zbty18Ejy1XKm2SZrBIeeDK9X8ne99LlrRC8MPf0/7Q7sr7tTeTxxTcXEfPc4gzrpUY63HOh1DiztTr0h8GigPGY/guPuSE02FJwwa0vRoJGimxk7b8jEzzS7UdpgJRcLoLOWMvbidrcIEd4ppz2UtfSM5Rx3beXsGbl6LcTYsY3IvcVnsoWtI3lShRpIqX2EYvRKLbiVPlBjEXaq5W/P0r5qBcjHSK41PY4+K4WFNRD4eQQEv48GvF5cjM+WPb3SEdUsE5tZWaXOQgpxmGajKJOlf1MN/hCxdwpcO4EwYV1bdJzynTF2fdul/krSB7NyUHjP12JWVNX5jHLLnimDzCO4voJbivxzHF8bA4q41fBvVjVFUCpo= 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 Jun 27 03:14:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293739 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 5FE2CC25B5C for ; Tue, 27 Jun 2023 03:16:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C7F918D000A; Mon, 26 Jun 2023 23:15:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C05B98D0006; Mon, 26 Jun 2023 23:15:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A80B28D000A; Mon, 26 Jun 2023 23:15:57 -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 8CF718D0006 for ; Mon, 26 Jun 2023 23:15:57 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3419BC08B5 for ; Tue, 27 Jun 2023 03:15:57 +0000 (UTC) X-FDA: 80947063554.12.202ED2D Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) by imf18.hostedemail.com (Postfix) with ESMTP id 65ACD1C0018 for ; Tue, 27 Jun 2023 03:15:55 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=m20u0ufi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835755; a=rsa-sha256; cv=none; b=1P4zK9KIrTeTOhRTSNjxpDqzATYiENREroUKwQIA40LMu7EbXjqBOxralBSU3IbJSe34qs O9fHYXbqJKmt4DCrj5HlKT2QJIyGIWXJDhYcppBG2Ey8WDVI1Pu1ptxCheoZX5lbempqoB 49ZPoL8vtJ95yMLmDiutgz1YrqgaEsE= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=m20u0ufi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835755; 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=Uo9xqT0hxr+ivkjcZ6xOcYd2tj7q5dmqOlgAJCArxTHrkEaWyEj1yhZOV+nHj1ouA7a1gJ QawrBpjstoV4oMXOzlaN1hcrndRi1c8/h2mI8xo1Ih3zDzUoa3g0/DehOPOyt5g1iEMJyb DYfjtMGPPGbyy0g670E4CFJc83rk8rY= Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-5702116762fso43161867b3.3 for ; Mon, 26 Jun 2023 20:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835754; x=1690427754; 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=m20u0ufiAKGaCJ1eF+oXsWKBIRL5JTjyvtae8lqFZvtXfIrM7cJtjjAu/m4Uz73Z8l 2OzyWyLCkpN3ueHXh3OYTXgBp8fMDOqyT852NuEeBcWkgEMJmVKnx3KmXsByRx3AKFHF Vg5wuji9LMQRgJRH1HqmX3jxPY497r0xZlE76FEouiAeDZpP9QjhFrAgiTXpIz8r0/Pn raAur9OcS2AWjvRxW5kW7BBQEK8M8XOe3JN2fYON+zb1b/iUEGPKmhswAXipr/RMjiJ1 5Ou/YPdkNRNCdvvgrCiDyHNc6JnGXPl8TTudPcGz7r3XrC0of8M4idYi+6qLUVc137gj TxEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835754; x=1690427754; 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=LabJV5jsNUOGrr9uCqLyQvTWfk3/gVq0fdAXJVrjZyzvpWWod2IK8isQdeW3zwezW/ VhfBfHcnSTxzVLVf2mB67jSML0V254Ukd8fOyWCvdgeh+zu7qm0fGbl4wuYUYK9AbaTp qm6VDuF6sb+ln5n8UcPO9+sp0QgGWObGACOqDzS6s9PUuuIyKBbsYOHqetQzhZinTVgu OQ7DsICcx+JxDfWKV6K1Zah4tlpulrHq8IrvNrqr0YDAsaIleQ2dFaXdLXCAQGs2IBiL BaJk9GulgDKukFGa0A9aBeJM7F3Wcmjp4cO/EwbF5uOtAQDBVzuNiMKxDp5+UAwXcmqN nexA== X-Gm-Message-State: AC+VfDxIZEFU5oThEPyBoJf+Z753vQ1wM8MgpNffLOaQ+DAQtqGC30Tc BG46H+J50B1SCmRVfzxLmHw= X-Google-Smtp-Source: ACHHUZ5MOzNqvj1LDJTcnkC+L2S0i67qvPaFwWjlYeZ+6A+ljBIE978bk3O2AZxZRJ0D8kmPxN2z/Q== X-Received: by 2002:a81:7189:0:b0:56f:ecdd:ded7 with SMTP id m131-20020a817189000000b0056fecddded7mr30983642ywc.10.1687835754377; Mon, 26 Jun 2023 20:15:54 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:54 -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 v6 22/33] hexagon: Convert __pte_free_tlb() to use ptdescs Date: Mon, 26 Jun 2023 20:14:20 -0700 Message-Id: <20230627031431.29653-23-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 65ACD1C0018 X-Stat-Signature: erbwkuofwmwaxe4eq7o33h7fjs1iimnj X-HE-Tag: 1687835755-170217 X-HE-Meta: U2FsdGVkX1+8ZCUsUuqULo0GnMPUen3bBvGFsUiWTmqTfy0s0/iB5KJ+OU2CcYCmnUvKeTDrlQ65YjI+QXZUqZTydPU4bGo1HqRKXMvMfBNqTmlzf0scoHNCqGMebBfs+Uu8j8Aqh9A/HMj05PeMKlfsVPZW8XB8K8KEB+OEheCzvMLIxrZuCN1EAS3KhUdpcCfdvczERIot2ZjyQcFRykIpZ7aDvRwMK9ZjDB7CrDdmRb6W4u7wu8jS8JnquS6HYBOmFvl29cer1nxHFZerO5XTklQ1iKeg19A8ExkVXt4mLnSj3cr0kW96YQIRc2FR5JTrGkdF/d4ila9GbIguw7uCAaeusUqRUiFLVDhnlmIabQKCIe/RIklv6XUlMP2nCoEstbB6TGNI15JgC58E91o9fiua8+c7bV5TvTrEO1JSQznhSFcobvEowitGN1W0yPOgYbJK6l6oQ10wboMxwJvWnyVijwRcBU3xwQhP/us3T5mi2m5EO5v5PCcE1o5oU2/qK7vKK+4bIW5Mj6DPYMfsPnJLM49iHldwf9Fq0hAIMrkLU3Kc492KpPCHG4/Ar0HaTjD+/mlbT0dXJCbq9UnWfbltU+BYtBK8Lu3XV5fHcTV9rmhKp5jSTkAkibEfedltJEsNYKXWUeZdHE12qRtMjamsXMx/H5WpbLbervlsUTcYBWZqQPnhLcWfc0ly8chOs7MB/I62JNXErJ1XuCGcg73uNyWJjBS8TBW3bIRBtO4L04lLoGSv1EvrJtlepE5Tx/oaexv4suePTYYBjSi/2XG34wI9JBhc8Uthptw67eZSFOS82X/d5T1SqCcsbQI9icIFoJKsJLodmv/k6d470j1f/BDtgVJHW/TNLCGX4zPHHqhPyiVG1Syo1W7IjILwzCdBli9ldGsm31YvfIQuWhv+pVVE6PQ5GCBJWFpgbUD1m7mUPL+ZC+GW+9SNloYzf7Le25bx7EwgfdU KCJ+EpS8 pPvG2D7AMdZ4VoqXcJKtNDxdVyv/9ilnq09HmP19LSMNVy7QpUncPMfmERvd7+goD/wv5uEv2PLo5AIlUKQ1vFnOPK4XmqyJJCW0/NwNJeUW5BDUj5+Sj0+gU7y5FW653/INwOxzPpk5CghQ6DSyuWtawChmiKL4Q5uR47ZLAaoCADW8i9ekL1ALEFKKPjfzumgaFAZBDTmt7X7OVf2N05GKTGzYEC3xHT6joX6t0EioqLCluiyZiU092gH/viNQlGlSU8omdSCbaTir1NZSTXVq8Tr4WkzHFqZf3R1xv2P0g9fDeDVd2k2TO6U0nNNVIF4wQfXD+2XWN+/Kw5Dlzjk972Oc1lv958jVj10bytqFBndZT3XpILeOjTqEE9SOYUyCK0l584IdRHsi6vltXdo6j0v9gNMb1za8kpFug6oMrpVpSlD+dcIFH4cdJcMxJOIy00+tcFMSKEQz7dCp7xEQ5XMKpEbyOukTX8SU3tCxHjRXyNE3U/qxfxdnvqO5bJY6tDerA2vpTU1stWOrOUH+SDdUaVyKr9Vnq7Izeg9bS8Q+MMtJTz8zVONpHGUMtopTMa17egqGoTGskw5j3LoyL+e6Vysj95F7TdVi152x9trpuxFvE0Y0SYbqGcpyjVraWxdI0w1+S088= 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 Jun 27 03:14: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: 13293840 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 8ABCDC001DB for ; Tue, 27 Jun 2023 03:16:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 997BB8D0006; Mon, 26 Jun 2023 23:15:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 91FC68E0002; Mon, 26 Jun 2023 23:15:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 799B38D000B; Mon, 26 Jun 2023 23:15:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 640E18D0006 for ; Mon, 26 Jun 2023 23:15:59 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2D7781406BB for ; Tue, 27 Jun 2023 03:15:59 +0000 (UTC) X-FDA: 80947063638.28.3B26930 Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by imf30.hostedemail.com (Postfix) with ESMTP id 5659D80005 for ; Tue, 27 Jun 2023 03:15:57 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=lEtqmrwI; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.170 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=1687835757; 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=S7MwJlK7hYUYZ/OxVGkxRDIJvuZwB6MrGwg1fUXsa+mr2AYlFJG+pZ9VcpBiUFADaN/nOC rjpaAzrRkCYDDT65dHJNJPY7tPNhS5ql56+UM1G60lqXS5biKzNev1amCP3HOo3LORuyLk UYXVsVMbdnHCypOBfHarfzCabxUcSmI= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=lEtqmrwI; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835757; a=rsa-sha256; cv=none; b=JYcS5znn39tX4z7sRdvOwisqe/oL4SqsxjdABO+z7QjBwe9QKMHLpmcNoGDnc6MClw9+9W sliHN8TmSwz7pmD/7+4SiRm/yLBlEZt+iQdtDk6fycomYRxac0/qA/s2zslGLgqgVC2X/f HW8MkCeNGFl+w/6n21XbcBmqA6vPeZc= Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-56ffd7d7fedso42552217b3.2 for ; Mon, 26 Jun 2023 20:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835756; x=1690427756; 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=lEtqmrwI3pH1F9NhuLSu+lhrJuJBeaNoc0B/a+jtRpylRNiz6lnVYqwXFylSaxIlSS fal5MuqlLO46M8tgspmd3hSeZZQkHzVCiF/enKflZ1M3hEbA15QMn0yHyWiDxK+YUgaZ GWFcNw4Uez0C21+p6DRUZFT6brtk9p0VoxgHF26jewVOVnyhkSQ3DRQfrpXYXTkzJvdt UKT9r8byFkYtRNMun/mKCKgBDEtBv/scAQyWpgjFy69JlQUU0QN5ljLcHnq80rGO/875 /+CaEkKEPeM1zZ6Ui2wCINBbaXnsdbhwpMR3GV5pLj1s7PximB5Gycu9naEXtrlwl71V d+Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835756; x=1690427756; 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=XkKvZg7+QzjdbcZg6ucW2NSNwNyg7UFYAajYkGYD7xDfbCD+JtCGJ+XOL+UNMArNgJ lQkzKkWMcg07RjwRcaTyR02I/adpYHwhWlIkdMGYBe6MJFGNYn3tQP4AaiEPEcLz1wgj SkSgm60bGQfUvM6+R9A/oxblryOsgHHnR1yhU9m+tIC4SHaP+veDxVbecxBonaSsu4cn x0FfATJIct0M5vRRCcS75d2EEm8lcyv+wqevhMH9ylOC8Ai3NeGjc8fORrpEoPpweCbj XnO7EMYk6TtEMTvGYDK1IPz5IZppe5I3l9BLyDwgM4JvUUF8kL/KwJ7z0D5YVEpC1kER /0mA== X-Gm-Message-State: AC+VfDxSwNnud0BC3uX0v3FdLyirUKIxvwaT/ypF015acj+pkAW1U0wS e7zbTGG8u9u3uY2RsEbQLv8= X-Google-Smtp-Source: ACHHUZ6AsPEMPaYNwMvJ9C/uUytKifTWfNOxJlUh8Y26CFwkBAjPl8zEubY5Kzi6Ted2kFoKwje9oQ== X-Received: by 2002:a0d:e24c:0:b0:56c:fc62:a5a2 with SMTP id l73-20020a0de24c000000b0056cfc62a5a2mr32690358ywe.7.1687835756402; Mon, 26 Jun 2023 20:15:56 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:56 -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 v6 23/33] loongarch: Convert various functions to use ptdescs Date: Mon, 26 Jun 2023 20:14:21 -0700 Message-Id: <20230627031431.29653-24-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 5659D80005 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: wwknfamcg8tfejcspajgcun3wwomj7mq X-HE-Tag: 1687835757-134330 X-HE-Meta: U2FsdGVkX19F776keCMGM5T234dN0MtsaQYX9Dj39iQGKb3jNzw70XXnOypGXJgAwrA9zoJ1UVKk7MK+fI46oq/eoju6C0/qNboVDja50vjCySPtoJIP/I3hPcn3fHDz3VqaKBuM8/D0JC36r0UoFYg/TvLOqNXcFdYQNn0C7OFGPiCTVurGSRB6WVAlNS3MGbKalBZLWz33RiBZRujKzW5GgrPJPZP/nbm//9Dvh2r19w0f6J01Uw6LElHqULq+OQWDMthkIHoCYBfQP+9F2kdIPaDnHkMNmmet4MdI8yVYtqio1ed3bChbBKQkm6h5JCQu42SejwWjG/PlZOtFpw29W7AmUSw9RGSXdk0T4OG4zuKO/sM/vI3eRQinS+ZW5CzOlOznvAjX4kyGTAj82CIyAz9h7zloBmm4xyTtfLaYPJ0KoM3oEKwSE8jqTpm9YqOsrXU7QJeXZBuBiI1NirKZgzqfZKFa36K8mkodJ3mOTYsFaFUEDj3KsBOcTrU0Q80Im2AJblGRaTdP48NdK/Mmcv4bwZW3qR+GwEd9jQ3ynHlkRwi0iYFqCVklxHm2adkGQ0tWe1kZprTw12UnxuLGabsRPLJVvisSsYE592dkDTiU3tFCE8mJjobXHYqjLOuxC03BchkDUejp8oYWV5rmtbFMQ71ock+aZha7ZNxpAiiRl2oaHSPYFbSZjZxvFNtwu8+Fv1/VtX0MxhiUyqLV0XzssUL1OJVJaAYL4+lDKIgIQBQkR7PAOeg/lCD9hTfuZ0L86KSOJNRn061ENX4aM4mvYcWvIIVPbszJCOWN87FwN6MqNH0ITyFBjlUywSJafWzJ/WACnx9tQHAaeyeKOkRdEPHk/t/H2VeePS4iVAbSbTsywYmfhG61ViIos1Cw3iLhKWC/7pjQ8xXp9TOp2iZtsLWJLVTwvzPORh/wf1aIi/NMAKwuVd4OcdFtHty4G+vPyqriHuiL5Tg zCix6U0Y zZt1WZrc9QaSReEpAQYKM7qU3gWFT3iQVycozPvNJk6y4Mql3AFE5Co6XsXSm3DCMOC1puC2PbIoLQm6E/zfULTS8P9CSIYwFqc0aWMzGyQvfflRDNYZIkGnCGTsOO17uMv5fRfoRNLvYTAnQFzps0MJN+Z7/9VUippkYVWGK9cwwCd8wuHKimx3y9cqQ5YLgyGYISuWhed9o5IpNXyCpiQGbpJr5raD6+uzI60FbIuCCx7PGMUiqL6cxmlCNONKEb2AtLl8TG8CW9oNPp+nxKmGlkyDcg4HBiI0e5GKfyK6K36yoKudhbkh1Ct0ZMeOfoFzK22Q4dTglUvQC11/A1VLE5SZ9IMoB9hKXpPxiSSFS+Jtm30rT8yjjv7fxHkPzpzqruKmK4e/VlcfOpPtMGyJ1yhoYUHpP0halQU/mKOlu3WjnDl6ZsX9ei/zTn/lQ6ekK+EpsOpsNC5iAwk2MkjAP0h6L09F08NPK9UQEA0a2i7bBhgucDiMSeWFkcTv9EjZYce1SWFEzqPEEJiLWZyyDQeSM3DTLTrsKfBKdW0WzLHcSsZ47UydHb6iOHEvu3UpoPwzthjTiAMuRRW9QvnMBXvWfN/KUeTBB8eg7xW1akT/ey2jt+ll8WkQBzsecBvijDwMDRaJo6jecDk55K69yo5UI81Zk3Q+L 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 Jun 27 03:14: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: 13293841 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 553B9C25B75 for ; Tue, 27 Jun 2023 03:16:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B92C48E000F; Mon, 26 Jun 2023 23:16:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B1BAB8E0002; Mon, 26 Jun 2023 23:16:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8FA8F8E000F; Mon, 26 Jun 2023 23:16:01 -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 758C18E0002 for ; Mon, 26 Jun 2023 23:16:01 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5771B1204B0 for ; Tue, 27 Jun 2023 03:16:01 +0000 (UTC) X-FDA: 80947063722.14.0F194A0 Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) by imf29.hostedemail.com (Postfix) with ESMTP id 8C6E612000A for ; Tue, 27 Jun 2023 03:15:59 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=HwE9+CZ1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.178 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=1687835759; 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=8bCNyT3C/yltZqmS9Gg0iSZGxJ35Mlu7gE9T1/44ax5nwR3o8grzsipmV64a8OV4UoeOnI Cez8gT+JH67KlCcFJklGMg28Z5kjEBdlEfQl1yE+Z3DZiC0L+t4063x6QQ2o4XWL8+rWwE vOIPwPhcOpEk6x1eEHxIvwckKo6FJLo= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=HwE9+CZ1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835759; a=rsa-sha256; cv=none; b=Uc5mtEXfILwfTpEQiAcbrPQBunMD4WpZcrhwtooPV8eCLNmS5lUIIdqGknMwg9M0tK7z6f K7cepianFXDsJBYGa472u/aMBo1EW2X19XsBJmYCCmcvp87vZL5N09OI/7iRpLJLV0wLgM iK2Q8gWKeg6RPTJS18rPNmB1OAVtSIk= Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-576a9507a9bso36784827b3.1 for ; Mon, 26 Jun 2023 20:15:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835758; x=1690427758; 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=HwE9+CZ1/MplCMi7Dd3y6gsJURyNL7dWtCmym2tEO6RLfYDnkDNvgC79iMqV9euLNn oVO0tEUHDhiP0KRiFP5iP4q3wggvsZxNdlBp3O9pE0RV47pjcEcaBTmVZLvdVziVmkiN gnSeJULzSpSwzOVkoSp8BjrvY4/vuL0/IWrHFgVmjaO0yw1AUh35UrvuuREuQfZ+tpcw 9rFnkC2jafbB81zXFV2qvI6ZqjiQ1IYXHHbUsS7aTvWca4xplkb3IO0wrERoA+osEcaT dwBDuf+P0WX2zQaokYGQLzNk5fMi+yQC6tDn43/lzPeNFLEgDUuF9Wyio0Rv0IcsuBq4 Vk5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835758; x=1690427758; 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=eCseWBvU3Zm+4o8Yurv/7Uhg7EpO9MD9CI/qOIc9pJV0wGxaahVqNVm6xsCVp5klOh jDPUQZSBWfr6lrOuaAsbglEjGkWfLOOXM0tzdoNMboAGCD/alVZHZj6rQashXjOJ1Ne9 N4rbnczmSQQQksjazwBlu5DaiZ8gv3N+9YiBbUyo9w5vvrNCg2/hSt2S789blk46I/LJ bvM5P0KF5nri1X+xXsy/h/z4XqyhfkXng8XSyXDDY3xlVDOwD/PC1pi8jYFuarILbxYr hKl0cjmGxsPZOMUA3Q7aJTBKmArraEn40zVdxGXZrpywQf97BG86NrhVZctKWBCv4Xto rBlA== X-Gm-Message-State: AC+VfDySnm0gDRmpvCTjNbKuGqqpVLWhjoSlFZP2dtRyFcuMNesodI7r QfCKASi6tJC7y8GoestmHPM= X-Google-Smtp-Source: ACHHUZ5t5DVTD+g/5WvyBpKjpLFbmoJ8U0LjdfQz8YgnU+ZmoVAy6rR6pXI+3pmYZp1NNhYIufsQrw== X-Received: by 2002:a0d:e657:0:b0:569:ef2b:e20 with SMTP id p84-20020a0de657000000b00569ef2b0e20mr35915592ywe.23.1687835758576; Mon, 26 Jun 2023 20:15:58 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:58 -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 , Mike Rapoport Subject: [PATCH v6 24/33] m68k: Convert various functions to use ptdescs Date: Mon, 26 Jun 2023 20:14:22 -0700 Message-Id: <20230627031431.29653-25-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 8C6E612000A X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: ts3ddotkbew51x6qkejk5mhjbizqzno7 X-HE-Tag: 1687835759-178944 X-HE-Meta: U2FsdGVkX18yMzCYkHJw76nTqqHDZw1z0anCrJh4BQm13buRsmCMboH1YwYSO1iTbag3OvRvLDv7MSpC6DJVF1C2yffDwWSMaws0e7uyiVgi73BIhFtAW4b59kSZBuriS47PYnsOPaR5gFc+dkf91KXL5/capEsSXFKR0wWlr1VBkUldr0eLniYV0PtXUzCwmkw6sbzM7DNG1Oj2BKPPRuCfg/BE5kQoJ/nirp2oEVkb9BkjAUWO9kmDf+aaHusY+W71pwNv4gAjDd+SP1Ezr6MyNLlpUO+NvAfv5E5EUkxFtEDVEo+9nfj1/V0jf1F0TVKR1luTwGjMd5qPIgenL+AK3+T1zTlvj9zb93LfFOypp4F5aeZfAcMnDF4vGaaLdq88/JTZJ7hzeDcLlarMPZBD+vu5e9j60gsTyT11tIq13SG6eWz8um6UmAII1bZWG1oFF164VNjezy5nA4jvVvEXEATBq2VRFxQrFaTuIwaFjnXYWryG40EyDFGTGWIoTuz8zVDeYVOb7mIy2/Ohx1Q9gytSlpJxnAIB3kGchuEa+tlxh9BWo9wSksjIazQACbxVG5313QkYD+opjR2pTgdd9MFRY9DKiwEnMzgHNirfS0oBkKRQmCIenOXqVQCwZj5VoBf719imSyb3/Ti9jMd2VAfYaHoJNW4r+bOUgrEL55YET6/2Tr5H+Q6eu3d9AqnZLJGUHwQjlVZRKTBlZXnTHRbKNK2Ti6DvCMV6Fs7pOQ6qqd3qc+c+V2DxmCJBELU1Fzt1ZVZhFzoUJJVYiCU/h1yfn2NK0glEG0BSJw6vJHhj51OBq4hp1j2FqhKcmUc7oQCMGY7qdc1p+U9h/xbgo/xGU7C6gw30gCDuVZqZSLdp+3OKOJu0UKwHZQQeyfR9HtDekt94ynE2tm4HjYnickaMEHZw0XA7TFZtvP3q/KJp06uE2yWTr2MYEjidlDcpip7yeH491Z2Xlh7 Wnr/Vwfx uBEUPwqIyEUFq9fISoRbRVdQwPId+k9PM+Dlz7MIQYJfb+w25IBRMOz9uGm10YOx57eraPQWVOfJW13UuAoF2Ff1SFWBJbhmG+7H2h50C/g+a6PaaHzFFViZlZG2JwKaN9PZigJmXDHYyloG9sGKND0H6zn8n76mSjJy+6u+ykeDp+6fGKIeTwM+zg92VJzoU+dSgeldWL3lGUrEe1j7ku2OIR2Sl8CTASrfZi3eNERsbm7eYay7c7O1kOkEBVoCecjeVns/PNTswjZ8cv1FqBR/28pV4SOWhLrRNWCBbAlh00wgaC/BNP2v7d3nts6ZlDGwknR5xfhDr4fPOFgFjpLf0ZwFvzkkKo13sqq6ilriE0oY9XNmgwbdcuv1aNJwPoRh1yurpUG8gGrhU5lk0bNilicd2UEVxvQM5UR9A8C6E+/qIC1gZ7pE9WTkzxJqqYuj1alws9ea5EwIeZPjdQQ1LMF8U4dtiv6UCYTY9nt22gpwUN71gAojZztTgGmyg5NaMNHOSpUeKEJsAIVxrmU2pGotfRspoy3snpGYjan/7Hxa0qnG/sfrDFnx0R0f63MHqGOuMxY4+b9zcxCwhivZDJDlRp6+zbrC+I0ee5p5OJ/KgizievmpLhlkXGgwbLOA0TI9lBMqRHYeKCpRe9vx3JQ== 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 Jun 27 03:14: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: 13293843 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 33E97C001DF for ; Tue, 27 Jun 2023 03:16:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8E608E0010; Mon, 26 Jun 2023 23:16:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D18D88E0002; Mon, 26 Jun 2023 23:16:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B1BA38E0010; Mon, 26 Jun 2023 23:16:03 -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 9CE6D8E0002 for ; Mon, 26 Jun 2023 23:16:03 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 74B6EA087B for ; Tue, 27 Jun 2023 03:16:03 +0000 (UTC) X-FDA: 80947063806.08.7669A92 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) by imf10.hostedemail.com (Postfix) with ESMTP id 9F728C0004 for ; Tue, 27 Jun 2023 03:16:01 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Rm5e85Cx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835761; a=rsa-sha256; cv=none; b=vO2QtQ/7hziUdolcQj4ofJ48td2LB0x4495paXORJwM0zI/pfFaS0Mmkj24X039zpnzDIR I0XCT3d3MDUcg2uJ5uIlV7vTp6HFshyCg77/T0H9KuIkYcYePTSXERDo4/qHLU83R3jisD kMDvY0sE2VVq5cYi/1itVZrw22dOcEk= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Rm5e85Cx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835761; 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=cUBY6hJLJaY4vPDGYMzYp3IiN9wbgz0G74Sna/d7p7TTSc3JxpszkBJUK37DW55yYjguph YTNb35MNJy6V7nyCspiVz4AgiB3mgcjAwOcflBh+HyABkhDqXxtbgdGAEYwJ4u76oqxGca LyIVMjBmdFMFcLdJ0kv/u+5HyBxt1zY= Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-57059626276so44704437b3.3 for ; Mon, 26 Jun 2023 20:16:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835761; x=1690427761; 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=Rm5e85CxLSywqFxegbM92lF42neHfR0fR+lQK4IGVo6rv84p4nUjka/pX4hUXrlpwO WD89hdl3l7+Q82fCWDirVtfl1UdPVGFAIR8Pji+LBlOshyqJG18LS5xzOpOCQe2DamDu jKvOLad62fOFII4Rcx9NR2LrprdDjwL6rx6EBRmhcfI68ty/WxtUVuYaOl3yyA6VAcm8 kllPQdGN+P459ax9lvyxifjF3Qc52jw7EuJ0L5rjpr2rzqsA5k+0IGd/73X59eOaGEjw K+/CutY1Ags92Fdl/Y8Zq5PhNziANc4vxThpN5vTFQCoz8gt8gqyoqM1KvT2g/UvZYfQ zR+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835761; x=1690427761; 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=aErjN7PrUbXSWpClFaWxLRRD2ECiMF8gZhGWMyM8DLSHDUNNGXx0ALjEbKIB9EfvtV ftEBS1npmdRrhtY5dfpjlS8jAEzgZHbHeL9jT/hdxZYfZl+H8WI34pHwDx/sjDmwgGKv wNpx27VN1EUUz3KPtBgzecoGMXl71clu9oBnQgwa5Bby5ycO979lT5HZMCe6DEbVqEIJ wGh26f/Q7lWdUSTcyEwt/NSzOc2kslIaXkMZo5RZlOfsd3P314frd9pZVg0jnVI49Evf P1pg4DiOk6EdpsoSbFp/vDquoIJqi472ms9/FMHdh8ywY910JuAsJdcYZoIUay2T/rzw eRhw== X-Gm-Message-State: AC+VfDxrdaSecjV/8915yihzNxay+2++Puk/apr2xmHlN12jYmCqVXmD 7Bqs6tr9l4vFYvTrDmc/FFI= X-Google-Smtp-Source: ACHHUZ7ohgVca4eugfFM/saLKJ40V7MYdUNGfKx6MOO12TR+JS8tS/aqfK1zXJTwp/W9GOKug+ymcA== X-Received: by 2002:a0d:d8c2:0:b0:565:8c16:a0e1 with SMTP id a185-20020a0dd8c2000000b005658c16a0e1mr39842823ywe.13.1687835760682; Mon, 26 Jun 2023 20:16:00 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:16:00 -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 v6 25/33] mips: Convert various functions to use ptdescs Date: Mon, 26 Jun 2023 20:14:23 -0700 Message-Id: <20230627031431.29653-26-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 9F728C0004 X-Stat-Signature: 7is9zq7shfgpt58gpiypeaeioxrxk8t1 X-HE-Tag: 1687835761-523513 X-HE-Meta: U2FsdGVkX19Mi0EnebukHB8doNN+mvD6PdLGHrT0QOPivBfR5r+YfXRpUF0m2rorVjh9QY/ZAr0UMFbAVGSvQiuzy1jWRnWA41GgCwxPxp6l1MtMOw1IH5mbXCL6evwfH6LEhO4CEZ+DeN2EVBCnHq565eSjnWD93/OrMB02zvJD7evgvvfzhbZc0AfeA1/dGmAeO/0U67Hw15SawhZkP9afjwjjkxlkON9fNm7IjTsVpmOuDcQeez/ZP40Q16eERD/XBBI3yXYdd2dfoZSF5AalM4P+Xz5i0Ivsohc8qI1nVSaqRFiSjHpatInyXJae0OFCifH2e7qQa44I9uEU78TURusNCnfWyitiYkxpjmKWum8llI0p5x3Nx9mWQeot/x/s4DiEpWnoEvlnRLMo5iGft3qhkmBZm+V4dfcjK4wb6+69PAwbVJs7wRHEpriPwqXnOpuzdis6qcrBJHYKT/5NKPh8Qn97qZc7QeUZDKJGJLsHMril5880qJo6Ul9GRUlAWwrlRga3QcYS/5NW1OnYU40syRc5zPMPSgitI8tA1uX5udbzgsyJRg02C78TB7UfXUdJb3HFoF6pzz4+DY/2XIjXzLaaEHUP/UIBSjDahTkisK4Z1FekftK1RqxE88awvafqfO9oS0h2v1/vZE7oSy01qxdvkjHpYrijdTxjlROL1Ex9LPgnLNujuIK7WRDapc1CW3ieINoNXrUktxv29XdnTYphorqtwpi0ZY+Nugho5P6TFb+AVZW3KZiX/5K0Ts38FIngHr6SJ5M3k70El6QD2ge8/SlhuSa9fkXiGb4gyjN4FjeVEWRXlA0fOpSoxXBIQgp82KaJQ4EQ6U6HrcraMFFT54Cp/Y1SJYi6q9pXELX5Yqdf+Pz7RRxD6shzCNsFwNP96evRcwr+53iZIfWuCtWponl3UKeD2kNMs2kS/NruqQ/+0/dqtmbPV4cZU9fYt9+1IqRhgWM 74k0Et30 /+3/ak/raIZkYoaKRzCBCaLw4fekxvD6Gx4AJNE6WFJkaSa0EtAZZL1Sze55du1Wfc50h6D0cEJCHB4L1Jvp9/xnuWAFXg0k1xxQUqz0M0H/QToBgMuW+HWQgk9dhbE4RncN4VO2stXqMUJk5cwCv/exRBaDpUnV7gVfFpdpdqdIdHlg7jKNgciwPECERZtJySa2ktlw+ExVhV1Dtm+z35azGepECsyHhsjJhUJYIyeG/27mYdeunfGY5tpptjPR2sIjp+vJlIn6qvJ2Nnn2CZWDM65Yx1VkCIbw4jIijY9h4+FLbCJ97O1kzc9nq2tFHuxCNOvR267PIiFUdGP7b0z0dO9/1zo/XO0P3BQKr2Pvv/C0Yr4OtOckZm2aZWdB79L9SOcqsXVKx4DtCTZEPZYos/kWjDSFFRbbUp++RQfOS7XPPaqCmc8WrHSvjQKUgLIBykdqHHO5en1EZX/qg6m6ec92xquHM63Gob+TX3RwLuieWZPBAtIaCDxnivuPYZCSTz/lvpDTXK3CAPlbnI+EDmcOH7PXqf39Ld3UVMvVXdbNCWn8rlsIuLGHjQZMasC6vUV5+v4vVC9pshFPr5xtxk+ZXoNIAEz7d3oyq6zVeAlCyqapHM2iOnhv/q1xzIV26/WNMYlxz+AespW1jal++ZTVevvndotev 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 Jun 27 03:14: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: 13293842 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 C2053EB64DC for ; Tue, 27 Jun 2023 03:16:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E05328E0011; Mon, 26 Jun 2023 23:16:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D65168E0002; Mon, 26 Jun 2023 23:16:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB83E8E0011; Mon, 26 Jun 2023 23:16:05 -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 A2CD08E0002 for ; Mon, 26 Jun 2023 23:16:05 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 824751C82C2 for ; Tue, 27 Jun 2023 03:16:05 +0000 (UTC) X-FDA: 80947063890.24.AA61FC4 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by imf05.hostedemail.com (Postfix) with ESMTP id AFB17100006 for ; Tue, 27 Jun 2023 03:16:03 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="pYu/np5E"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835763; 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=VQZCobvstYY2l0sGqZYvI1P1W5V7maVDrdTOsTRxfUfdwmxKL9ubeQaVyILbrdm6b15ODn FWJWUvnGCUbVOxc+uAqcg360YEHcptCClGKv0CJNqDGpY5lfY7RdAvsHhjyla8evCjqQQW KdU5WCF03xYq+vFIbg6zrf3rrmKCvqU= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="pYu/np5E"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835763; a=rsa-sha256; cv=none; b=cdDgqAdiaYIyomIsq5tqHXQz9/mIuFxz4Esm4olBb6Rl8DMxX699IGjMADR5LEa66BSAss aOo4++sOJrCGgGZ9e+Y4+tdeMPGK/RbG45u4C57CF/IB/CmyJitJYwGIYESBtaGBX42w8e ormAWWwg2Ai/CngKC2Nkllc2KnkCX5w= Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-56ffd7d7fedso42553137b3.2 for ; Mon, 26 Jun 2023 20:16:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835763; x=1690427763; 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=pYu/np5E02v9D4l9kp2NKvJbLly/W4E/pytzpciEjQbyT6+cb3MtewkIWSZ/wCYqXd G1Xr/QkETq+9GbOV2yhW+2wZnwokC/KdlaanhyggpRl1yOJr09K81oiMFpOqkCSKUN1U FaF0VsjnMFKldVgjw5dM4Iy6YMJ/sIWl4pMPKU4lAMjDSOWrwT/y3HEK7DZHkwf96llK iirmdX85Js3ztXjDiHDLqtShs9EXg3guUWkHRosbVKtQGujpNsiEApphQ37yRcHluKce hLpePft/RQblwSLVA6U8/x8zaLVFAB0Ea9ymuNJLOKqGjd9fA49LoIOpslhGIKWxr+Yx skeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835763; x=1690427763; 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=Uywusguq4rfPk5iuTo+1iyU2B1YjL783YWA7Kve51M9JipJEfNksXlj7k1uTwf6xGW Q++czOKDtlc00LI95pjNVgpNlZnf7vMi9JPWoNSb6YYJAonhIBBd7Iy1XDSC5OQpzTvt nZjVBFow75eRipaOghJXV9gCfswPAptzyM0cxNKurk4zTBbTO+i50z8Y53N8HNvoucJv DaUJe/3lWoiWZ+4iKDr6sk5we5vrySJk8t0eqK4umNJjBTjfiEEMs1YfYL/pDUmLyutG 7srZMIzz1TdKXorhLvYS3bDzW/G+2jkclOIBeUUEYCJm/jObEInLYuNEwCumP0V+5OWy ddZw== X-Gm-Message-State: AC+VfDwE19mpa3X6hRAYn5l1Z20LSOfMTz0IMLCgEL6cxXFptFh7UgQp 17A4KndqoZ/rPL8KHNk+qx8= X-Google-Smtp-Source: ACHHUZ4sbsRgQIL7xgoFeCT8hAtH3rltXvvkgvi4T0uDEBiqb265+aHLns97dzgLS2JgA0bF/wvN3w== X-Received: by 2002:a0d:ddc5:0:b0:576:8a5a:87e5 with SMTP id g188-20020a0dddc5000000b005768a5a87e5mr10382513ywe.26.1687835762791; Mon, 26 Jun 2023 20:16:02 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:16:02 -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 v6 26/33] nios2: Convert __pte_free_tlb() to use ptdescs Date: Mon, 26 Jun 2023 20:14:24 -0700 Message-Id: <20230627031431.29653-27-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: AFB17100006 X-Stat-Signature: 91s88re6z61h3jdahkafhk8cwy6odyac X-HE-Tag: 1687835763-120393 X-HE-Meta: U2FsdGVkX1+JcCi6jcbmFpwlNQVCTr5+uhmY06JJNkI2qa7U3Z82Nk/3yqv3ocj7mJ6GmB8cvTzHsLKDJkrtlBLRtWXgzrJ+Ukg/RHuBo4OTTJwqUOcsjYP/SLf6T43WAM6UTiumkbV9qxNeftqvM+oMu/UaX35WGm3tjmlIWJXl+FTW/i8cpshsMGBNL4zOqQuPYVcTgM1+5rDRXFpQJocwsOoofO8pTBkpMNDYNAwXd7N43Zm+GYtjE9Fl4ZxpNnUvS4uhz5EK5jJOkIJIFeSRBSGwAym5sWUmpZXbB9G09IUMKmA285kN00kcZDdB/TICUI/6QFQuW8qM/Ywk63oGheAQqQypg9dHQm4NJG81Rd1+BJQJ5+qu3+3s730uie738RESesys2DyR5+l/qb7DvfAOTO0lOwCX7ctq3++sTX+ybs9jg5X6NzGv1VaT+quxDD+nbgLwKqD7CQrr+/lPSQbEqlQItNdc6hYRlwlOTHWvxoJiZzDDBlVeqBNTa/o9I4unjkLxaLMufcQ/SrVoLwQzkDi7e6iE2p+ECH6AdogTAAv0Ualzi4vg5nBSSziqJv3G5dYW15VCo+G6Rm1vc4A1aTJsKrSkppG9gitT1tj2B/RAhQUST8OU5LLWTXRwceJdXLhck2gQ+21S1Y29VTaK0OuUtKzYWPAA2fcySxczfV1149Z69K+IaFZbad4+2NxZ8mOAjYL4D1/qeevEPqEXOi0RrIU6ZgFniRE5lebZf7HZKxCZshzhVn2AFP6R7oVa0WKneHXk/8SK/zJ8/kRi0Q+BOLm7+S+C3EKOX+fielz4j8ZLqac1MkAb9aPbzgA4mIfGS/iVHPZ8frNKApeXJeCJwl26ecdFLIHtSeyiamm8oxic0gtF9NK8UGwMzpuiHl+Ej2szdJWXQE7JCfYX2RuNkdm3AL1f1jwxOX/Oh27UFh/TJZJtWjfTNzSGvC5H/fauY4nJPqb uJa9XNSb DB/VvdvTeIKAjms8178dEaOWTOXIBQuHTjuv/PtutuosMhd+rfTMFQRrdO7HsWCdAALnz7p/EAiE0lrWBGCdJUr/J9WU5N6A7pxJCPxt2TBAVJvadbfriGDHhvLFsMRjT9BHCiEuJyiBG83CAqXMrHTw4dftteoiac0TuW8dFBmfSfIstmEIcClS3CRfk6pSPPs7LExF6cNl2iYes2F1ggBrjAT+ZcGLlWCYh0hwVr/1eNs54FaZ7PRaX49jZF8PPd2NApXXIty9nzLWGfRD1poh6MhK93x2ntGwdlXYeSlLi0GWMIneQoEcYJElghsc/7GczmL/Lm5qT7tU8jYSXobrEaGx6xoZhFyNBw7hHIGEWpqxOXimTFoqPA2mcu9nDet1Q/TBg4giCK8Toy2af0EWN+ydpnPpXm9e8qQQ8r6ZlcO45bMP71eQwLKIMIVPnpnabeBYujh7scSlsKHnFovDhT4NQpu91QxqnLiHYTbzGLWCOMC+pXENbljQYdCGZJrRHUGTEmVTxgAcrMun0MNkuV3cm4Avjii0mUckIW1nxu6JwcNYvVTlibXux2WTj4U50qHsx0QNGmKwPHB2RDagFH3ZDrlDOIUZUpmv0UE98i7gwIX8hW/jp8PTIFrwDTld1QxsqgfcCBv4= 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 Jun 27 03:14: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: 13293844 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 4F078C001B3 for ; Tue, 27 Jun 2023 03:16:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 023198E0012; Mon, 26 Jun 2023 23:16:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EEE128E0002; Mon, 26 Jun 2023 23:16:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF1E68E0012; Mon, 26 Jun 2023 23:16:07 -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 B9E528E0002 for ; Mon, 26 Jun 2023 23:16:07 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9E09AB00CD for ; Tue, 27 Jun 2023 03:16:07 +0000 (UTC) X-FDA: 80947063974.16.155E5BD Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) by imf14.hostedemail.com (Postfix) with ESMTP id D1915100004 for ; Tue, 27 Jun 2023 03:16:05 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=e60Y6sev; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.181 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=1687835765; 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=gc8mEM2ep7b3q1op7HWOhMlaGACyBECx7+b7UlMoI7Tqr/gES6zMu+8FJiOREWH43NnP1N w5I9DKNm+X8xgjeKCBrS7T9ndJsvIqPgUWQROceXHIUE2hP3Yiij64nxQ89T59nhDVSlds vDcuK/VHlCC/1zKGJBARi9Qg3PZyo9g= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=e60Y6sev; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835765; a=rsa-sha256; cv=none; b=WSG8Xyrpurd6Mr4WF2Ujb9ymQaLArzku56uwPWJcBd+7Pv8Y8/rpjJOw7GQvWReuzBODx/ Y6rg9jvBTYppsu03G1UzttHCOBVmp42dykv4nzFVfuhKUw+lW+1ulUP6Q3guHtL4ADs+Px Ja5ookaI9DjtDTq/tF4zDm5KHv0tbRI= Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-573491c4deeso42155287b3.0 for ; Mon, 26 Jun 2023 20:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835765; x=1690427765; 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=e60Y6sevaT4oQ/L5KuHLcNtraCcaqymJSw0Pta6sshcpf6ZZ6QManSmR0ZQpDOB1TG Zv6Fux3N6RAGTYaqlaV6L/vXV7y5TNrp+A8hP8/1TroaBlBjnjU2829v3J+cnc+AhOb5 JN+Np+61YaCNuusYO6cIWgMGGdhyo7H5wD/egNG2vy+zzD2dD0OPETzsjKXbKfq9Y/2e UqWfUGJ07+JZFMPC47CCL6nCuIIVod63+MvhTRgj6G4ml0xqLiHcn4xnMK5EG5kSpCpR IaKEXBQ7G4bgWt8P3QrMWU+dPATv19IcGEhHsTfe2EI7sEKEiwRzexwBCQnzrxDWjBM/ K5Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835765; x=1690427765; 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=lvJKMWJrXLxOf5xBMlrI8mZcwDEH1cGh+5Zucj+cQfkSV6q42gSQiqnRlyPP1wBSmQ XCeQ8JbuPXHmftgH6RsJUw+rX32NRsl2JZxllo9JhCWvFfKwZ1T6Uc4Lrge65t6YtDdM zlKNNhriKieBBCf5NyjY/C7TEZBAAQs7OcPno6E341fEA9REhclgalRbEUvxqZ4N2Vkc aRme7Aklsn55qj/awdMKnMXGG/TejASnKqM1Pe7qZc7on1gk+pSLElW7ARZlbIpKcdn9 dnVuJ+V85nNLVmBrIjcZLI6yjUK7w2n8aRcEIm7JOXSutrZZY3KHPjl7nxbH2pSFhdyU qG/Q== X-Gm-Message-State: AC+VfDxk0Xr+dykyhtnZwOo4CkmZWUQ+78gflzlirNzUCJOPAE8E8yVG iUS3brIGwTwrNWlR7pcg4SM= X-Google-Smtp-Source: ACHHUZ5DGQdkUnjmZtvUypsIHEbjelQEN0sIFmuzviWoifvHBxszYaVoeD06anXcP6T6X+bEflb+Ug== X-Received: by 2002:a0d:fb86:0:b0:573:5071:2a12 with SMTP id l128-20020a0dfb86000000b0057350712a12mr24368068ywf.18.1687835764817; Mon, 26 Jun 2023 20:16:04 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:16: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)" , Mike Rapoport Subject: [PATCH v6 27/33] openrisc: Convert __pte_free_tlb() to use ptdescs Date: Mon, 26 Jun 2023 20:14:25 -0700 Message-Id: <20230627031431.29653-28-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: D1915100004 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: hcbtqbg4zsf3thuo7zyit6m6d3t67pxk X-HE-Tag: 1687835765-43630 X-HE-Meta: U2FsdGVkX18xPHBB0Sm7TXwxrGD0HG2JIuRYrbdPzVOrTDWMi6+CgIWI5T9bAOr14XqRnfWDbc3L0jEZAUPsIU4hubEiHf0W1qxnaNSpVaKg6Dwnu/geHUlXF1iP6n9LyJ4EhtBvb1jFKkS0Yqp67twW09sI85403x9fCiHC4iiTzXLyxFHIfqHTynyUZWFDew29sW+cbfp0W1vQJEJ0moZvVevR3n9RyI6NuH65+6qLxeSH8ESRq1GQYVqJ7XnKFqrbtyKvO69IKdh6P7xG08vFuEdoCAOHO07Pd2YOLvDCXhL9I08S3tqIs3I/R4jmJJAbBsZyUmmNm7yiTDUqUdm2DAjkEGX1Ijw+4uT21srcut8RW4HU1Xn31HpdY0ET0ZysD2GGywt2OFLVFM6p2jt1dJBIvW1J7puKhsJt6iBXN0tG+ogr5ZAGNkZjJjARa0zu/W0g4duMpuxjnhkxLHiOJxo/99svwjj9ELo+lqFIcSODuxdlY2QQuSsUMECPCRj4WCA2+wgZfa/wLvmNXsMG+HJBilPK3Pjf105hrZ4it7KBPC635DsCuwVA4LElsCWpzVyEKuM3Prb9wDE5FL8Gp6n1JDEPkfcJn4lXm2Wd9T12xn8GdhMhrOWjTHcWwEq0cxwSvmam3DKYd1nh/DFywjp0MJSWVkb4bZkzTalXZPYzVyNqmq0QDonU3huMHhX4MPFl+6ghH+/GIcXDvFr8McgF6lWPHn3lxbkqzEDbN9Xexu3+fLCBi8iYR3R8ociTp41Xu0MqWNUBRytMvM9DGQfRKBUH48tnF4BSXCG/ZllewVko4C46ewOOqWrSoe4x4HYvKgZeWzfK025wEgtx2gf0Xd5LtNQeq3sPkmSZz5/HZEtLOlAZnHSjd6b28jJGOBND/zwvuBomxcR2dNEMB3XA6tv26f6Cd5ysDy36wL64EUEvk6CwmscqtzUkCPEx2Bl8AbyejacCw7p NwCxbNun 6fUVKUVkPXLcAnEox6scgljOYI98VZLD9NirCASZcce4vebsCHP1zzkji77M79W2DeToWC9KmKi3/5jCIuhsK6ZGq16ELZB3qZMqhm5JhV3l9Rdsg6wydPkXmROp+AUhCt4p6SSKQL4xqd0nN5jxFsIyMJ86g+bbgpsb21QQXa52n+cLz/YdUwPxryIGjJpODIrXW6dIjaQe1ylAioKmXO1k/kS36oW7Mjcks+J45UqqxzPITIcYjG/UXYd99glsadsryn5A9wcY8wIqqKiNMWfs9EcHEMsls4k2MGnji8NaHHPvneOXY0I/I72Ex9n2HN+MsKQ/UOQ1ChXf8v2995S8lpcJnoy9vMf6hbCM56fmP8xpOnBeM9Yysfb012hMaRRpvA3DwJa0XlZVOiJrzFKI+2nQ9HMRV8vq+V4YPl9V54EOCgc6F6NZh8UW6hFJme3pPldd1L/AMGEjaGP/rzuwnpOdQS/hwzSo7825Nc4pIk/OCdqehzyqmQJePuxCGQeKP7ZDP6d9s4a7tZQJmJ2MVNZsTcH+Kez7hrw5SVZMd59buTQc4/uY3WK/9mdgSXmGzGPlI9gvZTcfuQ5MzS8TWMKez1Sx1JIg7HpU/veFGlyjcvhmRA0Qk+Eq8OFJuRf7AqY9oZjZqBbo= 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 Jun 27 03:14: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: 13293845 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 912F6C0015E for ; Tue, 27 Jun 2023 03:16:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC8738E000A; Mon, 26 Jun 2023 23:16:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E295B8E0002; Mon, 26 Jun 2023 23:16:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA53C8E000A; Mon, 26 Jun 2023 23:16:09 -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 B2FBD8E0002 for ; Mon, 26 Jun 2023 23:16:09 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 957391C82C2 for ; Tue, 27 Jun 2023 03:16:09 +0000 (UTC) X-FDA: 80947064058.02.D038B02 Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) by imf13.hostedemail.com (Postfix) with ESMTP id CDFFA20025 for ; Tue, 27 Jun 2023 03:16:07 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=BTT3Mzd5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835767; 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=0VT4pshsioiI3cvxCaccwxS3QnyiZywL9n+n1KwplTM=; b=BhJb1bT9vrcA2cBjCP2Pi/qk/1yD+Fp+bb8mksUwPHdCROkZiuNe/OvAmCq+DHV1E4N9we GU9GlapyzfGJoRZctfTmlfv5JEkQjEKx6PQitxDS2l4rpGC/OT2UHdfwxrFREilrJRxzms Eh7m6gRn0tMlvw7ZIuNbXujx0XekRI8= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=BTT3Mzd5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835767; a=rsa-sha256; cv=none; b=tarCCzdBvadMnk1UWbji35lnWa3gQ8FFj1WPPJJqUjnmitNP5vv77zJsglvRLM3xZN4rkv VjLx0TBsmTyz1ep0ZESlu/vI96PhdZv2EjWeSOGZWFiomI/976n9RbDhWxFxdoTACpaXNi m16coZgneebX3dVdAKLI4641MQ9gjeM= Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-5704ddda6dfso44579217b3.1 for ; Mon, 26 Jun 2023 20:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835767; x=1690427767; 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=0VT4pshsioiI3cvxCaccwxS3QnyiZywL9n+n1KwplTM=; b=BTT3Mzd5pMJTg1qQFpEMV1yFnXFEE6dhiGZIFIlGfqbhlgUNcX3lP+0Xoq0dD8MFSr RK3vHi5QnyAo7T8lNR0m2sSqGWtPBPRWNiWjHN3rFdDhGGO7T9MFTERmHBgNR4sgVMS+ JUT/NdTfBaBAKs5kycCS3l/TBhEAp+C90btW4rno0I/EAboZKF9q6wEak2gDddjsGCi1 q2GUAru2ftFNSTo28kLQL6bJa4wXILET/IeOTUMnQplkR5BiuM2QbQkizw1eBdbmDbmG 65E54NzNO8/RkUogmqdZk7khZ+p+IpCeUb+CDcGS40pgjK7sLmx4u40SPJ3RJUKs7fxl Kwyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835767; x=1690427767; 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=0VT4pshsioiI3cvxCaccwxS3QnyiZywL9n+n1KwplTM=; b=XTicPymmX/kd36HYRw+mTIpSJS4+Zt7/Z6kJknLjPi6PpbVOYlYSR+lvpTS/TRkbFZ ur9giazNRKhO9ZN3mZmv/0uolINEj2n0btQpg3DalVrCYbCRl9+xfsmKCdWSiQ/fbpQz Vy5qQV26BCjzZA6AyAx0kf/4OCMB91E1OtyDsiciNw7+xzO1olCX4up/jDQV+SFMkZso tjH9ppgn9+7NtL23iE00mI+DfK6EA0q1PIPEk3aWnecL9xM3WaVXD8ZhphVQ4MUILi1t IR+cwwK+NTRRoeLBNE7gUayYYeRljsaduD8FIy48+FxCF1XqePABHbyMJX0SM6VymeAD YTwg== X-Gm-Message-State: AC+VfDzNrbMzCt2e9ClWLr7sG1WThTfXI8lc8ygKo65UlKjHraebWJzl r2VAK2lbHfXDutQo7kLCbi4= X-Google-Smtp-Source: ACHHUZ4rZA4ZO6uIUbBCVKZtf01FpSGP007O6nK+owIo75GKh2wlbCSJx7/xiS4iS/AR11yVX11PjQ== X-Received: by 2002:a81:6d53:0:b0:570:6665:4646 with SMTP id i80-20020a816d53000000b0057066654646mr37647298ywc.1.1687835766960; Mon, 26 Jun 2023 20:16:06 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:16: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)" , Paul Walmsley , Palmer Dabbelt , Mike Rapoport Subject: [PATCH v6 28/33] riscv: Convert alloc_{pmd, pte}_late() to use ptdescs Date: Mon, 26 Jun 2023 20:14:26 -0700 Message-Id: <20230627031431.29653-29-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: pz8im4m69umd8xtri5bdodycaqs8qyyw X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CDFFA20025 X-HE-Tag: 1687835767-669700 X-HE-Meta: U2FsdGVkX19y+Cnx9wDwH1JMS+v+NyDP+XV3Fl8WrvdXD8AGnkkPgB/AaZ5Yp8Gk+5qkeU9KygSEZfk0ej+gcl8VnYLwOesbNLNwLTU7akcRN8P/GY+PmoUYNbaM/WBlnGGVazskYzZOCK/1aPR1cxMvQHu+CCL7OXAQbVeM4x4Boe4jkRUIjNkdhmcqLmIo9rjQ9y/4vl4MyqlghXC4px7OYt3PE9vk+iAftN15jpo+AFOa3FULCDB3ryc8PWoIyV+jugYWP1UhCDmjb7C5bRkxQRUl4eIIZP6daDltfOlE5+JIzSSL//NEzv7++bfWHkKYbYV7QrJs3jvmqiumEVzxB0cuatAyCk/JJ9t8ImhduG/ePvhBCSbe127/xV4jL+dSRQ2s3OUWSIfMnc1SRecsx3sjvpnZvLy2c57Z9GAAymCwgHASOWblgIUlwvtxLqpiJmstqChAor/wDI69N1QrQfhU3hY83/gJrCykF7yfCYHPc8TSzLLyhlq9Zze36c3S+aebs2r/znQBKF+Oi3Zx8CnMbvQLu0KVINXE5BWWFV2KY0Gx3BbLPSGNLSF8XhfouMWHTYEfxMlc8V72yhIDWxkduIFa91sLkg/vGEjGV3lObFrYZ2SN5wtiX5UlfeMlzqwtr3dHNkaTH3o+mPCmAu+iXEL8/ZVLnkelJ71VknDk75jx4bhe70uyXiTS7Fqhsx8/bKmQ2J58oRUdQyPTVDCRzSpdb29FOuLA6/gM7ygxd9Y9gJq1Ti4GlKCqqAuSUpENlaW0zEl2zLXHpVTG13d5QbnFnOSGm+5gJdvmRoktAdmeTEPozF0ad8kVMg/2sNO54eEFoiGie1hjFwQZXqv0l1kZ4YIDVm1No9/RJfunUfpYKF9YOBKfAOTK+jZazmd5aF/Wat1gDxpLbQ4z54MdUv8BbB1wzioyYf8msvPfaQGes0qr+JtPUkl1se5+MM0s1g1t2d9MaFx eYMrafZK vXC0jxdr4j/vkXmHjRP5mGEeTWLiztnIX2ABOm9WbtIBpzabQJ2Jaeo9L9nGmIF7BEZRSqSELKxWF8V9pDtS6xO/A5f3+B0lc3ELzGADAiIldmjyqwWXiprY9MA8YiA1PT/uMR/NYXZe7cOJnhmQPFIAnJ4rfNzpCib3zwYYsmjnbONb6k60hl0RU4RQ9nHh531Fdlbn/kfj1eYiBZayxj4yAEssirL7JS8pA7w4BkbdpMWmMiUl/+i12TNKNdhEpwgWVZzgfnXFYekAznGHZTBsIQzZQ2RNqUWnAVWEzkAiOH+qnX4vVTUJ43LcX8OoEbA8SDEoDubBRU6Ew6oDSFVUY3DHo8kZOGtyM8Qu41/YTbc7JMZwzb9yy5lBMWQ6eVPeYrXSuByPXGk2eA0W9mqLKK/nG+8OB2JKFZdrJfAtbWLYTJzD3pg4cozj+5rUoE3p35saWVWPAtiaw5J7NyV9KmKJ78l3iIps2PfK8ovWE4Ufne1Pns/ct39xL8JK7LX7xa7WnARThLZ0JE6rPsn3nZjiQ6F6Y3PgU/Ix/lM4lL9ukkbabsvqoP0N1OmOy9HVdUm1aLMyhZYYoJnjYfdeVdVwXvvfNNKh09K6QmXCmQEdnGpaRs+0k2s6c14F59DFyyv/y0dYA2cO0V9ic8dD7Gi8p7FPTlavfYqR/+wXaSWJFE1jcBSdN2jqFbGIJhuiEjM8LknR3ewVnb+kaKzK2V9LkMD2s2tytA7PqltMz8ZDcTrDtf+ATlhZfXx+bUIUnsNjL4vQos3M= 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 4b95d8999120..efff9c752fcf 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -354,12 +354,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, @@ -437,12 +435,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 Jun 27 03:14: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: 13293846 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 B830AEB64DC for ; Tue, 27 Jun 2023 03:16:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 837038E0013; Mon, 26 Jun 2023 23:16:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BF448E0002; Mon, 26 Jun 2023 23:16:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 612188E0013; Mon, 26 Jun 2023 23:16:13 -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 455DC8E0002 for ; Mon, 26 Jun 2023 23:16:13 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 11EE11A082E for ; Tue, 27 Jun 2023 03:16:13 +0000 (UTC) X-FDA: 80947064226.21.33403AD Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by imf20.hostedemail.com (Postfix) with ESMTP id 1CD691C0023 for ; Tue, 27 Jun 2023 03:16:09 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=eyYuDUlX; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835770; 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=aC42rwWABf6gZRpo1lmXLesagCXZXwWss5DKNWFAOEGokeJcZoKvVgmRnazTFP/IZ4VexP NdTaXMjuKbpA933YW96YCSHM9RvkPbqWCOwJQNu1itBaHuWABm4T47CP73ZuOThguofi6R WlDdhf8waoz/Sn005QUHppCrV5wYPbI= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=eyYuDUlX; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.170 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=1687835770; a=rsa-sha256; cv=none; b=Vl1F4BFYUVM2aTweWqPbARYbewS21w0/WwOcYUg+7Tk3cO3QsBhDfF1zIbHyyoj1mG/Lcd ytVp3zCyLBUzajf7GcpyWWLTHFv+vdAnTaSQdBgnDYjRsH/z7kJ3DXFvcj6AMuaaMkmeyX vcUzgxVWyq6P7Ssr3sI0stV2EpQsxUw= Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-57045429f76so40113387b3.0 for ; Mon, 26 Jun 2023 20:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835769; x=1690427769; 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=eyYuDUlXPMdgLVymoCPm6l0B5AkMkP0MJVgww2Dc7/3sqQmnGU1ku6H9CU98Kx8HDx 01E8lwPN+qvwNuBvO2TKM7cIgKQ3CJY1x5BttlhhMCAu/eXz9REbxcYgAP/6CQkWy6Cf lQ90mc5ZocMFbyDKOmgQ6JtaRafPtmT5vpmCcu1CHVchruI6mMlKmB0nAjhundO2FScF dwi9LCyq+7qGXz1usN+jVcsXjJuTQQ04p4sKanEFFQJoYolDJUzZRawaXCZwSYL33znl 4r4UGf7Bdp39+qapNSstfbw+OcAirA3yy9mzGZ+ruj3Aqj6H943hd4iO/NnOtCq31XtZ 136A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835769; x=1690427769; 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=YYlHNNR/IGFWCbNP6OUn5EDKJ45T9Jkr5+7NbGcOt+QKIpl95SMwKub+yfKmx1Mf+U zxMGkzVJ5wyZdbyhU76jPoE/K8n0Q+bTAH0PCvrwAhKu//bf4diEKIblOtI5ztw62P/8 2yHmBn9Oqbwc49vW5JI9q7OtSaaMz5EnPYV8+5UR08bzPcMc2u6ayPSWA1FEZqg4ipFu Bmby4rMxORoSpyPzNrFg8yxodC++zGoDNNxd7VfJTjTSkRQknTR7fiGQWqTAvxCl8dJY kWA/6tluohgpjYM0YrKi6+vXsWXOKsJO61bPF3EAozP7YGt1MHh5Z4tOrhtQqQhlZknv yd1g== X-Gm-Message-State: AC+VfDw12xGKtlKY1cJIlnw/vTPg0//5sBuvB2EOHvfSTKGwzTLCXCno QhSoCHP3bOwOS4T+y02Q1fE= X-Google-Smtp-Source: ACHHUZ5BRaD177tE1K+/zidTaxecch2WxFQR5MI/tG/yJGMKk055pAnLHtqYXsbXJZWlLLkzghbGoA== X-Received: by 2002:a81:8684:0:b0:576:e4b6:9272 with SMTP id w126-20020a818684000000b00576e4b69272mr1982237ywf.30.1687835769172; Mon, 26 Jun 2023 20:16:09 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:16: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)" , Yoshinori Sato , Geert Uytterhoeven , John Paul Adrian Glaubitz , Mike Rapoport Subject: [PATCH v6 29/33] sh: Convert pte_free_tlb() to use ptdescs Date: Mon, 26 Jun 2023 20:14:27 -0700 Message-Id: <20230627031431.29653-30-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 1CD691C0023 X-Rspam-User: X-Stat-Signature: b7kcf9pcdnqy9pkgqjrrpfiqme7974ax X-Rspamd-Server: rspam01 X-HE-Tag: 1687835769-602481 X-HE-Meta: U2FsdGVkX1/RCbyRn9vYRl6ecGMsdFQ8zOVq6X3+CLFZZwZb7src8Dl7JkzcJOn+GCvaRciwH8jg0wo/N5jeyFkiLNsCw2Bx9z30B2B2sFgGbw82V5M9qSa+aQ4pbcrKVvZpD5+sDwoURSODUm9lrUPSEukoLXEC3DRYww0CE6PFhnQ2zEnu3PM/1hwGQ33vR/K6u5QOMA555H94bpGo1aJNUsQZXreTFxyuxvBPSgt56fQ97jBqhtubw3rSWHoj9QQIh66QZQh+mJJzyfuMVXXHKC/lc+4EJz1DnUOqBF/MfO1nI+HXx0JrNnDkcKwnWiNxy0eFgEj2FqNylsU/WepJK6a5v3aUdw6Xv4AcDsP6w7mnPmQFB/RPRBKMzIiEP63hd06f8AjrpM5nk41Ip5feFN0wjGA0Uu3C0WdpHj6OqOCKdiGbTSGpH7ODxcEFvPdNxf4Mr8qdsW8RKCUFRDSezxaiwh6E5JwB6SodtpmGYdF6faJrKpr/LgGzlsZJgWmvCrhTLJSP4nbVSXRMGkE7JR4E89s3k3+PNqSBfEgPCm/X9ldpVz+AeX/rqEaZQ3UK96+MbgnP27pRjQXD3v3H7FFwTpdRvuNxryNbtGX93eGBtgMbRJKEUVc0yVOIX9YwRyhESRt+koOsECG+M3kx1orY81OIJGRtKCs17IOHpQ3AZaqhN11a0AK//0fVHtRwxLKXoeWZrEjzNCldur3tzsuqyNDWtYIyUVoXWfWZdStFg9SK3CLHqv+u/DbNtcXdZUAUifEsdWvb1z9HwrSI9QuOxI9ZMlT1bkUVAako3WTHJ88ya3MCxcPEEq39km9SiedlAZl0wbuSlGHr5cUS1igqBlg0qEvNlWvPyqmyHLUnZOo5g4Y9nD7UsA02AezoiciwhVCqfZtcDwr6Tz+TwsDHY3CUoA0cewW7ufeeddvShJ7TyL0xqSbdwNM2ENUrNLNu8WYzP7krqba e9e1xvJ/ cMclc4r+bmPOyRFGcOYfb65SziZIdv87O9oVFTZyQxKk9Fbt8IwCJ7BTpijRMIL2vwmG6AIZ/UoRw0L/5h82f6jvPvyqQkQLgjtFTO9jb+3jPDs4MRZXagPoauuZbP8y8p5b/kvhY4r2HD7qYON763F+O/lSbYc3W6DRvTDZTErsxudr+Qs9VKTaqCeD/uGq8RLLBSzJVyNeGU5INJoCfiVNVaQRNPXvy/pMlXdPhcCTaim9srjR49pvwEDkr94POW4b3v0a5BqYmucEhWhWMuJM2Jk7dT+d9Ds1XITJe45yupj4tFmAUg74kUqVsmpIF2NqbFQbUccAFfobP9JWdDfztbKEOPCOqVujCgqjX4G9COxSDt0yqkK7OktZYTm4Ph8QPETIIe3HzZyQv/o0j6Nay1esNxwijUpQ0fOLwMusxiJPWP4dAiUWNRTEdab+Gpe8GX7/431ueY48s3SZ1iI14v+AarvjD10k/YGb2YIvga4rMKV+4latMzAt4rY99BIuhe9X93EL9p9YpYGBB1Rj2xWg38Ckik/fKrSZbHRzg28HhExrRO7lBnuYP08FjT4Mkyv3rOC7Lw/CVLqPqmivf2KLEJNyoZrlYQtdjn7PVhWdsWC7QCmVitaEE4F1M/W6MZdfwGCOzMFg= 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) 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 Jun 27 03:14: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: 13293847 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 C8129EB64DD for ; Tue, 27 Jun 2023 03:16:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63CF48E0014; Mon, 26 Jun 2023 23:16:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C4198E0002; Mon, 26 Jun 2023 23:16:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F0DE8E0014; Mon, 26 Jun 2023 23:16: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 23C0F8E0002 for ; Mon, 26 Jun 2023 23:16:14 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F0E38B0013 for ; Tue, 27 Jun 2023 03:16:13 +0000 (UTC) X-FDA: 80947064226.03.D2D0225 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by imf24.hostedemail.com (Postfix) with ESMTP id 38A7A180009 for ; Tue, 27 Jun 2023 03:16:12 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=PChVo0lf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835772; 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=2x+E7/HO6cxS1FKNHsH+YAjV99GeoJ7wX0XOkEEtc8g=; b=oy5AUc1IjjR/KQglndQz9UhRMzRdv5kuRdsDcHja//62l7zxmlW4zyVXZI/2g5ZeY3tJVp q7Uo2+Zu/NzrHY5zVzcRkB3mVFr0FaPmsXV1Zc3Kg1GWqegc/+p05usddLHXEZdLXlfVp6 lEdL6gae4ak+fzABagjBBofL2EiIQ4s= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=PChVo0lf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835772; a=rsa-sha256; cv=none; b=i8Hu1G8oec/KN9gBOM66BgakQtOu63G0S+Yrctp+6lNEP/o/QfzxYh021adnadiPdCG6Ip D0a7Ki8VxHRDTauM/k+KwSl/0WVynaTeu76dakq4aTH6gs6LKEkDkxMweq1JhsUPFE7Ond jGczBUAcEVXyfwkWbCYMnEaimWK1qjY= Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-57026f4bccaso42392307b3.2 for ; Mon, 26 Jun 2023 20:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835771; x=1690427771; 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=2x+E7/HO6cxS1FKNHsH+YAjV99GeoJ7wX0XOkEEtc8g=; b=PChVo0lfe7Am1Juwq3iG7RGGrP0XqVtToprVlSbVPrmyTboyAd49pm1+evSB9B2tFw kXjlu6Q/E8ApcKDqDyfQ8SExeWZmFlXQXipKcu1XJWfNM69YhOWXhf3ISbUTXIBhFgb0 96QCzhEZra+XSmonTSpvrhyWNfhcBtgM1hIeMstisaUf5aqytakahkQIURxFAuMmzadV 6ZXbtsztDtfR61NxP+OmIDHBWYbrG0Ze8ny7+vi6zis0kg+kLkgyVN6ua8e4P9XYJM+O StKP4NZwkZwEtlTvPnxWtxrHSt+7T/pJDNCTHMVfEfjXHYKpAk/tbkRioOk7ft8zrct2 Kzpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835771; x=1690427771; 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=2x+E7/HO6cxS1FKNHsH+YAjV99GeoJ7wX0XOkEEtc8g=; b=KKxfaQErTbFXSX8CwgcPUBsHqmJ07FqqRukLyaoQdJOANJvLDDb3BaaNCSITcGbqqk 9AVOk/QJH39vRNCzowrLGbGoMdEjiSFTYcpyqC6L2wo4R/NSZwrz3vOZSXSvuBDDb2eD gUqk7JKIncIvUa0K9RS5j4XRUzb+5JJH22WhfQCEv7I9gcW6RtaPKxRZyDtu+QXMmE+s 3Hd982O/TaVmnqAM0I8LdTYKtS+2RCBH1Nyf+7O/4ha/bGJshxYLtDKrdT+ISsZoUkSS W+qyvNduroNQSOtuQOlpewWvkXPAnbuaMBFHGd4QwqislOWiUD0imj858e+gZqRo+HDw iTSg== X-Gm-Message-State: AC+VfDx8rylM8zphxEP8CxeBj+kkTM15VypV4/IC9KE+MwbfGlSAMPU1 H5J1WTI/sEK+oxWMhEXBoXs= X-Google-Smtp-Source: ACHHUZ6W45+nYYtPli9FO9SD+YRunw+Uuhdk8hdZzeF/68wsjhLAFg0GoFHHxkB57Ykeq0XvBZGu+Q== X-Received: by 2002:a0d:e293:0:b0:561:d25b:672a with SMTP id l141-20020a0de293000000b00561d25b672amr31395214ywe.21.1687835771352; Mon, 26 Jun 2023 20:16:11 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:16: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)" , "David S. Miller" , Mike Rapoport Subject: [PATCH v6 30/33] sparc64: Convert various functions to use ptdescs Date: Mon, 26 Jun 2023 20:14:28 -0700 Message-Id: <20230627031431.29653-31-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 38A7A180009 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: qmyezm5w5jmqohp1imorhqgfduij8s41 X-HE-Tag: 1687835772-817607 X-HE-Meta: U2FsdGVkX1+hx1Aj1XayN7YyzX1z7GlbeKJAdm3X8yF7O3Wnr/TcOBCBkd1zTHYVBW+wM1uTs2XPWbOTxm0dIRZu/0nZzmGsiE3XdE1wwo5RGiZStszOe/UcUV4MsgkswOBypxCNrAH28NHN46VVq7F4UHjvEib1pcSraHvBXZzevtpw//2VzPAwyddNUikAQRFsWqADLcDgPtX1nvIVo8EsTBccs4JuEy8roFSqvr/+gEvby97fN1QuScmKzEGvr02qMrwYvW7UnByf4GKaW3ESgxNwE+vZzIocoKV63RY0bpg/VHbMrKtdorwc0UNq2jChOY0a4Hb9xSgUNCBVY1DwovmKeqyoMQ9Ukq1KF8zKjVmNRdW3wtebiMUHybU6RLAAZ9adgAzdfHkUpTJ6MI7mBMdPHJWcI1t+saoMuPGNSV1cKoOeGO+6h+P2huNBCcXYwZUP/hYihIUF6fq6C+rWj1ogUBVe+JCi5GKxaCZcpzbr36UnRILv3jWZ3wVbfalMrQsX+kXSTOemZeMCuUeXGgHcsVNmlCrVq3RIpoCD1FHrq+TNgGwCuQbfIdOrdV+HQmsBwGrp/iSIYDEbMlSSDJ+FvRWG/O3pAe0YEVSn4ctIu8u+ktKBqnI2ZVrUjtUsfaUpqMBpoDwIggxnfpjYVm5Tek2u3Gr1axTxoSRjYtVc18MLbcfxPnW1B0sjnhRPmBwa5C34MJPFB1hMBhcSJ2FpoODwcwmqnX4//xdC6DwYB1QE+RwDJ3wQNbEFKlCLmtmw/loEf99xqwqr4YuaN4C2pJmPMztyZPIUu+0FTBgAKclMwni3LhOnVkW/k5xfwHJzfS6ckbn6yn21q4E8sWI/quX8iFLHW/uVzB9V0SUkSqNOBRS20701DBmyySPjwo8n5rTiH+RcE6JK7GUd75EHomxL2xOS7WPIkCPEmwxgFCARXScb0OEcMF6dWQcEMazhRp9bpOgNaYY pFHSrtuy 6MmzT6vKDpnPrFpEsfODCnKHbkgLXmvsAdoxK4rmBxBGFFEKJUuW6cpOll+hQKBEELF9rr7y4aZLF9gnxAHJdWfe6aaIbz8gJIe/xJLwZx2St96VZUrIX8dZaD2wO2yxv2+IjH1OSG14keHzpBZjOcljEMcMYxtr4phdB5prfsZXa9psWXbEAhBWra5ZImh8SFohbdb4r3zCcsn20DjVor208d2FDoOYt3OrcAJgOjfv5hOu5iX3UgY6RmHoDiFqwvsxjK6dIKg47uXTG+zD6Oz8lVBOGiF/keK6dXGkdyTFxUqAEGI4Opw6wY/tEcRdHKCwR5O4QUPPrqJe2muQ/ylCYK5LF1bveF0C+crvCb1XFycIjyrqiv5q3+lGCJ0zURVhCNO+vBHS6Qiq/SQhJFxhlSDTOjorGSeIRGYL+GaO0LljIjg6vEGwUhyK+yuH3fN0+x+qfV+ptjM86XWQQt9qqUadUfSrCfdmGFmp7M8KUL3+3PLnONiP7/HHItcYT/ADbkengjBbcT3CUgmkwVpm0uT1RY60+ETMv68v5IGDeCzFaZacqb7E8v7KUGckWsFOxnM9EvMbS3Ey6xypw84IWXw== 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 04f9db0c3111..105915cd2eee 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 Jun 27 03:14: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: 13293848 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 C01D4EB64DC for ; Tue, 27 Jun 2023 03:16:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 970938E0015; Mon, 26 Jun 2023 23:16:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F8A78E0002; Mon, 26 Jun 2023 23:16:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 724268E0015; Mon, 26 Jun 2023 23:16:16 -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 57F4A8E0002 for ; Mon, 26 Jun 2023 23:16:16 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 39E771C8734 for ; Tue, 27 Jun 2023 03:16:16 +0000 (UTC) X-FDA: 80947064352.18.5D9D1B4 Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by imf23.hostedemail.com (Postfix) with ESMTP id 713E9140016 for ; Tue, 27 Jun 2023 03:16:14 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dLHeJwfX; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.177 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=1687835774; a=rsa-sha256; cv=none; b=4eRtl3+znnygGRwrrJ+scPFUIzW4jGfBtowxNk2s0TnLtxn8HEIWkdPkpX4AdsGnQaUOEV +loo6YYAruxd9ir/ISksUMcJdfzZKq81qlT+/hG4ncqT79C7tAp0BntLsqkpnXvJJXGlUm E5KGDEVDIwLBKA9PDNMflovn54A5Pao= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dLHeJwfX; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835774; 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=5kaYCwqGdbpk22jUjnY9LqRC2DNDwpuaBiMWAYd4YyoFy18sa+2qULUaU3OhQT1HSg9OGw fneIF0poYUYpPhYbsPc1DhbRa1oPDDvMbNn8rZhfa7614iQNh8oaWqlI8GacxEpFzofuIS jzga5OzTrw4J+i0sXAbLpgVzw9h9fa4= Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-5707b429540so62188027b3.1 for ; Mon, 26 Jun 2023 20:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835773; x=1690427773; 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=dLHeJwfXKaTxpO4c0sQBm93zd4wQrUxFt2CjFz5qWQ7T65DNPYbc5uKxnR+eK0IL7t R2V9BA+60dIzn1DRHNiAM8OyrAJAml6DoS1l2PV4PYnoH4WUW9ywNy9TDf3yz7ME+vFq NLGTD2cyLj0S/PJY2GAWd4utoHoRGPP+jS/tnomFzM8g/lVPns4ABJt0M6rzW8rsiL9B m29bDYcQGdb38WDxMbx9Hk40CYhBq3UtQSCa5gjYXZKOF2lc/8CEcIQNZ6Wo9PGTUZtN IYAVdG9F0aChBdAkISeJXlJPZbPB7Nf1GhV5RWEzzuTieYJGBF1MgcwOgT5miNq4avun mLuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835773; x=1690427773; 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=XnSmxW9DANV7mJ+ou3ZHQ6i2Yjv0IRsEO4BUXS1b2ObuPzAhjo18SYtpYZuNzesB++ jRyN2vKWx1d320G/qzEA9UM//YKtKe54VHnBmiapogyDWBQU1zSxKoyL2aQdKc8xXaqK OHZxF0XtiiX3txbYW/q5Vi7dWwljXDlmzi9IkNQr0kzDOH8fLF2d08hhR2mfvpoqNqCg IzHybOrfzz3sZ/8ixBc1ntf9XwAeVhFudm+6VhboSpWqdA7UocPUf1SoIo6v9dA2sY5a idDkKcL+x3MOy3pK9g5QOWyqxXV1enufz9I4/e/ppMfNEVj2V0RBISBHB0cj/s46pTYt us3g== X-Gm-Message-State: AC+VfDwBFukpOiGz98fZs2czS3vBRg5HlpW3GVl7eY76M0USnm1/FUgf tWC7onSnK1s5nOOCsuJycqg= X-Google-Smtp-Source: ACHHUZ7mviCb8EMix7g2GoIipUtqwtEpnZ4nIwFH1XOniyUWELa3iqb5sNl3hiYnjR+jSDWsaWi7Kw== X-Received: by 2002:a0d:cbcb:0:b0:56c:e5a3:3e09 with SMTP id n194-20020a0dcbcb000000b0056ce5a33e09mr43279069ywd.15.1687835773500; Mon, 26 Jun 2023 20:16:13 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:16:13 -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 v6 31/33] sparc: Convert pgtable_pte_page_{ctor, dtor}() to ptdesc equivalents Date: Mon, 26 Jun 2023 20:14:29 -0700 Message-Id: <20230627031431.29653-32-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 713E9140016 X-Stat-Signature: df5d3mdxwejrzrtk9i3f3g6rr734dmbo X-Rspam-User: X-HE-Tag: 1687835774-13346 X-HE-Meta: U2FsdGVkX18dgIlrzquuH5aV/qaipuLfTlK0us8LCmwHgifKhVQ8IXWy3vqeTYIpTxdJNBAZ+w5nBD1za+zQONlgwsStE5CTx/sGOrg0c43n+8uaIVhjmfgVq0ob9c5c8VD6pWf5oqxxtEkeYLIlX+35Wb2gNUXyFkO9WLLO6qb7ZKl47IxhxqeYApxXmiLp+sQ/0TysDohdJkZweqRvuwSf9WMXAU9+cIbQj88UMuXx5BGKsxevZK9xB1rjhNgkUVfdGqZYItt7LrGut7EbfO0oOb20goa+YBgONfESAjoEFXj9AUXEWwAc/IavMkgVYToD1tkuf9vfb79nke7hgdKo0q7zQi/JrSM0vc+4EVRT0nxYsHEgxS7XLa07KpvDLahI4PNwxDYbBvsOVQIdyOjU+LgDGEkwMwPcbf93TURWM8Y6PQxoD2+3fjBZps+VAXU4tX4CzXiTNEfnomo8optSk4mNTBECCJd5rnrAUx4VToCvD0xaEHR4XhJDnlrVHr9JKu82IRg7D9C1njQjTjH7wKCy6l2Tings14dTRsJR3G/I44j5ZabYTpOoRjW0CwWMaZQFU12UUlKZj51zIIh0yMNYAlR3ffDOptOfl6Sl02Ug7Yrhq1pORvjNaKGKF0CqVciP6wvVnnEI10gKapSlhosQDGLgCYyTIvcIAbLd0Ig9UoUHo88lJuIu3zEt+6bYJIvMNZqNH9avn3QlQpyok8osTnmyZH9aCcXX2SPe8j05n7hHPttPxPkgFwQfgcfqz0qg/mMxFMEPhfvgPPwcEIeHCq3mlqJ+wmW84arN6P2Qz2TRynC9nmWFiud6bg/fmqUdPMHaZAwfWAhDrd4skXY9Ygop+33adL66wqJNMW4UsW63P5npvneHMOLog0wEVljVBo9+YRjTFoSbxua0/5SwtAsP53oNOUMOXtjORh5bH21Ccxnu9Gmn/iz6Q0dNXrHW5mZR2g8Nfca oNro1KZG s5N6NPDhidIB3sTYVb1MBcSUzkE3b75NWKSqezf72B5IvALkcI36GTvZUal4o49H31J02MjnW3pEwV0+HC/R5PN4QX3UhSiJ3ORi65kyKZ5FhnGgkEw5riPPI0GKd5Aym/Yx/mqCjTjf8g9M+Ukb5X23P6dfabZczOZYuWsXPTSwqTHJylDMvil7n6PxgiA7uf37Rlg8907Eb8tZ/u6Xp7r+S3FwhjYjueOFyJBe8pZEX+V0F4c3Evp8qDZKw24NN8hdUZvY8HRuNvnp1ooeZa4t31l8C0igfdDgwZZNRvo6YF+7QCW5/sZ3GB4y74SuaYd0ChTiAQC8LeUHguVlcQya3sDU9emA2DNOOBW19I0+yAio1FR16I6gIQyAPXQZZhzZiQ0o6a+mO7F3lyvU2z1GP7sCEnPIbhaMvg37s7JCckjHTnUo2hDcoXLu+J4gAI7wAVjnNXK+8dTQhqewcIc/7CwjGQRQDhD+4mOP4uUnDYXJY23Ybb0DL3R5Y+FhuwXISCHkYUKcPg+uoiG5JrzFOgRjtHM99QlWl62A1jOCNf1kFpSEwsL1CET4tXi00mLKrWL6nV0HILnTWG184lzhdIZ2NarMRBM5KI5mixqJGCEWsZPhUDJaanDGYrx2cj95wPaWVz/PSso6gYCeOiyzoiIsKDSqrfhhc37e7fJYcZIQA9XP/PUvcQzLJHq2LCLWMVwRpjM6UaBVWuFg1UayvZQ== 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 Jun 27 03:14: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: 13293849 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 484FAC001B3 for ; Tue, 27 Jun 2023 03:16:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8FAD28E0016; Mon, 26 Jun 2023 23:16:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85C0C8E0002; Mon, 26 Jun 2023 23:16:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 688A78E0016; Mon, 26 Jun 2023 23:16:18 -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 4D5308E0002 for ; Mon, 26 Jun 2023 23:16:18 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 28A441204B7 for ; Tue, 27 Jun 2023 03:16:18 +0000 (UTC) X-FDA: 80947064436.11.556A38C Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) by imf19.hostedemail.com (Postfix) with ESMTP id 5BD651A0004 for ; Tue, 27 Jun 2023 03:16:16 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Gr8f3MEz; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835776; a=rsa-sha256; cv=none; b=8faufWJULmyZX8TOye11yyM30XxoHLRZj5fDjLWOAarlHX+BUlu5ZyHltp2D3dChGmIKRw yY4FmQNeMU7pKiqLog388Kc/XBohBTql6Hy0JziiAp7fOEulpczve/spOk1mDjUOQrgLdW BIQG10RbN8jfuujB22E9jA2c0P02YPQ= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Gr8f3MEz; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835776; 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=NoYI9Oj1KMXzci4Iy1edUacyH6UNMIZYDI2C4YifJ6Qbh2RIyVNZaa2DZn5sZPYcr/d5yU fenfrBfwkugLFKai0ZuL1WdrxjDPtAxxUSmby4OXCwX/s5e+cMNN6eA6w2K5maklx9AXXq 1R2ES0JNWdc0hm4tdJdBX3qZuHqtGRw= Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-57023c9be80so39992257b3.3 for ; Mon, 26 Jun 2023 20:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835775; x=1690427775; 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=Gr8f3MEz3obvDl9KABhIuO70HTBkoFbuWEeimu9z4yQhoBxpIMzXHt4/zQiD/35FR2 Rou/oVuLMNuircs5Aw55ugfL83e83sFrRKh4nGjfNUBrs0Ns51CypHUWM+aHwKiIGCB4 bDbKAJJc6ueglTVv6Zd/8VvPqPuBRwfoUXOaXnwyPF0zCFc73NfT/c9Q8XEzBzPYIVow QBI9GU/YA6Md8J3UGn6Xw0CXbMe3aYnpOaLZmcH+kLxI6o4K+ynL8B23lQ0U//mVHlcw WbYitL1St1RrPY9jH0d0TpkVmHfz+e14q0Nl7+sag9AUsUOnDCmyHqhFNRZORMjuCsmz kdWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835775; x=1690427775; 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=YSfBYgVG+aG++0W8cM5D964AenaePjubHG8WlGcl9Ll2x66I9G8h2zGpAez+o9udCu IgJfcX1TQhJKI+RCXjtDbaiW3PM+w0szSm6+VKEJhwWW4XaR3uv0E3KwzfiHXW8QIQe2 QJcfMSJikI3T45reODU55xkn+5t853LGEU48vQB0ViM2A07QIVELTMI37s2gp8d1sxor ggD+3IkQkBRZJoUBkvt+gZBZYZX3T0wzDGHJ6Zel4X8N1N+MLORnlux9+/INv7bsskwX eCCBMdAVxuWMAA5qwkeu8C62kaAY42S1BU6W2Vqfpv1MiFM5F3TvCtZONQqYbz1bE7Kf LUZA== X-Gm-Message-State: AC+VfDwgfYZzIVsdweNsyzdztS9RLzuAlqFc1fKaqAiDSZNo8BPKcluN SO2nWGOYw5QasxNAMvcSp14= X-Google-Smtp-Source: ACHHUZ4XU3sOm1xs9Jcr5rbSZbAjZaSOolmfhgi2qcsz6PmREIffAwTevHZjKc/Hdw6V5zHvfavIAw== X-Received: by 2002:a0d:cd46:0:b0:576:7902:f4dd with SMTP id p67-20020a0dcd46000000b005767902f4ddmr12132465ywd.47.1687835775530; Mon, 26 Jun 2023 20:16:15 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.16.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:16:15 -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 v6 32/33] um: Convert {pmd, pte}_free_tlb() to use ptdescs Date: Mon, 26 Jun 2023 20:14:30 -0700 Message-Id: <20230627031431.29653-33-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 5BD651A0004 X-Stat-Signature: d3phzpe4o3rq1f3yiipg8sm7hg6iater X-Rspam-User: X-HE-Tag: 1687835776-72842 X-HE-Meta: U2FsdGVkX19M8rWvy/X0+3sia2xk4maZzXNNdlP7H9zsYY3RUk4sagH37nuIwZkCqDSvXlaL6qtfXnbQshrWWJAfstcbhhvZV+4nqO0eaNvz4LNbFDbJAvMMHUhfUE+gEkG5VguK81q3YikxCiaIGyVkD+uqpc38mC42OOG8OQPwPsXYEoFrwx6T62BvMudJjNNpPhR7PN583HSJZOPFVYr5Hi+0j3XykPUE4EqxbsDO3YSGuNzk3SYqqulJ2rqXxUfiehEHqahxepvfsHE6RHleoCQ2Df6LwE1ViP3kpRsh929HBE9mZAXuEvModqYOYaS0iFIDIXR7aFdf9F/gzEOXHecDdMYV+hvhjo5Tegon1jQFkLqrwiyvF2GVxWr+pyDdxwG6Yv9zEqGho1ROTl9JZ2UZJ1Wa5IiL9Ktw0zoYtOeTxYTXv29cW6ltRILZgN1rZ2SnyA+RphkPRkXAOGpTaOGlVIb4BjBjgxog0lwh6IVE8hB1fPagDr/y7lagVmVCqnieSYWgAoPUlqIQxhP5uskWi0uj5Q7vfWofDlfF7S9aR7gSsq/4WPPMASmhotfKipTsZ7Wq0vDKsdJ39bjW6jrRITuoPiLH1lO5xEvpOGYugaTv2Aj84SB/PVraesfrt6WKLrGzxAkiryLhCLiUb+7XV3MfZwkM5NVsoQiRnIlOVGmDifQRTPTgcPp2Y1tm+gr2SK3fmZWDyaDeXBp4KKM+O50SiTcHLvyqmXnM7HDYDpiK1Yz84w9TT28246vuB5JPirxNBfdXIKbw9yDi2h9Dield1KP/x77ljvoXJZub0ITSBMJIZH+wMS9viu0XsBE4GT2QeSlXpqs1+bpLE8rqY479UvHJqJDshxToZYVKXRDz8tCAvn7JGsbWLanTQCiWZNWGooR0Q+npmjizM/IsPU8jlPS17W+w6XZOYcAI8KomnKh0ooiS1l7wJLfR6snLV0fYcj6zLFy vZXwWuT0 wZ1RCwzdoKd/c4QBMsU82p0k/yf/xTSjTs6QSVXLgYDR29ijF4DBLdrLoiMNzctIJgMnbGFGPIHB1SoNlyY/1/+bDHbOItyXdglUSmemTT9ksGMAiEKRTkGSA5GmDALb6u3jEHdK0VuSPBp7F+6cHWUCfubGr8kQTvkEjAj98WzkrpHi5CwuhDwdLtLEs4JdtkcS94sXvyJMDBgsBLRrafk9Z6RJ27LmsGM/eb7Hb0HlI9mR/D+qs6p1i2ciiU6t4jOz+i3E8BaOiK4UutHKLh1c2Pwh8IsP6MJ2R7LHaDpeaL6qjm+SEj0NL8hpBB2dD+iiNMA0lQM9lLfyYA0G/B/A/Eus00gIgtu7Rkv6y6yINJU/6izy8I/rNvaULex/W55KwmotyRTagLDuuGsa9bqxeC1wssNoHwKrCy8DVCxjuZ7S/j/KTC2TOujWYNhVNDWa0FN/Y3tMtlpK7ifGryvU31o6ePWzHZbUWIUylIp9HCzU1KoTr/8CDyxi+Xo69ROER+EnXHUZlNYfweeUd9OGnoWLkZhPnti9+uOS7NuUXoDpS/gLsGw3cJTCz9+sUpcCcOwqCsDcl9uL5dUC9euUr4bZR1iWudY1Oa8oSBq3x3GJMmzkqJOCuxZWGyIv1upF5zbnOrsnOJxUO08n20iC0XBjXDuukEG+k+VNnzcbdq6D9tUdBqGqbvFzCUuOtap7KhS0NXiYsc8A3r1ili9fSFQ== 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 Jun 27 03:14:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293850 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 14E30C001DF for ; Tue, 27 Jun 2023 03:16:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B9C18D000B; Mon, 26 Jun 2023 23:16:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 241D78D0007; Mon, 26 Jun 2023 23:16:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06D8B8D000B; Mon, 26 Jun 2023 23:16:20 -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 E289B8D0007 for ; Mon, 26 Jun 2023 23:16:20 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A7FACC0248 for ; Tue, 27 Jun 2023 03:16:20 +0000 (UTC) X-FDA: 80947064520.24.577915C Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) by imf04.hostedemail.com (Postfix) with ESMTP id B78D640016 for ; Tue, 27 Jun 2023 03:16:18 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Bw6j1qqb; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835778; 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=UurGuuLzED1CKQ5+YtAa+uldlNlkULcrhOlEPtYgkts=; b=N1sjFIQwMmItHU3ym65ff1jf8pQAIe9YuX33whn+Kvur6EFruoDH0GVRQPfLqRVSpFRNe8 XPn1PRIjEKNZ1mT6h26hCSRp8to7v3r1tgyqDLJiKXWiT6nEwd1MqFvKh7YxgO8mZEBepR FfKWfePR47nmTdCdqMcpnsEd4HCscXM= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Bw6j1qqb; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835778; a=rsa-sha256; cv=none; b=wY5SuxMS7liQPyUNelSQCqTcQbF+y5d07sU2EMrB6yfGJxBWESSThbzh2dT+a+6Ifa5XH6 M+rTEeFNkH7ZjGXUVEqLPtRTZs4sCJnB1RYsUtQTLVS9K7fKez/wwK5ncI1wWnb4h+yoBq ULzQx8W/6C6o7cmWks2+F5eJW2K20wA= Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-57059626276so44706987b3.3 for ; Mon, 26 Jun 2023 20:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835778; x=1690427778; 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=UurGuuLzED1CKQ5+YtAa+uldlNlkULcrhOlEPtYgkts=; b=Bw6j1qqbA7rK2Dm84VNEOP66RtUUiWxR5Sye2bW+eq3uYQIAY2EgG1iwdb2DLJnhG8 GeCT0K/ZwJIKUih4HIgcFRg+mw1EU/RmQtL9RCws+bBmnGeSgMwKEqV8Sq7OOh2ekNKy KxZzPsUUwTKcYY2uR69y6/3CJ/yQh13J76r7SLJTov+ctRLrvX63ZMz8HGYd0YBMtxPR d4bJ4wdUGuyrpgX3PWgY/0ePtHqJFHhYHpUgd8NRua4eh9nOB+MqmDgdNijgrl/iljgo W4AbA6WKPV5xVJmow0GDfY5w1hM9Ipzkd6LQ2xSzFc3wc9cyZI8JF3nhcsteILote3wU 0FOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835778; x=1690427778; 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=UurGuuLzED1CKQ5+YtAa+uldlNlkULcrhOlEPtYgkts=; b=IyC1sP2stI2+hWxMyG/eKRkNsOs4aujc/GIh2awsQNKx6qLEvpchGkoHD4+i8uvM+b SajNDg6U/7tjQUmn/zkWuSybOhGMwm9QXP0EKU8wQiojTnEtAiVSAINTQXdZuCIaEkZx a8K8BZp3bbEzBI7hBjuRPy2xbgJCOQVjOIHKCEYWaE/Wyt7uGZCCcgmJX5wsmfzUPets XH/tWOleZtvz/LmTe9NPLwD+ZexMdJvgG6JN6jC8BAnskUHLEqHEhuqPF2QiMaE4KU2Z voh9g4JiJGgtp68QScCBLGHrl6JJg+lK0xPCay0hISRUb6DSwJYznBscqmZ7Tngg1Sv0 3Bsg== X-Gm-Message-State: AC+VfDyjWjq4lCsSBOOaSbv2GDKG4ywMUJfX0jBnnWA03FwKBUb48mRT 8Whvhsw7JAs2vD9r012GMAw= X-Google-Smtp-Source: ACHHUZ48cJY/DPvk+Kk12K3DwipJ5tKtap76NQbk/m6+l8TYs0OHWXs1Miee1fTjpWtp4A4P8vJjEA== X-Received: by 2002:a81:4e88:0:b0:565:ba4b:aa81 with SMTP id c130-20020a814e88000000b00565ba4baa81mr32811368ywb.45.1687835777737; Mon, 26 Jun 2023 20:16:17 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:16:17 -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 v6 33/33] mm: Remove pgtable_{pmd, pte}_page_{ctor, dtor}() wrappers Date: Mon, 26 Jun 2023 20:14:31 -0700 Message-Id: <20230627031431.29653-34-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B78D640016 X-Rspam-User: X-Stat-Signature: gme97czgt9su7jecbhixts9xyy98h9gz X-Rspamd-Server: rspam01 X-HE-Tag: 1687835778-304481 X-HE-Meta: U2FsdGVkX19B3wNkzrkDkHz4kJ8vHXl61O8meSJlDb2+CuREbIg8r24OtV48VaUwL1hE70fWiucBlMVmbfxQLWvi1i9az1uUc9z5gCwont5nm5Ilk403qwQWYE/iED3MHZzg0I7Cam7+CrDGSri85GdVfmVgGWinMv6QKFh9pktunnRb+27YtdwcWfGKaP0SwKVV06nDAj++J/CutYZYqGPtg5rTnLm/OktPIv0h3SEwYxXyaSwOT/JD8dnoWFuzvalEMxJQQutmW8lu+QwvKQhjDTBggw1ilIyIzjmtXY1ME3UxIdUq+djLEFWoQsz/OaFSROMrzH2eHnS1HMbG/X0MC5QvItGfRUAmSGlWTrK2He63T20JMB41eRgXo1DP0kWQemuLiTpnnnYN4UwlH1beOkxkxM5RbQ0XNk2NdtPoK4BIUjqIux2yAHmQya35fwQLXgHHsKJF0O8ORad9xE/qqrO8+NXXTtprchqX+EZQThixhcleFPQZHKzce6zB5ryqW6F9HLa9UlATrqn003BAyjv2J1IDlbtWdS+lu3ft1VrK1o1PCXJqgEzEcDca6camek6ga5uxj0kPU+HgfuA0FrbNmJjhXvRVDPfpWguXQjPdlxSjA5/y/ibJrpJ+F6XSfP55CRNSTfayloxpHZbqSBDc+O0r5FGB1H6ChErwozGailLv+Yqw3CvgRGMziMt21O6haaJhiBtYV7Cp5t7K3Cx257Dk2virYRa51U9ZYMyiUyUVsCEUdb+raO377vboZCSMHVVXL1VkfFX6Cu3T+J07gxNG1LAd5OAGviDWMxoICUTCn3r8ksXwnDJo1vkggBRkspuHX0Oeg++f8dog0VYACKZHKbqp8solKP8MnWwZruieVWSLWoJEAH6zOIqQjwO/s8pLYLkE5zUjk1V5gRxGqkQNaEQc6sgOQzfHSbmkA2A6YcLSJRJk1q11en/vcypFcMaHY0udan+ dluQB3PN NNt88bYsUZTjX1/6vZnbs629jE7VXtmBKLIXQr9+huxVDZafnppDKLHST1BkhMG9NjdzJ5rd/Nbbdm8YkbHdZalb6O5pW0B8nr1Jo0r3rQRh9hsVsgaFwV6GHamZ5Q0HLxmL3i8gRTYd0TWXPs+J1dKzvRuIjoMp36bPE1Vg1T42ox2j2Tklm/NV84AIDvZfxIgSALRnlff904rDfuYAHf7n8ZLsn0CkP5i7C6D+gJI89bRZ67C2CHtiw4GU1x/y9yRlitsPhATQC9slPCU9ltmZE46/bmJ3gEy6TkducXksar1fVLND3sTMYZApjPkzz6YZQruWZwV0fL9/wi9xN2hkPXmBRCSgMOZvNdgJUxIcMvXFPqf8A36r7foJ/6ym+R1AwPpFbgpnbh9IQfVVL8iuIOuXC651D5u5fB5uLrMOpoNf2T7Lk6X0AQpQE3lJlfwXrMuICjZVWjHhaMs1HHpVhSQUfjvJasH4WqYNfT0XckpDUW41hCTuOafaBJjYCrUUcnTTrEkCbTjnJTJKme8nvDFz9Lp9T2mGdF3KjAzsRQs4NL/7M+7i17kB3SSzD4uKXI2pDM7Mqn3thgXwAY4tzDt+kn0eaHqnV7HDIHAkUQX+cSX/g+amqmnPaFKW9R1HNd4bhjmJeiEk= 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 0e4d5f6d10e5..dc0f19f35424 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2873,11 +2873,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); @@ -2887,11 +2882,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) { @@ -2993,11 +2983,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); @@ -3007,11 +2992,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