From patchwork Thu Jun 22 20:57: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: 13289598 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 31F75C0015E for ; Thu, 22 Jun 2023 20:58:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 945CC8D0003; Thu, 22 Jun 2023 16:58:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F5528D0001; Thu, 22 Jun 2023 16:58:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76E698D0003; Thu, 22 Jun 2023 16:58:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6734B8D0001 for ; Thu, 22 Jun 2023 16:58:01 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 27B57140151 for ; Thu, 22 Jun 2023 20:58:01 +0000 (UTC) X-FDA: 80931595962.25.5F2A656 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by imf25.hostedemail.com (Postfix) with ESMTP id 2FD3FA0019 for ; Thu, 22 Jun 2023 20:57:58 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=oWqJsihW; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467479; 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=p+K+BAjyaHZMH3vmxo425Wa3yTcdAoDbrQhvQwlgHde0+H0zGPlPXvFo4W6VZx7w+sAQGU 52FBpwlKSD7WU1lP2pTGKT9QvgaFGKMoJPO1V68dJYLDJFrJHWJZEGYE9oAc0SvnolCZQB dKfM12W9UMcq1f0geyXuBBa01lGqiQA= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=oWqJsihW; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467479; a=rsa-sha256; cv=none; b=xmLybzwap4g7BOd89VInHA2P3+z5iaS00zMLpQ+7f7lTTu3YeXpeD/Bkk5d8SON+ahthG+ jHxNENvOc+6Eyz1Hu8jWP4YDdeEXY7pVb2FRMPVC2UXCY2A+/xO5geGs6eigKurIVMh9XU mSfXGmmaIexpgVQAGRXVZuFo8c2Qwcg= Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-bacf685150cso7078606276.3 for ; Thu, 22 Jun 2023 13:57:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467478; x=1690059478; 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=oWqJsihW3Mww2gXtWCx6NN1vPsnSmScA0KqTPfHOB2L1LHk/oZiCduo6ehbRGsj3u1 3K4TZcf4ipLxkr2vI99P6IIjGRev7x1HMuDNE81bxWMzhRU6uyioFzTZTsBBM3X8iluN tBK6Y8stl1G/1qCE5N0GQ3Qa+8Pmm+N03Nm44USTvnLt7V5LvALEjdohUoDqU7kxuZLt IgowLw0bUJXUmFP7v8RMzC0EWbABefmvZCJB+fh5ayxmmTYy0RtnueLq29qEPJSsxOpa bu8Ei1mTrJukofeSyNP/F3QTQ4sGlZhg7IWdEGo85alo6ycJggU6oX8hiEo/eX8VwR76 IyqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467478; x=1690059478; 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=aRglHiNbw12NQC0QKHKhw48OeY/JDqYAC8LbUuNffPHmnoCatSNooy0gYSg+lbN3ui lCl0WeDdSpA05KHfCRN5g79utrAxJu4nPHxXdCWADaOf8BmeihwPtqLR9rsJAESJzEl5 siQf9ImgobHfOdfEO0OlKmwGf7kSpYKXPcQO+1m/EUJt0olyGPIocrZ218qMl0ZuF3Ae SIAHegw3lgytXKZ7hBjFiYfugctmgLtCKgGn18SAgk9fPX9JAuwi/vQ8ONZJmZM9guqe G0f7OcdhMyZkeOLg5l3dE+JdpZeUmL9cdRHH4v0d3k+uq2920EGJv1V3OgjAxUzq11yM Af6w== X-Gm-Message-State: AC+VfDxb0aVeQdg8lrF/j/9exthELRY178c2PsIgelvgd9QQ13XHhprE kJioZDSlV/Io7tqlkAdqTRc= X-Google-Smtp-Source: ACHHUZ6Iv2PzBVPKZ2hNXXGWhZAWkMVnsSNpndVsfJ1BDlCBJeA25OFgV2XyKC6amBhVDhSuupua4g== X-Received: by 2002:a25:2fce:0:b0:bac:2a78:aaa7 with SMTP id v197-20020a252fce000000b00bac2a78aaa7mr16148309ybv.54.1687467478063; Thu, 22 Jun 2023 13:57:58 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.57.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:57:57 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH v5 01/33] mm: Add PAGE_TYPE_OP folio functions Date: Thu, 22 Jun 2023 13:57:13 -0700 Message-Id: <20230622205745.79707-2-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2FD3FA0019 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: wtt976xc41x3iajh3dmwgcepp9c67t5i X-HE-Tag: 1687467478-28624 X-HE-Meta: U2FsdGVkX198UIpddRi9wUUQ8Ky5cyqIOIXDvP5Ar1wgMOcqabCsO1YBcdhFhwHte76hlXmSH7eZrn0Szce+8/boF0BkzMbNfOcHnS/JEWbo2fvwMpOnvApZQ5pIPet4Q00QyX/NrYnHLutq+u3NvUqXFoQ2czeI308oW2mj+Ah6q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m+GS/tfkJcNvFN+VM0ez6Gwa+aoXcrvFms8+4i3QFvIUq87v64RmTU1dOHhL8pxooIP1AuCNYSYFp2oEzNViRB8tUBQytY6eXYgTq/Xj0B2FSEZKgsoNkuIJogD8pUaDBvRVycnIlRAR6tJaePs0MXIQ9r+TRf+a80vkv58NFOgwJ9y09nrA8Zc7QRPFOq4NcBi3YV/wFdoSxG+n+vOIgaQGESDyp9bSMK+lndYpd8oampsLQ9dr8DQZ/P1F2fs6psU9Zr8tlSPcteHb5mIpsXrSP91FePCHOfUCLd7YCnswXSEbaXRxuV06lWXbqYpQsgX8HyMngrsXErgaOWcc5bmLfzl5L1mpGw7nZoTX826W3cNl9SsLY= 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 Thu Jun 22 20:57: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: 13289599 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 0B9D1EB64DA for ; Thu, 22 Jun 2023 20:58:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A306F8D0005; Thu, 22 Jun 2023 16:58:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9B9128D0001; Thu, 22 Jun 2023 16:58:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 770928D0005; Thu, 22 Jun 2023 16:58:03 -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 6A1568D0001 for ; Thu, 22 Jun 2023 16:58:03 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2D6C7A0A9B for ; Thu, 22 Jun 2023 20:58:03 +0000 (UTC) X-FDA: 80931596046.12.CFF513C Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf11.hostedemail.com (Postfix) with ESMTP id 48EAD4001B for ; Thu, 22 Jun 2023 20:58:01 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KRYiTPa+; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467481; 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=Fuzy7xTGTRFZY8wXDnE3og7Q7+Ar/MFI+Lyni5M0mslzDvmuADUvKou+1Axn1AMyx/kcFC K8AMNY4kiQDNHeaVVNv8gOh5U/rm/oT3HqUOoqIieMOz0trVhv2mn2PKD1FjHqdzeLLJ5D oFUpMGJCa7nGalQEbNSEv4QeyNJiB+A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467481; a=rsa-sha256; cv=none; b=DIgmCwwoQxDNvnvrZSo+/O+WxpVoRL0vEvS+OcKlBwUz2qisttjwjhNbxEqToUMxizrZnI rqgXamUCAYYduMmGEYxkyJ7OSg046PnpYyfJkuksyt/KG0ax29KaJ3oSPYTpUnRiX2vEuC YZ+SRaSzYiq1NsAFwIZ/DODbrD9COrA= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KRYiTPa+; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-bc9782291f5so7432464276.1 for ; Thu, 22 Jun 2023 13:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467480; x=1690059480; 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=KRYiTPa+c/tVoaJ+3dZS4cLOTSKca+/tfUQ3JeDVu73GmVqps7KdsafFOLBranRl3o XGASS552wrkc4i7AyqYqkBS9E2bGfVs6VaJjrSMpB6+h2kA8qTrBwdwXD7HZ0uPFkzEr mLs6bk2eo4sPlhjHz+uOvvGYISwwAmtTPhHFgzUAnDvPaqWpwBhojPMOt6opGt2D5oKC XNigZkqZiwfc5pQLxvwb1NwMN92RSQp6HSUhvqRpXqhTQWx6SqvyrTdy9r4JKWSpMkwF TX6dYagRDEjvQLY6rwycjttvIBm56ezZgGtKTQaL+AAx6Np6Okl1PvSd6YP7qp9YxIbi 4K0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467480; x=1690059480; 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=TBzQDIy4j7q+JKs2H+2M9UPvQ3oCiHrzSXC17otvagvuGJtAUawcSAgMkTEcgfsf1/ 7uQmg3gheH5PfzED6AstOmvqQX+FqNjrNR+m/Sm6bJYI7f2k21VDnKt92sgeWzVvxmZ3 IRqdYGSnc15E5A0o4pzieV97z0jHDkZkO7AiXXb0vVdKeuUl8aLioqIfrmYDu3B4hUuC BX1IOGW+mt33yTLKrqCdwmTwE+r1sqXD0ujFkn/1pGxAvOCF9+CZ2tKUelli8IIxUnKj 2Tes0kD0jOvRGRlizagPlIahfCQd/ABotv4JR+huyDQ6ZksOJgszoYbEtA3Wb25f3f8Z Wwog== X-Gm-Message-State: AC+VfDxB2HXG6TIx/hH2Ijga3mk0+HQcPutcrRtlb+jfQbRzeOtEvE11 RyGGXjaDgMOitA1n0WZPSgY= X-Google-Smtp-Source: ACHHUZ72azbPgEnM10h3+Uy/lBMVdF9iS4rECO6ri/LhbP9GjX2972eBvU9RVBJ95UxDdXiOiTNdYA== X-Received: by 2002:a25:ada2:0:b0:ba7:b933:9063 with SMTP id z34-20020a25ada2000000b00ba7b9339063mr17587509ybi.4.1687467480239; Thu, 22 Jun 2023 13:58:00 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:57:59 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , David Hildenbrand , Claudio Imbrenda , Mike Rapoport Subject: [PATCH v5 02/33] s390: Use _pt_s390_gaddr for gmap address tracking Date: Thu, 22 Jun 2023 13:57:14 -0700 Message-Id: <20230622205745.79707-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: 5euh5pnf7jh87dqpo1jfcewuu9m3g7h4 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 48EAD4001B X-Rspam-User: X-HE-Tag: 1687467481-740959 X-HE-Meta: U2FsdGVkX18E2lRn103LM9ALL22JFSserMDS6vi9/ahEA+mqsuwdFJZucuoGqLvQI3LclW+ffdqJfAvJucNE49jC/x6TAc6br03RqEieLp7KtBQNsEG3ODpLP/Coln3b84noUgU0+Ddv+W42OXvbgBMaCBJXA/8PW51p2bqiMbUueQxFg25CpaWfMjFF2MWphFEc/rsu0TF5oiMni2bjUPJnUqNQwqn+rNCDVk/mPTh6sQK+oKotCKf7STOUeOqBMTutOcL0UjwGmWdELjk89H+5f++4nVZd1GiNbJloVKM9aaylXjkz90v3kLe0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q8Aqn9PSuSFuXnykxYQJ+o5P5YMca15MLgH4lGLBDQwHzJ5OS2YsQ+3n7AJA3axX4bgB2N4JvVfVp5D/y780mV70TmY4LYcQfb/4IgAeguTEx6FjAcWBlVttYHrYQgOIv9rbRur/lLIMlwud1NEC4NzzNHMYOVIr9Idn321LDNr7Erx1X6ZrXsh5eTTsy+a0Jd+j6aKEX/kVFHiE1+OY5Up55CjLYvfzYEEpD0iNVR3w7/MnTlIhxcCfFjk8qUx1/SF+oasA= 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 Thu Jun 22 20:57: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: 13289600 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 26E91EB64DC for ; Thu, 22 Jun 2023 20:58:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B68E98D0006; Thu, 22 Jun 2023 16:58:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B18ED8D0001; Thu, 22 Jun 2023 16:58:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 859CF8D0006; Thu, 22 Jun 2023 16:58:05 -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 773088D0001 for ; Thu, 22 Jun 2023 16:58:05 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3CA6D140151 for ; Thu, 22 Jun 2023 20:58:05 +0000 (UTC) X-FDA: 80931596130.22.AB8FA79 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) by imf01.hostedemail.com (Postfix) with ESMTP id 69FDC4001A for ; Thu, 22 Jun 2023 20:58:03 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pU1rNku+; spf=pass (imf01.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=1687467483; 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=ISCF0EoL2+dOXGl/co4T/8nL9MZo/swzituaeX6cBZlT1WQBgCzrEWT8+ZdJwrkqjv/Yz0 SxVtcvhlLjgfFuEEzoCQVOnV+eiGgx4tde3gRggs5BINMnzdj3PCtPUMp6ifynIwr2HOw1 MiLydbZ38UzZaDmSccM30D2FoC4cDf8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467483; a=rsa-sha256; cv=none; b=58hDg7SpnqhXkycFrKktf+BY03kFmWg3B7qeLgJ7sr1AOEy4tga6hR1B6sXPU6d4IPQBE4 q31XGZkjCAed7N8P5C2yiVy7L09MkjTuvW1ng34Vm4XmYWkAPHervBa8Z+oCn7DaoFELNi +H8UYnyaMxckxg+pEZq271vN/bDzq9s= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pU1rNku+; spf=pass (imf01.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-561b7729a12so16637457b3.1 for ; Thu, 22 Jun 2023 13:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467482; x=1690059482; 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=pU1rNku+EwfuvvAUFkFumH3vBy2yB8eY8b9rmQMddlJoc9QhOnRcokyjWDtIUPPy9P MyE7phtpnefNxvysKqFF1dCChREaY4VAw7Hj9WJFlZFrzpk6eifBId3wubz0Vyh/S2pn 8/Y3zkVGHHKKYxzZzu8HCxLQTltPQvJHitS9QsbrsAUgPjueiuuK933isxWF/RQdLHvt zcy+Qct09qmvfH+KRctZzkT+vvZGDQDyiysBgsbHpUxND18HRJm9vVFEK6S0KHOtgU7u IRCWYGiDuX3Hydg/OjrZHIGz2lGmohOF8cCd3deLunhE1oH3PJ2GTuP2PJzlmW5OQRrp EAKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467482; x=1690059482; 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=f5Tgo4sYfQ7vXGAMJj54YCSCUnJKYJEQb1yv0xoAk7QudPYtS8K9DWqeMtDzPaRbzX jKLs0Zc2Rs64AJoj9iV0CTOpPMehyYbsm0065tOQgvhsaShXN41+VpxUH8r5vGAaHXxN RXjHeMZQ24y4XW1sC15z1TyjS6h3rzv/VyoMtJ/2dDlwhpCxLet/sZH2xviJI8fmpqs4 I5T6osK5nxtDSl+hcEdWC1TXYwLTqjOUEu1jS+ks3Skoh7x/KZEmU43z8GYNcW/YlzlO GoIor514eAq5CM0bJ5CYswYqLJOwZ6Mazz9Y4yKPLRLC20TS+s6rSjAhfzTJk50tdY7B E3UQ== X-Gm-Message-State: AC+VfDxcXnh8jtxd2DF71X5/r5rQK2UehLY6lc5Zb2bBle7L6nDOyPMf OLZii0mpSf0Y9V/F8TJ7ToE= X-Google-Smtp-Source: ACHHUZ77fWcfFpcqNU9K3kqcEPsqSpbWa/fmZ/3pFZFyzvd1rtc51te7WicHxIwYc2YzOzHNnZEaEA== X-Received: by 2002:a25:2f85:0:b0:bd5:eeb4:55be with SMTP id v127-20020a252f85000000b00bd5eeb455bemr19092596ybv.0.1687467482307; Thu, 22 Jun 2023 13:58:02 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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 Subject: [PATCH v5 03/33] pgtable: Create struct ptdesc Date: Thu, 22 Jun 2023 13:57:15 -0700 Message-Id: <20230622205745.79707-4-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 69FDC4001A X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: p7hzfqbiqk7t39c4b6pr1o7dsoya5ye3 X-HE-Tag: 1687467483-651804 X-HE-Meta: U2FsdGVkX18tliEjxYpvTWG+YhRldy0XObB3Fvo6JF0KN+A7SoyfxkmU9fdC0fFoLcRAPz/DvpxOr46Hs415EWz0D/G0bbogVSkseyC0+VcGVlmDcZN6QUBQgMDOpswQHPc7suKMLqipGVhvkb+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HciTkAHFtdTHtAg0g/mLU9l1gCoXELEg9fCtZjDc5Ea4BW8DO57RX3EcY6NVvBBU6/B97uuJ+fBLiRz/Wy+vZ6gGk21ylAcLo57f805Y52hNDNw/TBjwlgpjaPvH9YTGX092eFHZu4QCZ8pbdzQvlZQEQ1qMFBqWIGQl/1NW+4mJ3bU05Wd22ZscBrVT7vwIEf2igIoZ8DU89unGmrGxB5xePXhKZybb19trohzsEems4yoOH2Tt7eg3qYt0hOPdvNjRwuO8hrBYfqfdxHQu8PMbpyoQwJRu8TJRnvPYfIrkvbBfDqMqc4LlWndFOiGdnnCXU4aFx0h82Kw6Zr4okOuijit4XDtz3+Fx/i+vGW1Ogdy6Pc0g== 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 Thu Jun 22 20:57: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: 13289601 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 643AEC001DC for ; Thu, 22 Jun 2023 20:58:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E28738D0007; Thu, 22 Jun 2023 16:58:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB1F08D0001; Thu, 22 Jun 2023 16:58:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2AD98D0007; Thu, 22 Jun 2023 16:58:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B607C8D0001 for ; Thu, 22 Jun 2023 16:58:07 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8617DC0269 for ; Thu, 22 Jun 2023 20:58:07 +0000 (UTC) X-FDA: 80931596214.01.19AC616 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf26.hostedemail.com (Postfix) with ESMTP id A9DCD140018 for ; Thu, 22 Jun 2023 20:58:05 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ZxYyU7k2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467485; 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=t7yX2f4jncBYedhHf7/G4jWlyZzYvrDJt2Zgf35zjhkDwnuEnoFDlBEmIsrvhbxUY9IBGl UiXjlgXiU3ZHQaeZJ1iMG1oB89RYkDrx3HVz90mJZDzmzNLMfCYKtGzXOEdGf1YVsZy316 J1b+pshBf/xYK35YqSDl6GGfY2GREM4= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ZxYyU7k2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467485; a=rsa-sha256; cv=none; b=4M33lJP/7+gCYgIfZRg5e1u0iNasMXOvORtcS8tUK1IUii51hGu/uEABkk9Mc/ByTRWmXG j0ylBmJRtxVEyZ1iD1bVDaguMZ3QfZZQTdeco53SR4yzF6KUnsH9OEQUHTXRc0Q19opH1r mtxT6ZTHP9lZLpK1Qn4WyqzDCdVqFpQ= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-bf5f41a87ceso4111578276.1 for ; Thu, 22 Jun 2023 13:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467484; x=1690059484; 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=ZxYyU7k2vGalXaPVFbsAoA3LfcjeLDhIOlxkMUoxB7wD5DzRvEzQGJZMJxTOPdFAYE GF8H8J3v3pIjRre3uBFGoQhrehz40XLVdSwrbVpckO4S1lcUeENHrNTK6kfLjGoHYzvr nhXtSSc9VaEE/j5fCXHdi35T0qtxrEHQkX2kvNCXyGYBu1DiUkeGGXiy91rFgYuyJidG yhM8UfJ79m5utnGApQW/CB4uav8Cyl/ViwcY0GfzkowvqJFo3jCDUp7w3xYorcQhuQVB Ccqw/rMENg5s9Xp75lULxIZiDzj7mDSoiTj8XYlqSon7icuirfeluYeOq+6o64D11tV3 SMqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467484; x=1690059484; 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=W8OM6hIECoRnshLMHpNlHxkZE1UT95UtZfeIzMmT6rSRa8LHGW5nyLCzm/S1S7XdFY j0zOZ3AEeJsNtLi2Hk10uiLQ7/p/457CgRYmdLHQI/IG+eDMl6cqN782EM9aAowumIzu 6GQ5VfZfHrF4sfZgcK0nd/wM4msfu8LsYu66cGEBc9xQfR7jdU7NhWrU3f+O9PQAiUum iKh2m6A6MJj+c3HbPWMmvz/8o0QoSMizRl6X33ZrIVfPOpZ/IuQiw+xBmJebIm0InhK0 pYB2B8sn8CN6+cg+jquGieFMvN1vPJMo+L4Ayav1zSLUYC8tKZQqHifDQJAFMJ+Iu46B h2mQ== X-Gm-Message-State: AC+VfDw2jfwijfpGP78dC6YillPg9CnotQEm/iwTXGm9RcoVdbE6wtjJ PnWAcb72kae2pe8uOx4wnWA= X-Google-Smtp-Source: ACHHUZ5hnxQ163/uFnii7yUzhLCvlKkxDndNuqoPVJ1DEXuk1sFzA/lJHmZOgLxy0t1IuUHDUPN6qA== X-Received: by 2002:a25:df84:0:b0:bcc:f2cc:73e with SMTP id w126-20020a25df84000000b00bccf2cc073emr16743014ybg.22.1687467484442; Thu, 22 Jun 2023 13:58:04 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" Subject: [PATCH v5 04/33] mm: add utility functions for ptdesc Date: Thu, 22 Jun 2023 13:57:16 -0700 Message-Id: <20230622205745.79707-5-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: z6d5krqcbjy5tcobwi44uena41mbshwk X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A9DCD140018 X-HE-Tag: 1687467485-746752 X-HE-Meta: U2FsdGVkX19AfAbIjlgth/361fR5ctoiUHI3KP8UepvhkIuHppsHAad0pC98DBlPF5Tz0bmsJpROEju+BCMRYPaho+GC6rJgL+NghjFpCmAYzYax2nbLPCHc5NUE89EryRt4ApQ24m/oh9m3vxe7vKGX+N3H8MOCXllWdmiuVUJuBGGIAZqUQ/g6seDxFZHSdzVPEBrBo82O1vwjvp5wCt5n1/T1n/X2Z/ydVkC6Q1IuiiLwh6psWJWcax0SUUoJ1bfLU5QvaVZAu8PBD24OakmQPaxUm93FsEYt72DQo67YznXEMSGN6q377clajI4yS0PMBd0KF7aGpppUwre3KK+yEDifTIwXcL9ax/GvL2eOtB122zB/UIiwQFYfWfxt9RY4R3klqX9/R2f/KZZSHoASZu22zInj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fOGlADyuEcqb82DqIj2r0J2wgxwGDg== 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 Thu Jun 22 20:57: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: 13289602 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 7B21AEB64DD for ; Thu, 22 Jun 2023 20:58:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17E158D0008; Thu, 22 Jun 2023 16:58:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12E5F8D0001; Thu, 22 Jun 2023 16:58:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F37268D0008; Thu, 22 Jun 2023 16:58:09 -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 E43FA8D0001 for ; Thu, 22 Jun 2023 16:58:09 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B26E01A0234 for ; Thu, 22 Jun 2023 20:58:09 +0000 (UTC) X-FDA: 80931596298.19.460766F Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) by imf15.hostedemail.com (Postfix) with ESMTP id BEA45A001C for ; Thu, 22 Jun 2023 20:58:07 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UdIEW49a; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.51 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467487; a=rsa-sha256; cv=none; b=Be4wBD9tvoPp5grtVjdJBJlgvh3kdPJY1tlcsfLscyx067vZgzuMjBooFUHEjbhcZAmC3b 9aWmizkxehhkEKTM0xtpydZ9P/VU5gDH23zv3Grpsit/okigYP+mMUCMYw1obatvv1OrSe YgrFUxoA+jN/PngsCF5Bsgh9PskrD/I= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UdIEW49a; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.51 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=1687467487; 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=P2qjxBiu3vraGRg3SIdzn25QUgv4P6tQg/QNd5dWVUfcqucDmKpmVImku7Fw1v9Z4QmjFB Ji+0TsFDCNIlAUviEcThSTa4IPMEwGZ+XFhqIJZbeE/9O2lbWwFaucPubEsB2YhFPIoI3w OEdcomkQ2adOjsfuGvKBrHgAZxc1ZpA= Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-6b5d57d7db9so1630321a34.3 for ; Thu, 22 Jun 2023 13:58:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467487; x=1690059487; 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=UdIEW49a6VlVFdeDO40XUMIhkzu0TZbzMPBM/WacFFYU0Mf2IMmAOz+NL1cV98Ton4 4zQ7N3mgDzFH/zAeyyuA7dsXAtz6L9a3ryBLZR0keuhq84g9s5CyaVK84D28lhUtpY1k n1Pbrc0aBtOd2I2lssPU62Gn+t4FuAK2YSMld5ItzYd2Gb7upO15jx4dCKR0ZoMoveD4 fYCQ1IFYfK8OlRQ+gZ/yAiK4LxmWYPlg8lrZ4XnMaYZEtLSmgFLWfXItXcddGU79r9OH 9d/82j8McTJZKyaaoZkqZMldnjmKIChpQ0nH7tpNr90msjJzxK9KTHEvxYDWGujERLdc e96g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467487; x=1690059487; 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=llhS8W+6xLYB7mIJi5hnRa5WsrfjUN7Ybtw9/jQhzHX9qjPjdMpRgXX6dWsegFkBsG 1UE+CFqF0PGMjrOLpTNb5YTX+S0Gq8gwqlDfPBJ3o3y0ZnNS9+d9FwBkd6v82shW1+D5 xA+yeNjsMckVX9tL74PAXsxTzi9ME6on4ITZ7xB35ftg/P0njyratdRBziCeISfW/3dM Rma7KXzBDsSRP4aR0PAYd1GT3pXOKVGdTZ80gaNbFlO9XiXV2oWmvski0Kjl+a/BvxNY 26lsyUPpcKLw6dt568szdSB5btBzLOBInJ7NZDOYfZI20Dv6+s2d8tsEr/2oNFK9/jYo 5QHQ== X-Gm-Message-State: AC+VfDxrkupN1byZr/2EUMZaAM9SUWVg7VLA6AGpgWwqFL8asqCI0vIB dwYta0C2wBhW5X6PYslazGs= X-Google-Smtp-Source: ACHHUZ5msoxCs4WtHFESbyMK1EuaDf4wukFNhVJUOVId63qr2aSW3HXx+zFK0CBZB4PkAluxQSVOjw== X-Received: by 2002:a05:6359:2ea4:b0:12b:e5b1:1c9c with SMTP id rp36-20020a0563592ea400b0012be5b11c9cmr10630381rwb.14.1687467486510; Thu, 22 Jun 2023 13:58:06 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Mike Rapoport Subject: [PATCH v5 05/33] mm: Convert pmd_pgtable_page() to pmd_ptdesc() Date: Thu, 22 Jun 2023 13:57:17 -0700 Message-Id: <20230622205745.79707-6-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: BEA45A001C X-Stat-Signature: spk5rea3jndosz8b68c9u77rwr9iobmt X-HE-Tag: 1687467487-8513 X-HE-Meta: U2FsdGVkX18gROZZRCdIs8/AgrgPVS3H7N3NYQfMvZBZ6tvZJYdcELBcPOTle5ezgwaX2NRW1CqC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6C46cXdlu3vcEnOb8oZxDIe/4EUo/llohllkYK9tFRA+T5lOzFAifiWUS3CUjxM4ohw4hQx5AyyBoHj8X+4Sx3nDOcOLXZ6XrJGNCyKlUcanesIvEsBNWOfQ4fnW28nyedOtlXMiPJFXl5Gkb7ZgYwt9wbl8H0j+Avz9FHw/z+BohnLalRz3xohtKiFoMmprINI0SrEg5EuAwEHqvlwirJ3P3+ClrmyDrKI2vJ8abhpKE19Q/zIpUvKVosYylHcWSwadoP1zrqaClYCWT9BHeMvXmdgbWrgQsMAVPGcGV+HrM0co3Uan0rSkROZZPxRTEuLL5R2o58xuQvA9zIfUhSXe2FI80oK+znXOTk+uHpenxjmVb8e9qes+TiPjmXyvqT6AZg4eTfQegBVZvCymNfzsbfMDUucto1R0gig8z2BBAWeMI4pkTmsSJJGY3gsZy/2VNMlv0qegC8OG1YtxcufsBm1VNYKFtaEBZ8vvPiG 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 Thu Jun 22 20:57: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: 13289603 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 B783AC0015E for ; Thu, 22 Jun 2023 20:58:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 092398D0009; Thu, 22 Jun 2023 16:58:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 01C0E8D0001; Thu, 22 Jun 2023 16:58:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD94D8D0009; Thu, 22 Jun 2023 16:58:11 -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 CBEA48D0001 for ; Thu, 22 Jun 2023 16:58:11 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 8A29E8028A for ; Thu, 22 Jun 2023 20:58:11 +0000 (UTC) X-FDA: 80931596382.28.9D24707 Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) by imf29.hostedemail.com (Postfix) with ESMTP id A9012120003 for ; Thu, 22 Jun 2023 20:58:09 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UtF2QiZk; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.161.48 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=1687467489; 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=3fM6P5WTccqvIYU7pKYbdmqfndxq71F/T1nKY7HF3JLFR8VrptNlavKrQ7NUlJzkAwCzAX oOQJ/12FNyN+top+RlhboZwQhLsu2J9VOnsb2ZSiDBBBJ5EGxv9S4fH1NetMuwzxOLL2fn BvQG9Cq0iPi1b9butDYQ7uVK91NCR6o= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UtF2QiZk; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.161.48 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467489; a=rsa-sha256; cv=none; b=gRsf1AuLW/veRq48b+Eko+9x6CHOe5i6NVdiYJQhsECIMoqfCBzJbJAgZBPdjTHEJqFezS zJcyvGUi6K4vThlLJf3ncs9Y85v9XPjj2650cAlUPH8vRdqJoFt4NaaJZktTH8bkheq3W4 4y8EYGBhAagtcYIII0Jo0wDBp1iKeiQ= Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5608bb16496so2706690eaf.3 for ; Thu, 22 Jun 2023 13:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467488; x=1690059488; 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=UtF2QiZk6b9G+hZ8o+uaaa8jIMv9kwu5Z4W+DnKhqSxtuxZLeuCmgWiQ2UyCbKdGf3 JlKYQP1/9HAEwi4YcMuZIpkc1UasphklUD1y4PAfxdaiUenlc82pk0MDNgE4UyvTP/Ti WAZ4mtTP+0UbBT6PIwdrRUvrUpbxA+faq7jSe2iTSffGzc1HNKXsxuak3eG36Kz3Hx1p 3Bw014l7N9peXiYCyjbUvF7k31KviCnInVoJPhH8kz/FXkdJ8oxWXWbjuOh6BjmUEfNL NLvkARmq7C0ZzVI4l8HT21OfZWS/swkiU6k+jkbLgeAOyE/KVS/34HjWz0qthh2YGY4M vuhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467488; x=1690059488; 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=VKHpXMPVGn7mt479M6GyW3cnp/+lecdipL7pJoKykBnz2O6u71kQ+PbvinA2Rrg2rz rFHGkIMHSDgh3l1GpZPc86WwNxqDKb8Lt19bRASED4sZk6YTw0V1IDyM/Zh5crPi9Y/g /w5ufev08SiHg0VFF5s3Kq740CrepSaLfyMtwVveIU7QaLNDAQw341cx8fKlSygC6rV/ KZMo2DAcAiXkwmjjrwBJjU8aioCzzhHk6khEgFHUfNYFOO+E/zkpGQcSnAnNHiHFxUmb SAG1d7gTWYs4l5R2gJam7K4RkdV7vLfM+UKefdty3de/vpd2rxjunebFNVbHaBSG/6+A Lz8Q== X-Gm-Message-State: AC+VfDz/CmTyu3b+6TQLyKkpNHao3uxmyyu/qdRgZbp9kFvmmNL/mVbx WARUkcXuh6k8zemUjj4ZGVh8ddINRmaJIg== X-Google-Smtp-Source: ACHHUZ6Wv4q+lCV8nxexJGI3S2vfJP94k7k+pAexpWAqQNNuxMHJpmGx+Tn2Ll2+HAYtwXHgGRnsHw== X-Received: by 2002:a05:6358:9f9f:b0:132:d8bc:b15b with SMTP id fy31-20020a0563589f9f00b00132d8bcb15bmr1343396rwb.2.1687467488545; Thu, 22 Jun 2023 13:58:08 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58:08 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH v5 06/33] mm: Convert ptlock_alloc() to use ptdescs Date: Thu, 22 Jun 2023 13:57:18 -0700 Message-Id: <20230622205745.79707-7-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0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yDyCDFpDe0cnZ43+NvZNgjmQ5W tS4HPL2E Vu3O0D0E8UQ2uTBWKwnGCetemrdKr7h9yI7rWDoALU7VHoHjUc3NLuyVVdeVxb1dW+r2474bO7cJv59IONTiJAEjhra5BwdWWdaFkNB74mHLvzpk6sf7JfhINkYQPn67CUT68KrKB2yj/uWlQ4Cbx4qQ2WNhsKAFVnZcf3xdfBY0pEh665S+83Zf8nYaubI4wMLPkzdnL2xY7wlZ7+vIsby5ZkbFErES/sBM4LnjDzuLANr3e1/CKjRfBfZOILi+qkw0pw2k5rK5sUtuhludUkyl+akJNWFf1MiJK0Zd+4UftuCzDpSret/JPPnE71zsFihnj1+pmp9H2RjP7zK7x9oaEnonsG8xwKny4d8p/cxO3ooSaZKMkmI6cq+cdvcDfr5RFfY+iQrBaFzUrYoTEgxkQSNTUtv37WNqydqYlaVq/8t9kh2UYiUV69NBjDnqgOxdr7k6ijzaeHit/XMGzMy7p43pkuURkSmRjiBf6Wxsg2rfILIRwkq6Sj1yUoIbRL1EzGc8dlEoNDiW0oBuW0UwiZ+vgZuzO4lGhSduhq/QiqLVUf2g6LfSCi6rvD3IrjZhWN5d3eigm+nU8nYOg4sa1yedFhfmLMO3iQ43tOXT22OcU4jCtqedBu37QnsYGJlDC 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 Thu Jun 22 20:57: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: 13289604 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 64BB4EB64DD for ; Thu, 22 Jun 2023 20:58:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01DE38D000A; Thu, 22 Jun 2023 16:58:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E9A608D0001; Thu, 22 Jun 2023 16:58:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D3B7C8D000A; Thu, 22 Jun 2023 16:58:13 -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 BDD108D0001 for ; Thu, 22 Jun 2023 16:58:13 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 76F98A0218 for ; Thu, 22 Jun 2023 20:58:13 +0000 (UTC) X-FDA: 80931596466.15.76E59DA Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by imf01.hostedemail.com (Postfix) with ESMTP id 735A840009 for ; Thu, 22 Jun 2023 20:58:11 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=SXnr3kTV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.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=1687467491; 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=AOOrIC6sqEWFHuc3oHxBMcmZZIF4zSlVOIyHJ1sNQh2wCwTJWCwIw1gfF1CqAOUlbOMj5o wJNybBDnLCXwvGCYnE+icWWcZJQPR/XyYJUA7Bt4KbXQCwJXYUXav0ilb/rLmCEA1fJwCJ 4hwumSuAG1VUxKxa46ErgEparKnKSBo= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=SXnr3kTV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467491; a=rsa-sha256; cv=none; b=2p5I3AZThe4uXgQiXTMuARzyuN5yqeZzLyGhvPQ/BIq4xKJlhbuEiY2Yov0+/oFusXfahD Ws9MI31IZ5CWbiak0/RlAAcmYDacsfKuNq0fwSm+vIrb4s+iy0PNY9qP9Ad03trF920Bou kVkCC4ERWMK25yUGrBAvXXrtwzkuLVg= Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-bc43a73ab22so22986276.0 for ; Thu, 22 Jun 2023 13:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467490; x=1690059490; 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=SXnr3kTV6njYUvauamdMyIGRqi3Z41OxkG9JlPzJUx0NriTeoHWuqaMEo3l+9h8t2a VYkat48qctNxV1/ppcRnfQARZuWAzrRCUbykSbsoBMp8966TwG20r91mIMZZWqpjcTmW hdpH7DDiGoYlRwkaTlsQfcolxJPdgdCgC9/4W8c/dT4apJrOeLX3lj0oWu+YQP0DxUAd osWDaPCIsD5h/hDouYKm/GWbJh0+G1rOXddszwPTKiRotQWqfvXUbSh9a+2twyPuDXpa FZNLCmQA2AiifhKNd54UF2voysI7AeqYSwKdAxxqSAv3Uf/qcrBy28RD1vznPZVN3aBc SnyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467490; x=1690059490; 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=BRZsqA5WL2UAaINDa+JD0wHpTezf1bkkEWYc+6XFvhQ4LCpERGuTV9sDfoTnMwFHBD iJoJGanOJiNgdW5MUplsZrbT63f74zt6ydLO6XVA/Rmxw72OxfSPOrDuyG1Vpz0LsEWp kTD7m5I1V3c3FMMHhQdNQSeIffDdwn8j9cChVZmRKmInP1GZCyO95mikGUlKSlOswfrR t69m5co+gn8lwZuLH8zbURA5aV6QePvvEQDT5LDlse+KRtBKbaD7ZyGY8YKl3jFmYSX/ DG8aHntjj8Jo3PQGNksl6ZwFvD8SfqIgFn3B3kP4QxZPtPNbSwBcGu/nHutJQIHPvvpm Ptqw== X-Gm-Message-State: AC+VfDzw9lLH2R1BUXGaXV8n5+yP0wpOCdqj1IhejXvuqKO88nk20w2u b4Qk5L4EcSNIzOOn4Dau6nE= X-Google-Smtp-Source: ACHHUZ6BwDtDcu2DafE0mELxOK/IzeJcBBP6EuYjmA8bqRWBwzcd6lelREQA4aNwT3EjfCEygFsIlw== X-Received: by 2002:a25:2144:0:b0:bce:5e08:c330 with SMTP id h65-20020a252144000000b00bce5e08c330mr18770867ybh.29.1687467490539; Thu, 22 Jun 2023 13:58:10 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58:10 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH v5 07/33] mm: Convert ptlock_ptr() to use ptdescs Date: Thu, 22 Jun 2023 13:57:19 -0700 Message-Id: <20230622205745.79707-8-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 735A840009 X-Stat-Signature: 36ihimncsq86s6u3kgee4nh5jy974sm6 X-HE-Tag: 1687467491-313496 X-HE-Meta: U2FsdGVkX1/m8P285NnUSm5oyQmcQxfhdVMBrrDWfbzzs0dW00y1XC4IB+pJ8j0ri/PKw3LlrXDYz659IKh7gudX3B678EG2Lx9/5La/oCA24HoJp+vBgiwaRGXCqOKtzdtvFgbJNURF8qdYglUXZN/nIgadRu+qSh6YfiP31UtGMTBmtNzsfNaxag4SBS5FRpWXk0Jq7ftAlsN4hWSYAQqt/R+yWfUasBLY8rvS10q+txMZVMEu+7XEohqAYRLBAPTJbmTFUZ/sNc68sERruSQSGuSXATr4NePAmgCsddk6FtxZRkj8DdCpCuCMalJ5TM5NSes9mrr52gTXR2wgyM5ReOxilvweFHGtfCPEHFJw9eQBWE02KB44SuHBbOLPdgS71HdOaihT2RzK4dLn4rZw6oirv7cJOB9YZcDmdep5Mq84OURbaI/7n4CDS0utRLeaxGBrjD0zL4t1fZ3OO0Lbv3097v9bA63WLE6ZDXRtnKwaAk0CoveNMVhtIpLreLdYhqpHRHd0i1xHzpqE1sTqexdMIeTfwQNrthlL5hELBbsuzNnnH5xUwiVWGso9o4bbZXu6tPD+/0hkSjCiLqTgheqOl4OYDyG5EEkv8PKh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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 Thu Jun 22 20:57: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: 13289605 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 9B645C0015E for ; Thu, 22 Jun 2023 20:58:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 32C9B8D000B; Thu, 22 Jun 2023 16:58:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2DC338D0001; Thu, 22 Jun 2023 16:58:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 154788D000B; Thu, 22 Jun 2023 16:58:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id EDD258D0001 for ; Thu, 22 Jun 2023 16:58:15 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C19E91A046B for ; Thu, 22 Jun 2023 20:58:15 +0000 (UTC) X-FDA: 80931596550.21.0A039A3 Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by imf13.hostedemail.com (Postfix) with ESMTP id A22E52000E for ; Thu, 22 Jun 2023 20:58:13 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=V7iIPiXu; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.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=1687467493; 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=RkbOFATbkUu0j0r7ygW/ICkvxHp6l2hY5qasz2O9rxXDInMFBKPh733+R1N9BVuMt+3SkY 5c0tm3kC7/8X7IzDHr4cIuqmBRnIsAw+Gl8VMcrSOECrAbVQqcmFYMunJyGSDyO9dlln7q ydj2H0CQUe4QU55Z6YAXysruOs2OolU= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=V7iIPiXu; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.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=1687467493; a=rsa-sha256; cv=none; b=fIT8lASr8/Z+LKjFqTZowF7TAmN1uwCxQh1zH6CmQ1n3wKIssMxlkkhFG35MHJsLGeX7xW L3pEv/SU8U+jsLkUdtAOGSIIqScR4a9skvAFfB2lNrsJ0IPx1FVUCB7jQENSqKKW72qijw sYewPZCJ65z6pg01LHC1WA2jfynzn2U= Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-5700e993f37so16827117b3.0 for ; Thu, 22 Jun 2023 13:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467492; x=1690059492; 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=V7iIPiXuenZc5LxLPVAYTxoBribtdhvsXYi0NcHOJsAsyDJa0lFaEv3HMhCS8nZW6D tBGbKDLUXgq6SXB+UHfoUVwA1VP1oc9uyCsQtJaaWpV0A9i7GdGsTkpa9yZ5PdH4EtVM Ni1Gr88vaVkgSSmwVNY0eyneVDMvJ4SahI/dxEEDmyh7acczYA1fdB5Q85cg9BE7TeJ5 v+qGG39VtOAMjNZakRVRxe4b5fNSSUnmW+YdbvmJDes0xjF1gJ/GuHYdLYvgYUIG6iI6 eUC4zgsXmS8SGsNdBxCv7WeYY6IHbiVQmbpLNYO57IVPmerTWPsJRHKkJEBcDrOn9Fu9 t5Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467492; x=1690059492; 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=altd6c6lOQhuK8BXdixrcKrezVM6ZZbuunIBUv+FPpOQptugSxSVZDUqg9Ph9rx+i3 KY/fLk68XgQfPWGfkrv7RCNED4JYEqEw/HUdybyYwGxziP7t27ONXCpdzB/lD2cwxDcI 7vn+ullQeQFltidbfE3jpTcKtglFRjcIrShAXjRhwiTKVUmNi1JNr0qYcPtYmv7whFLb ENVS9oILIZupbMAm/F3irMMe9uGmnET0aa6iM0c7hUfqLM2sqqqEE48thR4SJ3hQe3/r OWan+1RtH4rrlsLhlF5TH4WdjYep7KA8Ztko+y95BdzQr/fAa/8j7cVf7AAoiYUB9CQH 8Mkg== X-Gm-Message-State: AC+VfDyJpLzO3xFHKQYLje7MWSYatWxa4xpoXYS5lmy2pYwZB+PjzRjf 9yZ1eTNJNT231LHispScGpw= X-Google-Smtp-Source: ACHHUZ6ppOE9aJqUa6Cvm3ZqXuUeTC6rF3mEFKF1yW3aWJUSdADhBmOmFOGnjJA0vfHR/02sJ+sTQw== X-Received: by 2002:a25:1406:0:b0:b9d:766d:f72b with SMTP id 6-20020a251406000000b00b9d766df72bmr17309619ybu.31.1687467492519; Thu, 22 Jun 2023 13:58:12 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58:12 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH v5 08/33] mm: Convert pmd_ptlock_init() to use ptdescs Date: Thu, 22 Jun 2023 13:57:20 -0700 Message-Id: <20230622205745.79707-9-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A22E52000E X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: k8nwr5goyos8eqg544j8jbtwr3m4bant X-HE-Tag: 1687467493-737673 X-HE-Meta: U2FsdGVkX1/dw1UBbTdnTyWbKxmZqxT8GP7RCPxaZG4Bp7rr4wg+oD6+j1SYK6/FCAmgZ7lduCA9rKx8CdvZxFB4tfArshD0eQUGNQsAPZXgJX+VJi2A5Adumv5cvKxKTT3XHX6XOv8THCx2gsTElQKOH+K9GrBylUugBBQy12ORLH08eBfiwsl2RRYIGAUXjiyON/thxJCQublUkNAzPW9d7OQjCaVlAcf1DG9s2Y3tryD5P//NpK0zozsabzjucQPYpbqhGGCsz4d94efD6MIz7LjERRDFz26PGub2HojR9HaK6hwErwP8qxH6cYO22+U+xeuYqdcGWbrShLJzPtgo7eyCIugWaKwLKg6XPkkzIRSt6uJR3Tbx2BbufdAcCopt5a8UUXXilC1bEfOYVihJkg/8ncYdl/A4egVpWWFZwmjHI0XvdcOejfjsAV4HRwZYxSbYklGn7y0zORtXhswymcspgfO0KtHfttYnakf1bU3b+jlkypf0UzrOP4F9EZx2crJWnT309KzU6vXKWBIY1cNKXrdkzENEqwOkRazIpY3GWiCZgOdui+qQ01n5a6PcUrlMEmKidyVK78DsFQrRpWa0KcVre5q4aB6PRuHugX76D9/5s8EfIg2vmBAtDDHENQ3ZWRHHFPV2nEmUdSJQn3/YWQwqDKfGp/uDOMunF7guD/b0Ga4S4HQSrClzstwbdqSw8batarvWZz6mio8syYzSeKPgsinuYgUh+WhWFXTExp8+Ky4t+a/EWiL2uCz9VJEyQ/knoiCWnb86g8ffOn5Ry0bPi5QxHBWevI6HHRpG3rMFFXpIWUMujru0v+0SPjPzwi6WWwBilI3HHh5vtoqY+XHUjYgkaiv1qWA5VyhPMuDcg4H6QlDJtugs+4I296+q0Xco+UJgAS2du5pCxD9COzUnXvDF5L0TxCrizNwWO+Qr1loHFlNhc/+wDRphpujJFou9XEZJm2n 3F1XWCqR Y29tm4ZN08IeHjv1+hSjapQru1D5RzA2xRIiYy+eIgpQMV+2+MsajAV2Qe7GFc9S7ErAt9kvR8JuppyzZQLPGkgD39xO9UQ6LND9ca8O0Jr3ZIoO+O4vitBUEfmAzpRdBxpFTzZLxMOi5YuJ9gHPwZGQYXW6Pei2KBUBLGonWFWAgGZWUO0x6YAuPGLtnmqs891HcTZcBHgMwj4ZHrfJKSCLZwVuzIQBJURkwF5n5WV5Xffio2iubKBd76XEoNT0fpCGDNRvsaKA23jQnYpmc/DbY9JZjS1TqeIV34g3vjij1EFBolT6Mvl26C0E97qRWN7judd4TNSiR4IFUNskAIDwYW4QJuTPJZUB478OCnRkLMDLMSqvZxOBUyhW7brShL8ii8Twb6sA9QQ/cGlAFRG463mRi8Klm+F3lfpilw2+95qqTO8bVuSMqoz25+Db3x2CmStMvVk8JytgKyC6HxPZTDvLVBFNTI8ZwszH7IVbOXg24XLzZRqceL8AA5gEC30sv9eTNbE1girzcl7Eer4fogT6/sVvoSKOqB3C/5L2TApdJe0zu+OmgvJUhtw2QrdoiayuZJO5Z6tusYS3+Dzct7nFJ00HhQGle1uAcwgfeo3YEogK+bDq/HOctKIugLBu+OxEkJWkNAFg= 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 Thu Jun 22 20:57: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: 13289606 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 A0CACEB64DC for ; Thu, 22 Jun 2023 20:58:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 43C888D000C; Thu, 22 Jun 2023 16:58:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3EC348D0001; Thu, 22 Jun 2023 16:58:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28E9E8D000C; Thu, 22 Jun 2023 16:58:18 -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 F00F38D0001 for ; Thu, 22 Jun 2023 16:58:17 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C19D41A04EA for ; Thu, 22 Jun 2023 20:58:17 +0000 (UTC) X-FDA: 80931596634.30.5FE908A Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf12.hostedemail.com (Postfix) with ESMTP id B880F4000B for ; Thu, 22 Jun 2023 20:58:15 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=HsKWFMjg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.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=1687467495; 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=8IKeMYIzKy33QoKtvNjfMBeazKeDBhQmynsqxO+xuNle+0R9Ih9zfjXYGE50CoAXxH/Fzk U6pVxlCscEptTU87QNvqNVlhWiEpeUXO3zEwd6M87Uz86/L9pHTKR7vZM0QX6tD8N3BNn7 2SsmTAFd31zp/9V0/gf40FOVdSiKN9A= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=HsKWFMjg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467495; a=rsa-sha256; cv=none; b=VNN4RWFKQ51YOdpoSAp7VLJ4pt3k7i4rOlxV0YWC2QjjEl7uD2mJbz+T3ehygUPC8FhL5J 86JBKLdRJowhH/1WclF8q1imTf2fclAgYD8CQmhpD8MOZg3KkE9gd2CmPDZXcnPpKCb8Dr GBrb/FxkHWsksPnhVFM5by9aX7JH8Ww= Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-bcde2b13fe2so7398476276.3 for ; Thu, 22 Jun 2023 13:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467494; x=1690059494; 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=HsKWFMjgc4nubz/CGqFDPycebn/IPCG8iEQx6Mn71pJrvZNcRYxgpmqqwFpryLpJLe U6CGU7xvBFlirMshzGg8T6i9YZLzGTtKn+CcBm+t56pm6lJ3TVyGOGzuaYqSKVupajIy 2DQcn5crUg65j6RvjiPUyIXYF96jtw4qqx3rhyDnmY0a3BGeHq9tpmXxMVnvgVEpyfbE yzd/PSl+jlwziFt4f/K0ChaqSr0HvoaTl5CqhIJz/dAvHyE0NXDWuGcwuqDlT7PKZ2aX gZRI6eIDsk4xWFnXPJdwPbiPss9pl0UJqOUtsNLHKXkhccURxnMshNZ4JT+gJbW9Nc9s Wlpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467494; x=1690059494; 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=SbT+C5iuXZCYRJUnm6+wZp/u1ePTydLwFQHlCrKXqLC88YN9Mysy82zAZWybgzfTD2 ZSsJi1UuBhjpLPnwINYsKEkJ8ooihDOXfoD5dqUBuveSgwfCnoiOeCNLc0Q3PKkgPKbn voziTG4Zy/g8nUfiPHp/7hBF+DngCs0uGqONwJxxAy6CHF60DJDUjlef9LcWfRY5Wtvl 700omFIiIiGn16CVHTRIlC+xD0O7KnO4eWXig0W/2s6Ggqdb0PmBo1p5jeR0XvYS9Nrw VpyDf0mJ+r7PKTiNg90oDZvMSJ/g/yRWl7KjgFON0nd+sysUaxuoLOtFGZQpFF6k0diT W2lw== X-Gm-Message-State: AC+VfDzuWcw6ihdnayH49uD12i+Nd3hWboWG08aXjsjuqYOeHdt3+F5H 5XRtVy6ntsGSZot/Ikp/aiU= X-Google-Smtp-Source: ACHHUZ6cGkwHgROFidQ6wg7SrcN0EGNFb8Fy55CY8QeCStx6HVI/iqe9yVRaoh7RjiWHDP58CRtZwQ== X-Received: by 2002:a25:f902:0:b0:bff:209a:9034 with SMTP id q2-20020a25f902000000b00bff209a9034mr4880542ybe.22.1687467494535; Thu, 22 Jun 2023 13:58:14 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58:14 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH v5 09/33] mm: Convert ptlock_init() to use ptdescs Date: Thu, 22 Jun 2023 13:57:21 -0700 Message-Id: <20230622205745.79707-10-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B880F4000B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: e5opcniiskrhk1tuxyz7f9cj1ze8opxg X-HE-Tag: 1687467495-814385 X-HE-Meta: U2FsdGVkX1+QPZfs/B0VAE0SWKx8tUgZ+1Advrdxw2m74wWlhwzQXIBXu7y3Lcguri8wa8C4Q53QmcbbDg44w1kCsJoKH2FPj/fXYLaXj/+ISrRD8DRPBzHNMEv+NKiwwdPT9S1hY2m6ddk5by3tHK4j8SfEGOty9mB4uQUBFa9dNsPDwi1Wa05Q/0Pp4WA05phSVmvlZKcS0SGeOiwYRHN6zG8hriebQ7JOrqoTQaFOaznUqj7DwDeRa1Q9W2oGQ62ogoosyeEm/ex1tMewKZYlNf6MdYXs1i2XpemK17qR7Es9XVlofNnF8xs8xyAfGKwACKkm1niRh8FXzN0wHy2RJB3NUG51YDMjRt+1wx3Lz27nUtJGiDgHjKZa4XQbZoAf+xvl+hmYMoEkOQoFim6RrOcOCJMUQfWec5+03KsePPQG8pTawKHrJoN2aK1wwCM0tkYG+34mQfAL26I4k2cVoijvl34GCIEmDbXEBPJyYc27S2D7FazRbNjQawtgU/3WGGEGf7qHN1MNwiU4cda/1trezABFvJS0sDLdUUgIFBKag/PrBbi/HZs4RLgQu6w5cQQQC42XL9M1Ge9TO9qFRWXk7fdTFjcw/g3itJbw5QWzEMUXImGtqogBdY9ced91nkeqDOrJ+pVgoNf6HTw6AajUtT/tH/HPL2YexD+kqsdLda0NoliE3vg572E6C8g5W29c1cSZ6If85ne79LZfCH1q0jL7jsbLlRHOM0tq4jDAq013wr5l/KSAu+eZV6O6GQsBCx2Yt1R+gDmCWJXoUBBVCV7/JqbWaIkZTO6qW4l+raExiive4V5lxQg9s86owSovlBz4TBHoWf9e7HHeNzyV3za8R6dQs+9lWAwiBg0yeglb7L1y3PsyzxxoUXNmtBD/hMmQbouYa4ueHth+Zvq9MEwpc3+aULQJ4M2OqoSyDgFE+iXH+at606lMHpRsJ9GG2hZbDpfR+Jj JZJZAR62 oF3LDBsd65GmmpFK+0jm/tfzpdR21I0yr415Nu/7jOGPz6ajOj0kWOOaA1DgfcSirK7yI0T7cQKfRAeBLdnRdGyM8gJvZLeW456Zncuq/tbaOj5lTjljnYo78elWUSU8GSmMMjg6+hNLPOupt0BqqUeetSEX/O+XcuGesjAu4D2ukSuLuVFybexY1+aRQeXvEBKMSWAf9S8B86EhmyLauwfNbONiNT9CSfQM2ntisy7FHkg+jtKvBKiXAeNrfv6pe4Q+q+nQHKOtRJSULYVy6a4x+g16Gp7i1hTZtla0PG4KSFKFk1Go5SwuFLpdCFeTorOZr+JQAwfxujR6vtwvWhMrqO3mKi7mgSN2hcMnekE1hmMh43yIS2/PWgGMxSjZUwIfQyqfIFd1kZgLlLw462fUHYwlulLGiak1gNL+UswitkC4W+lp91ozPZ6IMT0KZOgB7ZOV9jBfiFMFMkFSJJtai3Fxxe1r9CUviiHAewUK8x7Gxns6e6NqrpoW16fyx85LWYx+YTFO2Ckq54/PWUWxa8T+iwEATv0gQePVbZT+UJFDOSPT06wZOmhxJmrmQ4E4NUznTybm8lW/rQFGSF34Kpen0s7KeJLyJSNfTAfchjXvxcMKJA+fhVn2IcP5+wIA4jTCpcGzNxX/rV6zwKqkz10nG1/+TT+mZSZSV49H1AgIkVbM0TcXFQT5vdvANVlKk9GUetGyZimr7ekB07DxzCA== 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 Thu Jun 22 20:57: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: 13289607 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 A12E6EB64DA for ; Thu, 22 Jun 2023 20:58:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 39FCE8D000D; Thu, 22 Jun 2023 16:58:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3774F8D0001; Thu, 22 Jun 2023 16:58:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 107428D000D; Thu, 22 Jun 2023 16:58:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id EF0AB8D0001 for ; Thu, 22 Jun 2023 16:58:19 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 93A2D8011C for ; Thu, 22 Jun 2023 20:58:19 +0000 (UTC) X-FDA: 80931596718.15.44F4E30 Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by imf29.hostedemail.com (Postfix) with ESMTP id 982FE120010 for ; Thu, 22 Jun 2023 20:58:17 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="I/bVEj+D"; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467497; a=rsa-sha256; cv=none; b=UAbrYzAuPy9CMnIVj+xkVW430qAdZmku7TIfP4aYBV+5urLjS+bTHZmeyT+4nFTVeXxI5f YERvxO7UKZw6q+8hMQRzhQtx3JYmdUuVlNcpvk4W1xFlPuaE57xnAzpPF9EKjQg278Hh90 Tx0RMDceHwT5g5jc4G0GFvX9bfunchQ= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="I/bVEj+D"; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; 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=1687467497; 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=AM2bQkMWiznyzME90NOeQxnWeW2EbgQ647J5VWhFuHj5umJux2zjaOdPrcUrtQDnUmbyeY eLRFQncNMCQUgCMdbF058/EZr7/LfP2fGKu6+OyHI7BfAJwLW2t4IbYk6PQs50JCCxZ1XZ uVtnI5KDwif2ir3MjQH3REPtD1ok+90= Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-bfee66a5db6so2126168276.0 for ; Thu, 22 Jun 2023 13:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467496; x=1690059496; 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=I/bVEj+DUjJI8l/gEF/kUAGaYNT5Bo0ZW57h+bRIiIunD3HbfI+MBQBKO4xoy6kMld by9iDd+YOlloG6orphek9MUhK7idN+HCTnjbwImmtOZyc6e9u9PHx9KvfH/RMgtU+eEw KkmIT3OJU3QYrQoQpzTDW/lNw6UL91T+VL7WZPaAaf3blTIwnU3tSpIBE8mZnuXVnYm+ rvZ17E5R9YwQ5EOQRDXtuuSLgHPTNFwHVzddHdU5MZn7f0HGX0TpCThXTZUeoTrDSQuu 9j0W4VdWm0ZtykEhgIk1WPxDhiiNhplU95urAkZpVmBWbtxqWeEVwFyvBy3V06yBmQux q4sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467496; x=1690059496; 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=Wr9x+xvKQEHaM1u5JGgLv1g/Q0MMtZXVgPIo4XbtcdtwQ5X1RPEE27JKjU+HmknSZQ PgJGMzaKgxuIWIHEdIDkieGFgcN/1d0n4kClsABAT9yba54sClUAuuc7ufdkMWw0VbXQ 4o2DKzPCmCItq3zp3ncHSTga/iBi7fzYrQcDoExPTMxqMPVgXFnkq/1cdYqeSWqwHFIE vq4j6ygaY0xcZKwtUnGy0R7CbCVpmoIUBITuGwBY9mzdyVgi2BWqhqd1hOXoQ0Ug/ASG ECPUwm4aElAawibHXsxFDB8o+D77+TJKQTcUuNF55ROdp+yaOwdq1HiwHB+pMuUUi3qE 1tUg== X-Gm-Message-State: AC+VfDyODazc5ps+qY5Dcg8QSS0rLpkGQMGEwVkEoqXnchgfGSYfvlFE Bzp/FL0y9fxP7CfakmWqaKA= X-Google-Smtp-Source: ACHHUZ4fKnSuVlprYtWMiqysn5f2VA+PJ55bhXLl+JTYwbJxQpJ17qCGbx2gEAsv8+8GLejR/TMFxQ== X-Received: by 2002:a25:6982:0:b0:ba8:1c9e:c77f with SMTP id e124-20020a256982000000b00ba81c9ec77fmr9956027ybc.22.1687467496585; Thu, 22 Jun 2023 13:58:16 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58:16 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH v5 10/33] mm: Convert pmd_ptlock_free() to use ptdescs Date: Thu, 22 Jun 2023 13:57:22 -0700 Message-Id: <20230622205745.79707-11-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 982FE120010 X-Stat-Signature: xcg83d3gpftcjhp1sy6sna41ci5xfqg3 X-Rspam-User: X-HE-Tag: 1687467497-671803 X-HE-Meta: U2FsdGVkX1/Z37MvE0gGH/tCFr7I5yvikczNoIK1aS6RqV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UQBiUq7y9mt8M0AByfeZNup0LVBgbvdPCvJ9MnxxAN/lIP4iCgrP76x3/4EstkKDjMwTTojrOXzlh6Xrhj/uCseJj1/nnT0mjlWnjCZZdHo3FnJjwELOZ/jk6SknJBP8BAgUqf15laR+lijWLNuwOisF0JeXtMwClrsmEQFcsZNZHdprYEUg9xIfGKg999etHMv6ZEvxxoz8jMSQcgIeDs4EMsuw74keJhYsymFoSqqcmGKNJ6jg6YAvjYs8WOe82+2xbOhC/BxfE0o53B/EXvi3shGMTl2uDh6KHythnBcMbXwqv23uWs5+GxTNs46WD0KISummSnX+OQ74BfyEJcVY8oABcd6lGZFHwBgpSZbZyqCA+rqClpC5505QZLbgey9vfhrYodKnAd1/f5hoQfH5ccY2zuDoD89Qu583qbbDHVABUWrYocNcjaZ2aZV1YeAGo8si6F/bMeXkrx3KhQs6n4/PBo2pAC+nyx/E0Fd7NkOjG2CbyYXAevd1lTx/Lrs= 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 Thu Jun 22 20:57: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: 13289608 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 619C5C001DC for ; Thu, 22 Jun 2023 20:58:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E76AD8D000E; Thu, 22 Jun 2023 16:58:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E25038D0001; Thu, 22 Jun 2023 16:58:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C52978D000E; Thu, 22 Jun 2023 16:58:21 -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 B6F708D0001 for ; Thu, 22 Jun 2023 16:58:21 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8AD80140225 for ; Thu, 22 Jun 2023 20:58:21 +0000 (UTC) X-FDA: 80931596802.29.714303F Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf04.hostedemail.com (Postfix) with ESMTP id B646D40009 for ; Thu, 22 Jun 2023 20:58:19 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="IkBs/Ppa"; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467499; 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=RmhbLiqaKZ9Wnf1AmCmx+2c03xyTgu6Yt4MOYJbobHGJSVHZIFdPz/SkBDmnNBfMtwo1Wl d/XKlcww335UMrU+ti9UAgvYQhBBBPhFxYLuDscDOuCz6rnToopF/cG/M2t5syux4vKPYP Y515PmKJ1xhL9jhKCfwF4ml8kfR9pPY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467499; a=rsa-sha256; cv=none; b=Ch3MmXFcxHMMWrgl6kEUfc0TvcL4N7ovvxG03/EIHzTngo2SlMErN8EpLRxMg3L+YyQ3Ez vU+2jZRKgOHPYgeCYvNzm1lOVdGSbXzJHlQexDZq82Dbc8Z5jO/55Km6i6mM14BjuZ5rZ+ X4pDs/dNETek54TMbzAwG6zpOguGWvM= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="IkBs/Ppa"; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-bacf685150cso7078843276.3 for ; Thu, 22 Jun 2023 13:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467498; x=1690059498; 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=IkBs/PpafQMwMb5+bV+TjhgBJMISrd3r9Ehxv0D4bga5hDCjsodC2JnFe5fw5CuuNh oXzvywchS02bgspv2vVMsLaNaJfhQqRd4zMAT9dIGzvPtgGebpRn3vizNbCCeH4kxu0g TyHgRtXbQw9QJenBGoSSN+LcKZYEWvqLZfshqBtx5IJouxvVity8IJ3BMNOIhoxk8spN JqRw951qgrZvKDiFAsIL9Ao//k8BkssPPj/JxKTcUCZ9IjeC8TdTUdZgtY4aRKAk9cjf OLinZRYVomzL7Or7UYL6bwPiJppfDFOL1vHSgfsuBpqKRMQaWBk81ZwgHtszBi4jTAEe xuMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467498; x=1690059498; 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=e2myt8hgCM3b8cqGlmwxgtw4rHFWhgNuYug6a27zNLmkkCCtBO6qtSNUuMSG8pgcV2 yInL/hJ/wrNhBto4bG7D0EiEpxoqRYz6KUf3NifklEFs8aZ/3QeeQdIW+kmE4zLD/WaN AYNgv8F9PeZ3wSysglqFnvqPM38sVGf/EH/GMzs+xee7hLFYf018EPA0ySkHJPn3fGDy eqAqECw+EURyK97HYG5SRmXr9jEOEPnKty4GP1L/YRLM8DW1aa1NxqsBMEwJF0dgw4vf MpNSZswL8FCOBTeSxlP9NK3y+r+HO0V2dIQDzruJeuwRXoaX3hCxr4KafV7anTJRmliP vJ0Q== X-Gm-Message-State: AC+VfDynw2YmQITKwkOHmJKWGwLyqUgWeZfH/Z82il+SPSMudJQzAzEn mdG9GUZNwmeXdpiEhl/9gl8= X-Google-Smtp-Source: ACHHUZ7Pa6VOZ8zc9ZXGMhVrxtFlOQ5CfM1HOMla01BhywdpE01k0n5trNDAUGdHgqy9w/StTvGJbA== X-Received: by 2002:a25:aaa9:0:b0:ba8:66fb:dd86 with SMTP id t38-20020a25aaa9000000b00ba866fbdd86mr17182535ybi.25.1687467498635; Thu, 22 Jun 2023 13:58:18 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58:18 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH v5 11/33] mm: Convert ptlock_free() to use ptdescs Date: Thu, 22 Jun 2023 13:57:23 -0700 Message-Id: <20230622205745.79707-12-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: xzdunucsa384gh8zmsa76ykoykbo5fzi X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: B646D40009 X-Rspam-User: X-HE-Tag: 1687467499-265371 X-HE-Meta: U2FsdGVkX1+uE6wKrkIpWjVguGQU8f+YZ8M7SeaeRsrOTDVmJH2aUsEh6m7ad4H3BNScaEg6PeiBY/wjxvnoKQMbRz0m2k4rUoST9lJSNqBvMmanOyd7Efs4kt9C9tvQFQWCGwDoncRGz/d0zWcw3lEbuk/f5yr8op7v76FswtieX3PxaFIXFJGY0xFXXvu447HgDyKKY8jzGyvNPsMU+zx4T6B7unsvXhBhReAzSxQ7dBbMVjN/HCsM87kDTNxQf4kqAfHlZYN34shVxdFc6mW7/+m4ZLsi36xYrdy8C2HXT4tcEW2bsXH1kAMZvd9KU9bQjqVsRGPA9CTLdrOYIuz0tQv5Va6m1tOEmoxzPlcnvluV9eV7c9xxKrScgEIMA4DPdnkcvHBqZzuP3iJWAwhqjo5ND/mKyR3XI65jD3a/y8hE+Te/vVmIQQCdgN4fPDLvds5wGpx4mGkN+xtOwGEZHGZlepbV/QF2QBSuMku8byoKiO20Wysxi/eJsSkf7vKQf0HqY5q4UJRpX4oVTsy+/+2u4pXa+MRLELyxK0wdaOcpDVjIZcsVIsSqCTUF3DygIVjFUlUG165+dJscwKvklGcXtf6GOV3DPsGGxxiqdDt8UDbVgGpLMgW9BxJ7Q3ehlQh1zUBT0vkepMs7Iyg+NyyZwSdt/KAqR0sRx4lfMNMz2L7f+fXXxZuZL7rpLak/JVgWZgOKbT1paOQQfQOWLGeFWgpd8Hb9Wg9rfZe1o4Rf0x+eWL4Qm26EpD9VufmAxz5SRCl0nvzicyANvdLk/hRfHNXZMjZYItyuyBgENUDgUfnyUzt9OlcFVl+VPby5KxY6NuxDF7GynAZvvQpGPEJmWFkj8MdrwcFUaSnEBjVLPAVtSM9K+A8srTcHLeIcFzRjZKtvAbPA5YhWhL+LdgEX6MfS0n6JBVLZYCfh3dizqc4C/v2ewye9oViJmOtB3aaQpuBQkHmcVz0 cgOtc/os ofeUzjFoMnJasYMLnXk4xaD6INOthe1V6R32a+OWZy3UfvrmEy4g0owQ79jr+Z8hpSQJ/iGC5gcHj0hxlJhpoS1frMKOcgyqS15PTpvxJiZuAGwDiDlncqKakeW9m2+3PeyFRngvSgQhq2zco1kiOJYNYzoAMIZOhcZvWTgFyswACKCbFE7tbmSW0iYxnwvZLNnTvHEHSRu85BqEh7gY+8loRIjA8rSOgggX+C/m2rhBQ7vVmtQlyPSkqh2AbOU2/sBpSUsw5D/yai6Rm9wuSmkMOEYtDb3EUk+SpACLmD9DcWcWh3evhEK+HFUEtLuJy/roR0/qezQ2gLPsPXco1ILFs5gtpts5YCz+LmG/K1k23WMeCMsQ9BgtzZ4mvY3tdY2Yr68+6Lr8amuDTWiFws9Q9lKAWJ8Bub4p5bk44/Arxe5lDfY8yyQoaj3nzzSZNfQbKerUcdLS9DkRD1JoANX1ufB+xQtRvcw8/ksgtQwm8jiPTGJdj6AnJNOG/JlAg3v1s6c9LqKHdcEy1sC9HvoALNzN1cnmA2X1NAhsgZ2zp48mUVOmu2UsZ4VFvOUI3FjCrHyGbKr5bsGQsSmJ6agSoagVxLQEceS4SvIgeqtLE6/wCLiPm5n4sbfQ4w2oOxh/nFwcPPB1NjUs= 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 Thu Jun 22 20:57: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: 13289609 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 C12FEEB64DA for ; Thu, 22 Jun 2023 20:58:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65F0C8D000F; Thu, 22 Jun 2023 16:58:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 636ED8D0001; Thu, 22 Jun 2023 16:58:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B15D8D000F; Thu, 22 Jun 2023 16:58:24 -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 3BBED8D0001 for ; Thu, 22 Jun 2023 16:58:24 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D51CA140740 for ; Thu, 22 Jun 2023 20:58:23 +0000 (UTC) X-FDA: 80931596886.11.67390BE Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) by imf24.hostedemail.com (Postfix) with ESMTP id E1B69180010 for ; Thu, 22 Jun 2023 20:58:21 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=RozEvIvV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.53 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=1687467501; 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=n2L8VnWXkfiuZ/X/+8EmbA5mSchRbR/9PqWrlDHv2eGFt2w2vt0X/7DyZeiplUwguE879X BebWBllq/XYh9ZYbCu2VPO7RJv9rwpk9Dqxn/bUr6GremZeQXJ1xA6lulVJAUc4hFUBWlB tWVknwEh6o+XCOonWI8kWvv0zO+Mfv4= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=RozEvIvV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.53 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467501; a=rsa-sha256; cv=none; b=R0QdXEL2IFUDAnw32IUzfTg0/jKez1cX6uGHPoaHMXqpp+Qo2heBBss4i1JmMM5rey32cl fH0INty1/naXxJjOTKDVD7tcIJnGkwJgpDbmd/sJgu1TmB/3Ni7She5wZvLS0XdpF5IH/u F5IvDwKNH6k6daadHhNFy029y5H3Cpc= Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-6b5cf23b9fcso5138a34.0 for ; Thu, 22 Jun 2023 13:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467501; x=1690059501; 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=RozEvIvVOP2VqVYYMWGzDNL6CpsXTnGXlp/+8t0w3BlD0JmgE5T0sEFoPJ6ld3NgrT bo4deZV9iKOusMQ4leLcL/PwL7QvpCQol+1I1GDFuH17XhvWiV9F9j1adtGOARy9Hha6 3RGKMSONQqhzWt/kDmWTnPMrNJ63EExn/gif2mwqScqJ0/yA9eOZVrNV6N0d1si+/PRm WBpjPrumaScaXS+oAuKW5qjU1zlQ2w0x0jfPY5Gm7PSjCaEQ+p7K8a/NRyFlUYxCrD6N J99EeDDjbETqur6Uq9P5kOnzRuhiB5K690PgOVUOJzS9Q8J6CLKu6wMbAbv6pVzbEVQk Y9LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467501; x=1690059501; 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=Sik9J22GHeL20+a92gXXg/TO62t44NQUilNawtI+Fjq4iYEhYjO+KVNCUDNeAPmPtj Cpgkc85qToYbuIj12qfVmXgUzmfaIssud0erjndoWqnTeoOXLURyi+klIdY6GVqS0RHe il9fibSaYdukAjWmpSZH6C+J0YgRiCt+p5OCk1sTJSra7DYcNVAgcovj4bk+675l7Z19 7Ocs1LTXRr1p/nIcn5mu8+UddFizwpcTWRM7tQGxsO+Ch4I7Sjh8G/1+/bTFI1vbQHt7 b5sLDVcAD3OZQsRHciLHfq2oA2PvbM/z4ot1PmC7Q03lVa9mVqqcMF/elBdJSkVA0Mxb Okzg== X-Gm-Message-State: AC+VfDwNGQ/7OC5YjzyFLzFEV5iBodNUBzBE3gaXjNlm7BB+8zMqem+2 Nr+56o2bDxUkL3Xl2fOdjXs= X-Google-Smtp-Source: ACHHUZ69lonjyuyFM3x/i0CqMLsv9C2vXMWoj4oQ2M7sud29qozQJHPP5PISfmTicbDCzcNZpP0hng== X-Received: by 2002:a05:6358:c114:b0:12b:cdd6:9661 with SMTP id fh20-20020a056358c11400b0012bcdd69661mr14337984rwb.13.1687467500803; Thu, 22 Jun 2023 13:58:20 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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 v5 12/33] mm: Create ptdesc equivalents for pgtable_{pte,pmd}_page_{ctor,dtor} Date: Thu, 22 Jun 2023 13:57:24 -0700 Message-Id: <20230622205745.79707-13-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: E1B69180010 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: umtwoatrru5jh8ycdfg45oa689r5erg7 X-HE-Tag: 1687467501-595947 X-HE-Meta: U2FsdGVkX1+yQAJiwQqUadJ3Rf+Sm3sNWIO6VGsFpu0RdEkFCR1vEDoC0H4lv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Qa8IY3PMlNKmXRwla6Y09FlAwAztXYRZ54Im9F3PRgs7CuoY3CXStoEzj2VOL5C4pCJJrX9fC2PU6e/2H8RUdGJc3n4dHcXpmEI6Gft7aGpjRZmYQNLs8HH12XhOnX/dW/mLE+GPQzh/75r2Da5dYaex/HPy/gcnkjI2R47Czri6nr1dKkcxzxjFSFFdaUGLY/JwJCwUy0KLzFE7put30hC5RaqM4WjK1KGOPRK0NJ+laK4OCn+74Uype65XbeKnli+Rf7FhiKiaDc1DWVqt5J+dQRc4RQ0bCcECleInLg94+MphLwAUxh42faisNYTEBsDEnvaoOAL7rzTDrtBnd4Ff9Yi5UBP9UIFfIaJiUQu+Rv8Ucn8ZUglDBBagCmXWRra/El1ZfkA2FNHCoMrIBeinEyJZMEuRXTHuCKiaWJLxY58hftzMYK8H26s7SQYBWaXV+OBWsKLAeHZ1CN9qKPFcEhPvrNITUFDcF0QEY= 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 Thu Jun 22 20:57: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: 13289610 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 04453C001B1 for ; Thu, 22 Jun 2023 20:58:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 833D78D0003; Thu, 22 Jun 2023 16:58:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BCC98D0001; Thu, 22 Jun 2023 16:58:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 636738D0003; Thu, 22 Jun 2023 16:58:26 -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 53BAA8D0001 for ; Thu, 22 Jun 2023 16:58:26 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0C420C0195 for ; Thu, 22 Jun 2023 20:58:26 +0000 (UTC) X-FDA: 80931597012.21.F3216EA Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com [209.85.217.42]) by imf29.hostedemail.com (Postfix) with ESMTP id EA5ED120015 for ; Thu, 22 Jun 2023 20:58:23 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ABncV8bc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.217.42 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=1687467504; 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=wKautdzl07XzS+rjvZ9T/gGWzboOf6eL3tlw8Rr6zXg0ERzaMTBjqbGZ58AxLCcihmJ4O5 l9Uss3v0msrp2BDuocWl1i6gKqFDrfwqCgIjUnMPhbvRX8rI0hutdZsvxCCob6tm1RFENE jARORXrV4q5efLcus7uqbBb+RjnSHGE= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ABncV8bc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.217.42 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467504; a=rsa-sha256; cv=none; b=YhvVh0wHC7emX7Z0za/YitvBggPobp68moCz6BtXmOjXHjdBCAKLq3urofO/Jmg6hHrx3B KFu+ksKvt05Exqwe9hpRjlPt8MNzIBzS4Y47H0fk+xTWRIci92gAbxHGln8bA4uGXtX+2E BtNLt5s9ojLBTuIG0Gt63xKOhpg+wbU= Received: by mail-vs1-f42.google.com with SMTP id ada2fe7eead31-440ad8ea514so2000323137.2 for ; Thu, 22 Jun 2023 13:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467503; x=1690059503; 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=ABncV8bcPnEx/V5hIZt3PK/aoJ0qqGZh9rD70FXARHI59ktAXJSvC9QEDtQfXkDAn0 gPvKhKRqJ9/P2llt1JLv5/rvvesIO3IE1AWOpUXp6uiTrsNqZThkWa1zouEa3Mbcsav1 276BRnzfwGIqQvVb7zax3PpvYwF7X1EO6UUT2ec+v+o19Kw7redekwq60WrGr9r5dly5 iwJZLpkxzloILO701IKBKyiXRNIoFjjYDVD07RCmfWhhF52WoxSilofbL2vgDoXDMBKs Q1/htIPwHXAwm3A3T5s4rqwem2be0Q53PLHeqtpDT4d2+OmrVTF4tJkx6cGzhA/nmIID QsiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467503; x=1690059503; 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=gTc8mIlhwrmKXd5cqH/Ad9tg5yGfkjf1UASKbLXMD6/SYcPhsW7C2kqEEjVOtlvBce fIoTk9lVs/ty3J4RYFZz0UGk90B/TCIiNO3sfem36RtwkGY/ZikGLIL8sgV2A8dIMxhL MmoPl8amD4MnlonC+M1csIEM5+MSor1nW2wLymCdHJPrxfuNQDTsnUfMFrdKjC9FGHbl EBy5MHe+iUkFmzQASbJp0kIMX7feoKLtwnBy7XH6s0V4wQdMVVfs0q2Km0E00H7XN0Bi qQaGuyhay+iX2pHQBIqHA7n65HerIgFkrzZ4rLglbGK8jNMkZcd/7JowgVq+wmXLAiTF 7k0A== X-Gm-Message-State: AC+VfDynJrjNodR45JWPaVaDisRLZWbkD1GTEKx+pt2emik69oZCMdwA aAq2pEffYBaxvJiqF8vNHDE= X-Google-Smtp-Source: ACHHUZ6J7vEsrvtjtX6BrmtaxKuDLa21w+gHXjjUWBOcKrlZJaxY4XlKKEFhMBRF8kX2fbwnoUz2mw== X-Received: by 2002:a67:ef81:0:b0:440:8ac0:ef57 with SMTP id r1-20020a67ef81000000b004408ac0ef57mr9038809vsp.24.1687467502842; Thu, 22 Jun 2023 13:58:22 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Christophe Leroy , Mike Rapoport Subject: [PATCH v5 13/33] powerpc: Convert various functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:25 -0700 Message-Id: <20230622205745.79707-14-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: EA5ED120015 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: ahutpj3q8xx3uns4rfttuzeinnxtiye5 X-HE-Tag: 1687467503-151650 X-HE-Meta: U2FsdGVkX18jtqblKVAa7JFD3FvD23MxMVPi1aL4NsZMI9I/8IppjNp3fv/boRQ3jz3f+V5EcumOEfss7S+efWjrP206HfTH0wm2bWid1US6ap4cTwDxQAYVig+N3VCBlyev7JTlmLW0puO7rK2FJTyIod6DO3+5pY/aiKzQdU+ioDycMwLPzzBcw+Wq1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LDLUMPLL1fVa0ffUy/5uY0YU6vxbnvGOc3hDrs4HPB3OL/9RBbV5j34Cyrpt5xx7q1RZgtLaX8VqPsIs0mVMTAtsJxgWRz5z/E/3edp/Tc0SbeuvzNaeucL0RbjHm6ehrGDiPe3Dvvu3MJFDlgMjwTI0WwHnK/r6RCNfOYgiKd/+W7qA6VRSiWNX0P7yNgBCoFjO/rj9xxKFUNutjX68Lz5SpZqYw0e2WG2zlxiokiqYpWn8mFL2GQYwZQ4EaGZ0vJDrfsECah/mO5HWhvBakCrWkKJU+5QobAXpaVKdqJAbzfBmBdu6tij+A7bXQHChw== 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 Thu Jun 22 20:57: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: 13289611 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 AAE88C001DD for ; Thu, 22 Jun 2023 20:58:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1CCCF8D0010; Thu, 22 Jun 2023 16:58:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12E328D0001; Thu, 22 Jun 2023 16:58:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFE6D8D0010; Thu, 22 Jun 2023 16:58:27 -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 D2EF48D0001 for ; Thu, 22 Jun 2023 16:58:27 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AA396160109 for ; Thu, 22 Jun 2023 20:58:27 +0000 (UTC) X-FDA: 80931597054.05.18B9A19 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by imf27.hostedemail.com (Postfix) with ESMTP id DD8DD4000A for ; Thu, 22 Jun 2023 20:58:25 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=kPeKxS6x; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.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=1687467505; 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=QE/XtHS6xqv4mXNSpSLgGSIv27LYKoRAY9awMtcJ+S0XhMrvOacvXDYJHzK+9YQpLPPM/z mPMnxXThn/sckpHbPITu2VQA8CCqUC0cKtQOeUARHrxgIjE+ru87zRBi0lQbkh6qoJIx6s 0MHkxfHHx4gZ+s9/ofmB2+SqM/UExmk= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=kPeKxS6x; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467505; a=rsa-sha256; cv=none; b=Rz6W4ym/SSoC7iDqiwR44uTl7IlMo5f04/YLNWFeIKJlCMh/NCPsjNRha1PjpCVXY/KPSm LDCrxCVTc0fPHIciUS8yN0QyDOL/fbGv93PWrhla2K4XxdbYbeWJrbidd5KYhWlRCdmuzq M+wTQjswM3bO9Nx+bCMu28hlClOZ/OA= Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-bb3a77abd7bso7357387276.0 for ; Thu, 22 Jun 2023 13:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467505; x=1690059505; 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=kPeKxS6xjGfz9AlFKXBrS7k/oMitniLbJZydJSL7P9mRWo4eZ6+mhZ0RfQ/xgzRpRR shlp6IDjxc1Zi54v2Szw/IWPs7h13yhnqa4+SLs+JrO4xub++cDoiwuSfK32oAECXVqr +0aImmxu0MO1NlcDWPWE1t/GfM5gpYghSOx5OplyS42V7eE66ajuWsZpNSBe+PsYPrqi VcjBr8bDpFWaHKuuoQ+xJvxJpfPEC5IOcvI0xVrUQ3Ge8p6hulYzFPiT6b0ht75dwKoi lPIDcih2cDzp/fXel61I0gphUyR5giMIqEnrUx6FuLn8RjvsQYvRr7lV2J95H++gAjzy cNtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467505; x=1690059505; 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=NRl5GS/9a4KXpVnQQwybvb9GfgL8EaH9dNktCRMully5cYzWOtS7Sp5Cal1ZhlnMbB vo4O66vea+kW08CHC/K4Oe1pqun7o+qP8ftYasGvPMt7aKz5EjJ/GMvK1intBi3eAxZj V3MRbYCGS+OMyFCF+uqFKQ2ntdPvtfq6SJnFzjYg+Krbi45VJjnhn8/f5QZsdMeC4wjx efmKu4wo+oFpl98Lc3+5Es92Nmqh3Vn0zkOKoXCyotpa1H5nqTGrLDCzHKtPN30ieGmv Mt2iWYCD0O/G9C6QplgwJ+8GokaLj9xsZIzntSnXZlhC+Yq5zMiZzuH5s0amFpLy1Q8p iJJg== X-Gm-Message-State: AC+VfDwutOlBkfr1KkFQ7/CwNV+pr6le+rQVgP547z+/aMZkNDUdK0C2 poqoOuDJAWQu/apBAkq9v8U= X-Google-Smtp-Source: ACHHUZ79c/uNHhonLkSvxldyR2pWp+AvCJ2e1p2TKGM3TkHKm3UmTC7VE9FYRHtJjJMm9DuNY9PrUg== X-Received: by 2002:a25:c057:0:b0:ba7:db6c:c0ee with SMTP id c84-20020a25c057000000b00ba7db6cc0eemr14608074ybf.6.1687467504871; Thu, 22 Jun 2023 13:58:24 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Dave Hansen Subject: [PATCH v5 14/33] x86: Convert various functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:26 -0700 Message-Id: <20230622205745.79707-15-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: DD8DD4000A X-Stat-Signature: j4hip1rhztyw8qw9a6wdmcmqopjd5ifj X-HE-Tag: 1687467505-72966 X-HE-Meta: U2FsdGVkX1+Akx/ZzouP3LbkCzjuzcx5oF2GL2Uv4PNi+oai3rvyTilyzM7QvJVrZQOW9mVpjjAkvG9JNP3/4KDXrT8/w9/+k3FtsXSBcf4+K5pZpkx2Pi9w4LkaTlGljaisCRQ6R7gBpVvdngJMwuQQXT7yjqsQFEPNhBovtLR7l5786d4jQc4AGlt0hBOEY8YraTpTGZh5bmSQ3KW4/x3pkgESpLxirxtzNCZdJj1Pd+1YsxZQCJRS2usjzuzrozCgOezrNFMtas2MQ+BZgEz/78NC4iQ5YYwxCny4sFNyZZTmBpd3fsT69JhRdttivmokD390dl/vKPb7QWsmDMF5y4Un+ZfwEVyO+eHOPQAuyxaKW8Xy8agI+UhayAeWy2J/qimEiRMMIpIC3mY1ONu/wVieV2T120aDg/Z7yvwCJNaFqIg77znD18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OzO/vhQ== 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 Thu Jun 22 20:57: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: 13289612 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 E0105EB64DC for ; Thu, 22 Jun 2023 20:58:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BE0A8D0011; Thu, 22 Jun 2023 16:58:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7493B8D0001; Thu, 22 Jun 2023 16:58:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5255A8D0011; Thu, 22 Jun 2023 16:58:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3CF378D0001 for ; Thu, 22 Jun 2023 16:58:30 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 192B71604C5 for ; Thu, 22 Jun 2023 20:58:30 +0000 (UTC) X-FDA: 80931597180.16.6C16D76 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 20CBF160009 for ; Thu, 22 Jun 2023 20:58:27 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=CFniQwJC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467508; 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=3xQqy90F09SVRPNYeYieiIAxU5DHTveHa7FYFbBxFunq4cBuK30C5qbvY88y7uINWGIWXH C+jsPdOrvpuVCPVAzOkVtA0T1Y+fz5eTjVGh7nT84gmX7GbBBWdpdMEEwcdYJaNlyNWrTW XDJL4zyzZviw5bSWVToBD9+8G7t9HaI= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=CFniQwJC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467508; a=rsa-sha256; cv=none; b=vx7M5Xsqpl4k5MIRH5ABCgd254C/jrHzOgic/itdsO0K+tg5kB2iBVDoEvAAqJpgtWCIey +vzHHl5lXjH8+gz5zAEh6urxwnBsTc3zQjxvBKG0dQrn7LUfJuAfXFUJx0tWYq3UUx6YU8 Uqu5aSeDIsZ5Z9XfdKlAQ+3NoFd/bdA= Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-bd744ffc263so7456382276.3 for ; Thu, 22 Jun 2023 13:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467507; x=1690059507; 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=CFniQwJChRQH7765fapkmXvTYUWljBI3etiFy/IUhcwGjAj7vPiGkSjmRv5QF/IAka OSzIYnhvidG2W30wNEZ5XX0rdt2N1cNUzZo7yyO/i1w1j5CkZxRPEL1+1kqS1DupiuCD of7w7SOQo1WDGv4IZmgu6M0YvoyK0T9wAWj4Y6yaoya2aEfQEApVJBV1uDc8gK0oZSL9 nB303dtPPvy7hMOiqU4AC+LnTNiE4NAFn6xNl54ljOLzRvtWHhrA+r1wUq5YflvTwzTI d63+WU9pml8sdEvvWVMLpUd3CQwrXwlZliNmYoxjyDkL0CHEH8mnboeDt3Vd1ElvVRDA F8Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467507; x=1690059507; 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=Kn9aYAcHqTc4jy/EneC9nfO2fbI3g3RXGu/lbtvpdwSOpQ7atFu9+wB/y4t3HVHh/2 E31W9CHcWkCxvkzXfqPQESailL4ljXMSW9LNmaYFP2Rbm1fSk2OcDZUCwdxiDG2TIzLV j3zfAr3nitKmWkzvUeXR72+MzxcqPxgMHlENKFT+2qPchLi+f3rh8PjzxMVeqNUzdYu1 T1vrCGN8ZLfAxkDT+6PAhYm4q+DPfURifS8A+PwvmcRQ+/lS5nUAX9e2a4E9qKZk5W0Y lEnGbKgAW4/tgQ6j9bxx94zpIPC7U0BNyZjpIbxIQw0NVT0lZZdGEycZZbA+/rKnHnoQ 35gw== X-Gm-Message-State: AC+VfDxnEyf5NUEMYapG2LgGun57SCMx+kYv5yYN7tmxdGsQdOkRY6WF H7zR53aniqZOdKRQX6izWzM= X-Google-Smtp-Source: ACHHUZ6rxA6TM0NHi6rOKcExqb94O0u6Ux1uxCup2OxBwQlj09S9/pS7FVr6lZVUqccEnVqh/TxF7g== X-Received: by 2002:a25:495:0:b0:bc8:2158:63cf with SMTP id 143-20020a250495000000b00bc8215863cfmr14696422ybe.23.1687467506992; Thu, 22 Jun 2023 13:58:26 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , David Hildenbrand , Claudio Imbrenda , Mike Rapoport Subject: [PATCH v5 15/33] s390: Convert various gmap functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:27 -0700 Message-Id: <20230622205745.79707-16-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 20CBF160009 X-Stat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epkTQ6xgIUoOIjlbLSL4l8Lc6wcqfNIwfOykQkZAmB6wkC1AMO6m0ta24w01DFGwJzUUmyfg2sP2TpZzdvyhwzHvJVj6xhI7gLpLbVnRFCaEMQy9nuZzeT/E11yxbPeaTXrI9FdbAiZU+EpMmMwUp8pZLKsKQYtq78Fj0qJoGVGSoXqXZFelw5FnLs8QbtIcYKX6W/IOQHilkbFMiXLnmwB2niAIzs/E/jyCT36tlaOOh3lhrM/r89IY4y77MgWOlTTJvEomf84b7i8fuxsztNDnz05n44kde4SyIJ/p9hB+3uyrU72puRWTmwQKKXRkncoS0EH/N/PsqxojVYQO+TSByNZGVaEyvNMUk0mEOFeeZH8JSksYtcRdQaj3mEb99/oJjed+HkTdus+BIS4Y1zk3a2EdRMxoDwztV0zBmhQhCi0G7GQ6DCGEPs/H1xXzeyW9noGcD8HQo/uSYC7TxN39PjAw5cbJCIlvu2aHVYdgWZXOzD6V4EL0tildOMYodbOXfkH/IXr/Y9TLa5NwMCynmOy+nPQQuHbwEYl9zP0rb7/oEbyNDR80S3NU8QO8rPrrgSu4Mk/2Lyutksz9g== 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 Thu Jun 22 20:57: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: 13289613 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 B33A5EB64DA for ; Thu, 22 Jun 2023 20:58:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DA488D0012; Thu, 22 Jun 2023 16:58:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 43C908D0001; Thu, 22 Jun 2023 16:58:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DBBE8D0012; Thu, 22 Jun 2023 16:58:32 -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 19A9A8D0001 for ; Thu, 22 Jun 2023 16:58:32 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id ECBE61C8AF2 for ; Thu, 22 Jun 2023 20:58:31 +0000 (UTC) X-FDA: 80931597222.29.84F153F Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) by imf22.hostedemail.com (Postfix) with ESMTP id 1CCA5C000D for ; Thu, 22 Jun 2023 20:58:29 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=JUQrsli+; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.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=1687467510; a=rsa-sha256; cv=none; b=NPK0/VFe8vZ1uFEZF5cScz1eHpWe0LqDI99UIG0CJ4ofdxQiM8XU0MldP8+MFa2diUnlDp RFu/lzzRD8p9njsxudOYGbgt1JYnxtoqa6jVJDqv7yCzLcNWaNkPXPYeIhewlGmc6cCGa/ xxYaWEsBXfJm5woH4st/JKZbM7GADcc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=JUQrsli+; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.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=1687467510; 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=2Eb+j9CwUC7id1UfJ3PvfDyCTUrJGOM6qO6/uKkU0mQgMS3wEv6BF2MQbut3zjBUY95BqX 1y937N27qgB4y5l5xHNqZDgjUzz/uun0w41wIFNTJFXALwRc40f6YZYyEsKkYD3JbON4bn kWcXvrYoPqLRdsu/DbZFTkAQDEwo1f0= Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-56ffd7d7fedso80334427b3.2 for ; Thu, 22 Jun 2023 13:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467509; x=1690059509; 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=JUQrsli+sZGsM8ArTlB5xxxiXKaQ16kjb1jNJsf0EUnbEut5z8LPr7zozX3ngN3J6U oj9/6o1cvTbYQi1Ubens/5FSyer6qx2thXPWjAh/xxc284PvAGzN/QcAlMX9ynhGpd+T qPIkIg2LWrvLj/PvTjq3bl0zpKRlIAyxwTdxLcPdZ+3tz8EC/Gj9TafQgAoQSYOL+27+ CzmubZqKv2NQZEHqYF4zYQ48aNi68OK+vRu/rRbQy5mdk2My4qXesWcHTBf8AdzAB7RK OxWWIhxNEt1q7Zuw+9arNrILmoHLJ1cED2gx0CscP7EpkO9Ko2k74vfvaSBElKBfCj0j OqcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467509; x=1690059509; 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=K/EWC+mMss2DQMD5cAhSiSPvWsrvNQmEbIgR58Ya9ErlVeV24NYgOoURMlKx6/Qwhd ydbqyDx4Q+Rv5OYmXAduzseEq9+f7Wt2g88nUCwcAeyAy4l2iM0FfX518cp6oc6W5dqU F5q2FFX2PBZEHZbLtKKai3u6Dv+FnwlhsPOvrCWcxko/T5ZoSaoa7AQraIpDfbGxDymA Gg+/so2CAlZ+KPnJOiwqeElMjx6lQ21QmgMBe9CtOw4JvJJW7zKLH1B1RDPXown3vpsn oCMxvpWbGqyMT/wt3jD+O8P17cQ2S2IoSUEHmBtP9AJYpxH7riQk5bmefX6igV3Ffbng 2RHA== X-Gm-Message-State: AC+VfDyWVXYO9eIR1G4CPT/RyJnnYVtuGLkKPJkMcjthmMeV8TQRaCuE RRTX5rhsm2hGv7JJnNABS/w= X-Google-Smtp-Source: ACHHUZ7T6Q6eadVFq1EkBKsONl5ooGMQ7R2flB1sllXachKXuN6+pkqfDDMeF2C+84hA1P0QBPzXOA== X-Received: by 2002:a25:c785:0:b0:bb3:ae54:9fcd with SMTP id w127-20020a25c785000000b00bb3ae549fcdmr16462955ybe.23.1687467509110; Thu, 22 Jun 2023 13:58:29 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , David Hildenbrand , Claudio Imbrenda , Mike Rapoport Subject: [PATCH v5 16/33] s390: Convert various pgalloc functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:28 -0700 Message-Id: <20230622205745.79707-17-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1CCA5C000D X-Stat-Signature: he6oiqhkgi46rcgdkiz3f3iqsdntfs5g X-H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SsHciztFhGy8AJIgT9nnnom6SOi0+Iakx2T1HgrF4q+Rw1BcZ9teI1A8JPadvMGCuQfPAgIBQE4YIX1pGadgFSAQb53ErE9Dmbn6Uta3/EioANoRBLyMJ6ufztFqKeVpuqF0XDyCKhV1aPcWS9pL80Djs/aKr5KkSAtRFdFIzFR92kICdw174lve+f3NIXsj7PfhkjpaU2bfwcRaz+Jo6pAhLNvamFso53oc95lLW6PPD9CU/R5w4iEbiQGXwBNoDisaX7QTCKiKKnrj9RBqH0tkRkg6hqoR/Bqssoo9lxyHK8/DdQAQQ7KCioi3G3fYcxpwNWXwmvMnqOHxwjP5s+bI3i7uPBXc3+o5hS3ztYdZZcFNAdNAfmD6nr7+2FU241vOKefR7+H66kW/a9JnIH9hdtRbj9VfDbLbYLVZkAI0wkWw4I49muvhDfAocZcEpZJ9h3IAvpER+kpK/dYYIiutrU8k47lWQCIkjhBk2EJX2k2fF3Jc8KepC2etA5uPhrWF6mcaNfFS8wjZsw== 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 Thu Jun 22 20:57: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: 13289614 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 B6726C001B1 for ; Thu, 22 Jun 2023 20:58:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 575488D0013; Thu, 22 Jun 2023 16:58:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 525028D0001; Thu, 22 Jun 2023 16:58:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32C358D0013; Thu, 22 Jun 2023 16:58:34 -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 24D678D0001 for ; Thu, 22 Jun 2023 16:58:34 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F278680231 for ; Thu, 22 Jun 2023 20:58:33 +0000 (UTC) X-FDA: 80931597306.12.FCDF4F7 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) by imf30.hostedemail.com (Postfix) with ESMTP id 2755B80008 for ; Thu, 22 Jun 2023 20:58:31 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bxkxtD+Q; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.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=1687467512; 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=1ovbVJsPH7qh1S40rmKfL/lUi/O7+6TkKVUMzBlyg87xUQOvZ6PtXEqQAGGJqscUe+/NN7 D8Xtd7urkrCAFFyVtfiCV5sD/iNq8HIz+pQuJj7aLavE3M0vrMwBs9uBayLLHIHa5U7kbm wOvtYGaE8HsxxoMQRYItTO2IIDW4DmQ= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bxkxtD+Q; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467512; a=rsa-sha256; cv=none; b=ALrkjdle39f8lJDbIHranajmdgdisUmzt9EI8kfAht5GT5hvQ4YjQKRdBIAI6l4qlKWz3v fyNTu9B1mJ6cJ+PfVgxPV7G/9U36A5zX30CPh7d19CgKg6HDyNk5Zdz5pbLUWenqU9f4jp DpdBtGNbhemEVYpXTQlqy5E6swnsvA4= Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-763dc87aac4so187123285a.2 for ; Thu, 22 Jun 2023 13:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467511; x=1690059511; 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=bxkxtD+QQAC8zd161RKeCcg6MaoPAPE7L+CauClsYEL0Xy9+Td62VuxUGsgYxnFiq0 O6uvJ71cZ3HzaD3sn95/EOTS8BXKpmL+IQrAYm0nHFHW9S+p9vWLuqdK4qFg64CCRbun joR+Hl/5hsxihcXKPDNMSOwFhI08HqC+OD8d0u+5w8Qz5HarhFJT9jfwORvF779fEL9V zRFvHmiRuYANo66EVjgtR36nI9raB2GVIEDQNVqxyl97sNwtEBiuGHRD00zHWqOmK+wx CCZ2jYpmNaAVgCE8uPmkzzzOyp8bu94YHjJqAydk7W1+LKznmMU3DWFCBUl+KliiUs4D rLQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467511; x=1690059511; 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=jM9n+HtMmJA+QWG2RaLhXo8K+o5k4ngE3uibWshE2E9yTozv/pM328OjlCP7OvRF9N JZi+u0RRsWkGqNX3qXswIPJn5wmwnUEBaHqGuPSk1oCBxlIo4zVg96Z+v9vw5C8bsyeJ ufiFfBTaMWOIvklEX+27C1o6p6ZfACtGlAvcw2Xp/i9mT6R475yGQbUuIiqQeiyTQmdR oE6diRH5pAV6M82B25oBopXzVpz79qLMkfT53Cwnxskv+FpUcXNz6NB356OHSHet3jGt wQ/s7ONv460p9qdiBZWyOCC7+3w0PfHpZdzrR5NeVJEcLuzSZefPAI6SUV7wulVA1uZd Pd/w== X-Gm-Message-State: AC+VfDyApmYHkJ9M4GZAHc1nSJDH3aUjdz+nvyuSkClberWE9K3+71wV SaPY4m1hVnCJggLYMRNBeFs= X-Google-Smtp-Source: ACHHUZ4ad8Rj1cEO907Psdq+ajLgAiK0FYJ6eHB9wwgKt19FWwArd1FWX8Y4TNXwZH2eE/VH/YBYiA== X-Received: by 2002:a05:620a:4790:b0:765:41c1:31eb with SMTP id dt16-20020a05620a479000b0076541c131ebmr1410020qkb.48.1687467511080; Thu, 22 Jun 2023 13:58:31 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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 v5 17/33] mm: Remove page table members from struct page Date: Thu, 22 Jun 2023 13:57:29 -0700 Message-Id: <20230622205745.79707-18-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2755B80008 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: snwapx4ww81qwe8g6poppc7n4g7xmumf X-HE-Tag: 1687467511-779148 X-HE-Meta: U2FsdGVkX1/lE7nJTNpMdhiSi4okobQ5vDAa0fPxsI8QollFUCAmTudH8QV+pM1Y22m/iZoqssJjhww2lNO3jiz7lNO9CNscZt90rC8rcgDDGVbi1/IvUURtoFyagLfS92iEkNDdJW2y92nVl93OgZQwhbahgoaIv4/FI/iHEHJ6TclJUGHCAAfY439/fDJbGrsZShzyByGIzr6AffaVaK/rdYGmQrBnPgBypEtQTNDtl5Ar3hkdcwQoHea1gI1gT13yh6omlu5DbvCgaa7uW07sjv0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cRz22BvC1ei2MaRNfwFzMTV2mpZ+9czNoZ5NvGE8Gj51ncTapZhc5lCKbiUZFGp8xjMED/UySfoEe1lf/CYuLUj+JXs8uuXFzblx5yhuzUmtwC2MtpmrbP1xYV0QjQqvto0e3BTHkajOLf5t9MAZAEmt120DH9dnAP/iQJR/aeCKzT1uek9Uxy0xjxMsnzwliY4Qn66rJXUOFvkMVe1sQcB0BOI5EmS7Up6g== 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 Thu Jun 22 20:57: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: 13289615 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 CDFDCC0015E for ; Thu, 22 Jun 2023 20:58:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4641F8D0014; Thu, 22 Jun 2023 16:58:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 413188D0001; Thu, 22 Jun 2023 16:58:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CADA8D0014; Thu, 22 Jun 2023 16:58:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0EE428D0001 for ; Thu, 22 Jun 2023 16:58:36 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DEFD31C7F6C for ; Thu, 22 Jun 2023 20:58:35 +0000 (UTC) X-FDA: 80931597390.24.74B17BA Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf20.hostedemail.com (Postfix) with ESMTP id 178AF1C000D for ; Thu, 22 Jun 2023 20:58:33 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="U/YhvIXs"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467514; 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=6M947hkKZyFNiwBhkh6lU24av1LJslk8EUEk2/URu2TpYLFVGIO9em50Y8lPuHurff8zHa ioLl6BHhuRRDy9Db5RPunL4abYbUG3jnlg4rNpnOO9aXL7cKJS2RCCwidoQh5I69BcdbT4 Cutwa8GNa8iruRvbMR1rga/YIhGzwnw= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="U/YhvIXs"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467514; a=rsa-sha256; cv=none; b=J2LzCPD80Sh/lFaznYK7/X66JeYh1DwzYcb5+ND2h1ORvg8JN/Zlty0fMmPYEPAdfvmc6X kCEBXoj5ImCZA5zHFE2wjRzcuBukg/VRaHKk4JhSpYmGNYRqoUg8987xeKnwIQP5vZGWST PLHJaSKDxyFEwD287ylQVDAaztVQEmM= Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-bc9782291f5so7432830276.1 for ; Thu, 22 Jun 2023 13:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467513; x=1690059513; 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=U/YhvIXsF31wyJbA88HCf5OMe/axiBVQv7uWDZihpT9cKR36AFdZIT/f1WwSyzH4hI U+m0TMsQkM7UPfGfoV+xyDDbKx0sn4rR9VR2kSMc/ekrVux2GO+7Ic+8heNm0pglVtP2 t1UCU3KD4xkYuJJWuiek/S+QoJhBCWN2Lbj1sTa5MjcyOpNlRy9xyvjddQZRa5sN2lln b7+B68MAYuCOvXQ/r3g8J9suD6O3M2csXA9+uWAiXx9rhZT2WrY6ABRuoILJHZtSBr2y 1QWhI34MPT8UQnj1JkQ7Zf6eaKvwmPeBbVlvE52nu4uEPYScQoo9/k4f5Oli5uroIxml dglQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467513; x=1690059513; 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=Nxly0Ej/UYlby4W0hDCBR3JsJk7eAn/JwKGDZN/a9cfsBvMuQV41a1AteD4oliZn+N mgc9Pv3Ul9/X34y8LvnoEal0MC8cYhSK3cEpb17VJwNMJo1SM/RB5/7x/H+OsVGv0Aar AwNfO7VdQPjtmJ9tgYCUrS331Jqg0YUhL6Ds4PUrw1fID7+dikpBlgz+TN3oGNN8q1zT /c/gUej35I3W2cGdrTr9EK3SSc8BWw/yKUQTUeKqtavfrxeFdeVU5mda82p5fQE40IxR oh4khaJw/rX5T9ilLIi60q2RjhsEiVwFOzKhfS6jPqtV5cwIxXUdAf3ca1Zx82DVcG0m uwtQ== X-Gm-Message-State: AC+VfDwbWRfARpD9f35T8GptwVq9EnXivFiMUSm3W+PE4VJsQik2CTQ2 gmRsjFPS6B8iJwjPrzgH/gc= X-Google-Smtp-Source: ACHHUZ6hexLSx7MCu/vikPSHcuare299VqfoBmWOu7Ee1hjFQNgv7EnnmzWGuhYTdY+5xZGWojZCRA== X-Received: by 2002:a25:2f83:0:b0:bac:689f:a7ca with SMTP id v125-20020a252f83000000b00bac689fa7camr15467880ybv.15.1687467513112; Thu, 22 Jun 2023 13:58:33 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" Subject: [PATCH v5 18/33] pgalloc: Convert various functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:30 -0700 Message-Id: <20230622205745.79707-19-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 178AF1C000D X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 1csek6wx35itwnzgfaxtnrix8jsxccim X-HE-Tag: 1687467513-801107 X-HE-Meta: U2FsdGVkX18WmI6qIV7kDjFjQfbArGjUWV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7DemsqxRU0N6Ya7UDQLL+f8zEEd/lwPm7z75NX1M6b1tcSwLDIKE2pd2zjNQVUJCOLd9XIzanexMIaFRkLVBCyhrCw/4Zyn+Ylhwt2vM666k0ujqEx07qfdOOD/7uOYDV9+xjksL47x16mSCRzMe8vx1EfISS7i3ldyDsi4cbJ3J3hD1JwLTUjbwDo0xJBphUy/HB/4898avQT1J5DPwiBMepqhDUn6MhiTrK3b8he9dFnaKnSaFymRhZ4J2JovxozoqYXzQmPvqv1lHBh+J7+Rmrzr8wQ2YvWNvWofPjDZD51LJ9FhJ+K9KnYhww590ixHj7MPsDkoIZRgGg2Lu9FAn5ANQiN9gXj75aLKgWsJC0P9etrWq0b6dXFuVgK2jnplo7ialtGrSI1JQZma6Z2NHlA3jnA3wOaL4ZxACvYGJ9VnpiYd5RAPBQBlpeJA== 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 Thu Jun 22 20:57:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289616 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 B2CFCEB64DC for ; Thu, 22 Jun 2023 20:58:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B2058D0015; Thu, 22 Jun 2023 16:58:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 43B608D0001; Thu, 22 Jun 2023 16:58:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28CEA8D0015; Thu, 22 Jun 2023 16:58:38 -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 1B34B8D0001 for ; Thu, 22 Jun 2023 16:58:38 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D75AF1A04EA for ; Thu, 22 Jun 2023 20:58:37 +0000 (UTC) X-FDA: 80931597474.13.4034DF4 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by imf23.hostedemail.com (Postfix) with ESMTP id 12CC8140018 for ; Thu, 22 Jun 2023 20:58:35 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=aYnvKxdc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.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=1687467516; 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=3MyRrykA8HbhRrDfEBM2FceZ6dDcPvsgx7rmtuwyyfP9isCBYFOpTSP8Y6+11SFsdWvW1z fY83P0RYf5b9vjLW9d9UCq7ugQ/xCk4zVWzr/yS1H837ETkDQjZqSY2KGvhSNSyxkmYXO6 +LjP6fNhy24ZlT7qgcx6t9z5qTbzl3o= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=aYnvKxdc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467516; a=rsa-sha256; cv=none; b=dCxncF709dm+gIH9uRdY/VKP4Zo875/KTnx5Gt1iYuCLNzCZRBJbG4kgKUiQj65v22D7t0 pVqvIWdPkorBrklqQwfMuJDNpSBSv248YVGtM56yubpwHOAu+IFINjwdLipm4LlukC0uuj zOaNNEPVppsQNGVb3qvWf8pqLU1xGAI= Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-76244657caeso578959585a.0 for ; Thu, 22 Jun 2023 13:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467515; x=1690059515; 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=aYnvKxdcWv6qwRiCaWGJVXxgi34L6bq8ffoeujUnALIHtFuBXRmM+bcP9XCahDm+sX c/aqF5jzy/t6hTOr4VmOAf00WcyCDW4uBsXDaSxBnZc2Y5pzs1DtJ08u48NaJcU33gxe biARDPsxQJJ1M4wS/EW+UE7Jv4/5cxI8wBjMD1x51K3UK2lYTvqb8DS6s/XFH10WDh2J VablBYi+dZASmJrgz36uvDp4UJXSq36XOIyfuFYT8xy605670eCEF/XRu34qeL3h/9QF NP9Vpp+QW87o+p8FpzexMhKxgQg/GTdeD91r7OzfnHYpx/Em9cW4zYexsWWaxdvDLTnY 5oIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467515; x=1690059515; 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=GTy99RLN1uIwxEkJCVGu3QU5rAHjKdKKtAqUTft6KyMt+dCxXcrdUzCylme7dG5B9G 6Rt1yS4u3UN1srTwkGHJ0mvN9q4Quoc3kJ5msfXiWCbPG6UMaG8y0icyTd4GCaanct96 vSAccJh45iLEuwcSXAr4YoxrpHse17e+muRW+mKFGsH5LQx2+DSpkbX/k5rzSu63mdxj 8iwERkWBn/W+d44IWI/cQM7po0T1dtVs+6LeLDh+kYIQA6HglYSg+PijqnxpCPRYpCPf Zp5vb8kBG2PnlVVJ/+rWtX25rtVu4rKW0v4Hza5zbr5Epo736ieGwNpEY3BxxrP/h77i kWrQ== X-Gm-Message-State: AC+VfDxopmLs0YZwZ6GIpxJg1dxSQp8/gzgfaptBn3/gwFPeCGFqFEX/ xwHaPXjoGPpDI8kktyURZGw= X-Google-Smtp-Source: ACHHUZ60juxfhAagNO6Es1Dw+TzUsWcwO9UH0sU+P0uZ6ZZDjPscGIIYCumcyS40JVtPdjZ8M8DAow== X-Received: by 2002:a05:620a:21dc:b0:763:a299:7235 with SMTP id h28-20020a05620a21dc00b00763a2997235mr11483461qka.0.1687467515158; Thu, 22 Jun 2023 13:58:35 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Catalin Marinas , Mike Rapoport Subject: [PATCH v5 19/33] arm: Convert various functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:31 -0700 Message-Id: <20230622205745.79707-20-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 12CC8140018 X-Stat-Signature: z9cdb1wopgx3dgsubw6d193wfwigts4p X-Rspam-User: X-HE-Tag: 1687467515-449175 X-HE-Meta: U2FsdGVkX19r7092ZDWlR7lFypQ9228Bx3aU0+x27pVhx4QRsaZw8qZahIJNqBenfq7IM4b2I/jFNOmubwQzsjslYUdgFQ5xndAiBTc05WXOBPbhibrYws1Mavd6Ds2ZuJ6qCx1r86lpMJweT7He5USj0qaF0I1XuVYwp0S2e0Q+Zf0eR1bBxLOBuBXhPHzWgM08c7i6K4q1GLtNeb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pRaM9oH/+FOkQS9IbWGfytEfp1pZwXJ/alFy+FdatvDGoRKwy3gerWTgyWB/fW+rEK4OdyEDCHlUSkzRwpW7SSZzmizk4U4dITSZs4B6Nx1Qp/Y69hI0/nlpQklx2K1eGi96azGN2cirEFn7dmq56OitZhZzifTFF3WBHFakTHVCuP69p3zHoqk+1vOmY+xGbQJEX9gWEVnt1/elSnlFAY0404n9QDqOTcMjQwPlk01hwScSXKFqq8JLoZSzdSeHVi++Y9rvaNW0Mm2nY8IIqU3jtIwFr1XYJx0JGlRUpecXvVlQ== 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 Thu Jun 22 20:57:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289617 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 D18F0EB64DA for ; Thu, 22 Jun 2023 20:58:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FA978D0016; Thu, 22 Jun 2023 16:58:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AB198D0001; Thu, 22 Jun 2023 16:58:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 54C828D0016; Thu, 22 Jun 2023 16:58:41 -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 440828D0001 for ; Thu, 22 Jun 2023 16:58:41 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1CC17801F3 for ; Thu, 22 Jun 2023 20:58:40 +0000 (UTC) X-FDA: 80931597600.23.0AF72E4 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf20.hostedemail.com (Postfix) with ESMTP id 31B691C001C for ; Thu, 22 Jun 2023 20:58:37 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WzrZfg7I; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467518; 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=ttWJe8mD+tDLtiF2/clFQ8cBY5yriV9HQznRsBtYNEl4cEu5XIj8kwno2AaU9H1UIQl2q/ +V5jvE93KoP3Yg1wiOw4vlx0ezBrhVJsGPlH/icZ4IvVm00kSovhVMn5fFKjfDCFmNbSol d8wbgTbjolaFcBK/+RHIu4JS0qAUOFU= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WzrZfg7I; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467518; a=rsa-sha256; cv=none; b=4rxOm3CJJ9LF8lCZv71dLJMCyoRn0Rz2w260qWpZXjJdZqyFS6FsbdboO6rt0PDRjmHoy7 HPOLbnbUEeaQRtvH5vbwI9cLvtkSix15XnFx6ZDkyIp/gpl1zACVfQMLDI43I6l6+lchH5 BQZqbu1YCNjqQrltSgwX8zVgpQ81Fyo= Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-bff0beb2d82so2083128276.2 for ; Thu, 22 Jun 2023 13:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467517; x=1690059517; 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=WzrZfg7Ix9NVgsDMORZZHtKMCnkCtYTNqN5BxfEl0LqJAF/m52D2DjGs1CtMdjlW/Y FCQoo6ICOsgfyZao7TI8v6fZI4UENFpY3jZe81s91B3mvmmCsOIgDTDPzHKe5SMRuqNo GqmfsZL/fdh4LhL0Jo2UTpv/Zzerp4OFJp5voue8zSTsRJ0/4bzo0POGwXibz4pL7ew3 XfWPis6drhy3Tn+kW5uEHt9jkm10f1F49xoaZHUD6V/XhEZK2GBId7pwhiwEW8CobjeX ndMopKlNsVQQSaeMMfuVNTCC7fSMRAuphXmsb5MG/ItVGni8JlC+amvlrfvw1GK2MkRJ BN3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467517; x=1690059517; 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=NMZ5ubNrRpY1d1iXQY14IS87d6C3CKleLoSnz5JC+5GSkHUkHdC0JFE2aJQ7Q1EDGZ eh9Arq2Ep3sI9FrHKUjgfyvJgyhk11VshZgW57LECgXNsraid6cXWfVXLh673ee0V9TP Dha38ULZs6qRYqBJwDuEr7GXOAZXfGepxznjPhZ4JPZf95ZrCWRtcugIC3wlVMfcPE4t gMxt+LWZzst7YJvwNS6vWYNS1AEecktJBpbIioX3OjPjdF0mLgU2HRFMOWVzr2Y5oC4X rGv3+loZibuYCHenoCuO5PG60IMy9Pd8Hmyj3Qiawazc4tmbs7JnZfhm2SZuumM25+m/ Awjg== X-Gm-Message-State: AC+VfDxy3FSnDP9wDfvJExubW2U/TqspHacUAAN776cORV25hFdsEjns TrYiFRre92Lv8d41URU9fZ4= X-Google-Smtp-Source: ACHHUZ43E6q8U9GZrhFDLZLO6dXpt9JpmRg2Kg6CKMns06auYc1hxRdgyW9/NyEhButWG+5gdBeMhw== X-Received: by 2002:a25:b190:0:b0:bd4:8ea4:39bb with SMTP id h16-20020a25b190000000b00bd48ea439bbmr15159544ybj.4.1687467517233; Thu, 22 Jun 2023 13:58:37 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Catalin Marinas , Mike Rapoport Subject: [PATCH v5 20/33] arm64: Convert various functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:32 -0700 Message-Id: <20230622205745.79707-21-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 31B691C001C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: uu3d6pckbjd8qpqu9amxdh5s6n7jyrwi X-HE-Tag: 1687467517-753725 X-HE-Meta: U2FsdGVkX19mkznlSDsb8ap2IQtqqxuUXfp6PYGfH5IxGs4ukHKAiaFWOjxgsGPVn3G9s5ocAZ/x0anyMdfCFlGaKa83HXhhpsoJpfWSmEyhNo0LlWQTq3mDEibjgoW60tMpKOoVJg7egfKgGP0GJ4pyKFTw4Yy1h8Ri8hkO2HvvD8rdqCzG090VxxmHJoYGOKE6GGEUpAJxXJtkyu2XXohqrulMV+ZVEYemVtgQo0wQbGod/8bV2hZ3THyKKtCAcDRhoErankkhnrS4Y9TgdJwPEvu9J9KnK2Nwdy1kZ0EE+s7gZvN6Qd7vNvd6EseO5pl+bYHqz5Tf6KHZImBnTF5vh4Hc4ExykmjRbtGPzdiKrbK1vtaC9Ach4a9rb7WVbhqgbSzwGyDmZvNfHMGriSo6iOFqXyrbfC3Po8q6gOuYXGi8aAEYSr6F4jbGfcniG96saWexFG+GwBaXCuDX00Rsh8ODGLoDJNSw47iLcOfbviF25uCx1enGvWdeBsHNur/SU0vfl1VScCVSIMjJbZztNnxichxYGq6rMKxfQD0ONFk3mDSGaWiTCkl1JqFQjhf6r38lZMLCSdS5QIV3VjlDBp88DZqDuIbb7QxCUA+EeYJr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.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 Thu Jun 22 20:57:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289618 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 2C791EB64DC for ; Thu, 22 Jun 2023 20:58:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 91E7A8D0017; Thu, 22 Jun 2023 16:58:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CDDE8D0001; Thu, 22 Jun 2023 16:58:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7209B8D0017; Thu, 22 Jun 2023 16:58:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5F3AA8D0001 for ; Thu, 22 Jun 2023 16:58:42 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 36C2480180 for ; Thu, 22 Jun 2023 20:58:42 +0000 (UTC) X-FDA: 80931597684.06.9589B78 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by imf28.hostedemail.com (Postfix) with ESMTP id 6BE61C0018 for ; Thu, 22 Jun 2023 20:58:40 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=BLHldLJJ; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.175 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=1687467520; 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=Gq/4ZmKNXFKQVk1gkO+uwnqoX5OhH7CpF4mkXffOxUMET7q1bZxQwyBLgsNRCgmtqcBh+B EhLj0l/CrAA2knJqThg0Tt234MR+bspEjOkcfHMmf9TM57sm6lgw9B/GrtFyYOpByPDtBW 8gLuD91kI/Rk38ikR1xc3o7XFxypl68= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=BLHldLJJ; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.175 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=1687467520; a=rsa-sha256; cv=none; b=Jx8oOJDspSD9qdsYL3lx8PlkDp7z61htAq5tS2suz++Fbdy7Gs64/p5XfxDloI26J64iqr 3AhAQ4Rk3eaGeUzSt0Smr/B+sdlllFJgtPcBFJ7L9B2BmZoxKlSyWwAP3leYYX9wxEsNUu 3oxhq45u/p8y327hpVfoELpUezsYj/A= Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-76300f4d7eeso451165285a.1 for ; Thu, 22 Jun 2023 13:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467519; x=1690059519; 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=BLHldLJJqXLpr8GAfoHi79v0sph0w6vN/SuJg9rBXjFWP7vHx2aGmaKx+f9hTGSIek StBGUDmlBLLgONen/ouQl25e+2Oh56rCFDCpMgFUEQOkNNTjcxLzf4Qpme/gK6EBGlEV uCg8bxuRbLrdLb22VpaeGfLLJwjdPeKaXRkjf+OAYYySwTDsQSI3SAbqeNXGAGljALee fcpdhclAhH7b5XES0gNbsvIBabKOZu9Ga/PYBeMD7nv08Dx2WAP2VJoEQ2QraVWTFN45 Wt/gJDKXfFk6SzeY9rfcZjQwBqyFukcCgFCguNA0XxXJLEGG2f88pPraJdoTC9IQG6ul Gb7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467519; x=1690059519; 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=GHCOPR7BzCkWwLOq4QiTnwq0a0fgOPbu0LjLWFRJtfoeW6pvUP8cd7MNegDlc6Fj3d IiUWeerdJQSI+Vzj+R1edNLQvvwR8W8veDXgAUd2g7jPYkbNn033AtFDahR+BgdL671g Vs+hIgdW26y+c28Dv6/gu5OgMIPENm+wdTQkdqsRcup6PuH9jI677GpDbUzJydqbM4/0 aTYu+bW5/tWCkPHkAesO9tZfa3LImBbsMnOkVo2nyRP832mGhB78Q/KBl2ZyjD9WddMt WVxNDV4d2uNAi8txrYnXg4uAuiBIvaDv7+4owrI7RbcOmHxms9uZy+9hAPIm+81d6gJB n/OQ== X-Gm-Message-State: AC+VfDyy0d6RvhASczpbqFV8iBWjOYwg21FL+l/ZfNyyFCuN1XhC9Fs2 L3kg5rUJHen8pAoFq0FzMOs= X-Google-Smtp-Source: ACHHUZ4KRcOpBQjT0rqr9douhR2m3+ahnRE2h5Kbx3P/xMpW7X3b4hHm7K0gMXBTqIp4OFz3bRB+Jw== X-Received: by 2002:a05:620a:2cc1:b0:763:d981:d0a0 with SMTP id tc1-20020a05620a2cc100b00763d981d0a0mr4781474qkn.38.1687467519407; Thu, 22 Jun 2023 13:58:39 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58:39 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Arnd Bergmann , Guo Ren , Mike Rapoport Subject: [PATCH v5 21/33] csky: Convert __pte_free_tlb() to use ptdescs Date: Thu, 22 Jun 2023 13:57:33 -0700 Message-Id: <20230622205745.79707-22-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 6BE61C0018 X-Rspam-User: X-Stat-Signature: y4z1rr6f7uh7sqj1fjq3cazihu619bh6 X-Rspamd-Server: rspam01 X-HE-Tag: 1687467520-660634 X-HE-Meta: U2FsdGVkX1/+Ec0v8wi+RfyxYGB4uL2nrPBhQ/fXw5RO5zzno7I09pmM2BC9LSWxdWdZxWLuXdED03KELfM03mF4cNn8+FDvO/kH1Tpxaner7muqPfHz6CdLEQgJGdjT/WtanyVzOidydFx+KnRhq5t75LSmyOeHQ9CbGSwTthnwwvRVIUuNJyLYvo+zsI4CdAPGx65e2QsyV9QuOGBHUOHTwzysxYZixwY1hJhHkvug9wFDNj5+N7950m0KJPLxBkOLoWFiwhgzxmSXL7W9voqll21H/ExraX/Bsd742JmogoOyYrcJJBzbW/HOJtgUtEFGRIr74uw4H4OQ9pxrk2ZyJSxN4vbqcJEtpFVlYW+QUl6YuAvnqJ3/G1OQfQ//6HQIfpiTsj6PKlKIq11FjxNFeK/1tanOsQUZAxOGh3hwVgU82gerAvSJjckIIvMawYg4R3xgBbcyON4lXHPfdgOrdr686pBUkooWHhqclSZdHe9ekOb0I9KoFcLbEiOG56wEgofqfvvbmkKpOqdyZ9N75aa93d9gdGoTc/M2y7IV4SiQFq9OaJ85ZDjPRhMbg2NvnvYa5MEyz8u6oKeg9lfMmGPt4Lc7D3LSUynJCeQlLLGQlC9ib2+C120ke8+1U2iTa69FNz39asI/FI2Fax7EdRqrXievSzQzIbEhSwfSMS7Kawi5f//ZTnKb1uHoQlLvmhzmTr6gflMJt4A7RjIJQPkXDa6MFCYgJCGDsBhx5FWQjMP6EZtY0HjK4dH9PueZIdFjBB0smfDKKi1fKWQIZbkJ3cIWm2+Hxvu0gLy3020UGXwco5OjekJqtNrxgqyLGtUOSFIiAk1aVdGvYibHlh3HMOouVOSf6Glk7VDVbTOpt1ywGrm/kKoleoH/SqIIij3lXVTtjyJJfJjZ1SYCL632bUkFJwzsZra+5KCB9gSYUgqfVXpqNq1obaBtddMul+Mf/u/ueArcbo5 PKnSRxmE I+cekIR0YdGcVQQNOaQpCkwyVGFtN4gcdRZWhqRuR9Jb54fSHZHxCubyK8qb1Kcf7Q08AGpVzCCWh9gNK2Ie3u6yhIDUHhCchHk/cu6dVVFhmgjbP6ep3JKgxZu1LO61aYftfg7+8YYWkuZ0svRsm7CbfHJzeRp1AkU+MoOT2NeMu2+xCxUYqG4VQ9m9lwIEHYE0YefU5SUOroUOsQWk5wx0GjKjVT+zhSEYe48hEM+pemmi4i/kzPDjE6Ctu3fPS6KqQ8CD8WjLC0KEosV+L2CBnMgkgD2k0PIJsqfImP/d6wLPTEvxqliL2iffj78qKt1wV5QMnRlT7+aYn2cNS6yBKsc7npRqatszaMcZYgK8tV0wpGn0O9OtSQwJJO9BUXGzZpsxVQDOM8PXqyXM75+iC9/fELTPh2DDkDvsEe3t6jQ9L6MhrS76eX7d5iR6AeMgwwjwOKzvfcOHwM82N6nRlqr3ocTyHo+8V4/isQ08EbEehi4sN0W4+p8DT5TlMQN2fYXQrWPI3v2NY6xgc36pFKTdDkh2o6XgO+k5gyhJ/9GrWb8rkOAsl53bT5m+parIIgxhGy2oU/VT6/kVPceRD6c1/hg2iXpV0W1an+DbHNhMOXgpUXslzFjZMMO1iHXoh+gybp4HoYA8= 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 Thu Jun 22 20:57:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289619 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 12BBFC001DC for ; Thu, 22 Jun 2023 20:58:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A2FFE8D0018; Thu, 22 Jun 2023 16:58:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9BA4B8D0001; Thu, 22 Jun 2023 16:58:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 859488D0018; Thu, 22 Jun 2023 16:58: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 7418F8D0001 for ; Thu, 22 Jun 2023 16:58:44 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 451B8A0A51 for ; Thu, 22 Jun 2023 20:58:44 +0000 (UTC) X-FDA: 80931597768.20.D004000 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by imf14.hostedemail.com (Postfix) with ESMTP id 6F0E0100007 for ; Thu, 22 Jun 2023 20:58:42 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=mxSRrVts; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.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=1687467522; 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=onpSsQnvqTgXXFi1WIlM8txVs66tRoX40YQzP/3Mwf7lWC6eYxjsS35a0DpfBpfWJpMlCE zT48MJ8Qlyl0W+KeUcR+C02BZRaUusYCv/tyDwd/GRg1hemH+Ocenf0SGRbv1Ub2IFBZF2 XqymiwwyWY33nMKw2TqjCPcdTStrObM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467522; a=rsa-sha256; cv=none; b=yxposHZat4l/Iwi/750dUbCXK23oHL4L49iZHpT3OgFJ+Y/8rQscLtpwuiDCecBA/rmIpX DLrRbdFuLNgOA1jIskjYRlmDLW8ZfGlL+tkArnk7NdSi6CF5eS0hSxxL/L7IzG3jLDMAfY oKphdeYl3OUzqKkkehegg4XITTeqAWQ= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=mxSRrVts; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-76245581814so521715985a.1 for ; Thu, 22 Jun 2023 13:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467521; x=1690059521; 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=mxSRrVtskejfc/X16Q74dptO75kex0U1BDLuwz97pVRe94MsJ1tXF/mDBi2+KIRPRR 7frc0Ipdbv1qDfHMpCRO5VQbJ/DKNN2DmrrOctIElaXq4X1eS2wG1MgKx+EEIDm5IE/n dhPljY31cmgrHKk6DhfJfpvGe6V9T4MqXnsXF7ZHxbxJIsBPM+C004kDxiRMae/4a+6A l/JL+zpf4vx2gyi8iDyTm65oAYm1ZOIjSFK4K+nSdgPKFtV6K4nHQ1K38iP6GDgp4k/p RVulC8Jyfz61VS4MiwEinectlQ9R+QOPA/9MgDEtR4kVqNBk2wlMydoonlFLN2E5gAjW A4dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467521; x=1690059521; 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=X4R+tseUrMDXROHhGIsO42RY/KyqYhuO6E4ANpZx3xt8UGq43FNE11JG8zs4jyEQKn cwiriOTOIeV8quZ3dJ2Se/CKHA8X04xk1JEsl7AQiZOmbXBO3jTXCQgoOgreN6eLW5DO BAh+5yyE2rkVl3/v8Ksy81IyiBbROXOKxVfmDXfJBsdkTOoAinbivwyfcj/7kxNmFWZl iJSIJ2pM5dbqVJQW3jsdQq5hd34UpP/kfmtilRoeVPjU5g+AiE6EEc2ANpPdMLf/CMUa 8zvUB05JQL5VOmV3dVbDPrgkULN0g00AgR8CVK6A68nmqAK5Q8fsb8r+1B01yBc1zaSB BQOg== X-Gm-Message-State: AC+VfDwHgXlfQ9dy8cVQLdEdfzXT6avj9yyNgJatTORXLvtMzNjDNMVO WmLMsSLomqHRPtv5BVlagL0= X-Google-Smtp-Source: ACHHUZ6uwsaC+f+4ISzpiwzmvKryO8fCbzH23CcTApoIn0lsQ518YuGTPwW7f524cMEve6g2SlrGNw== X-Received: by 2002:a05:620a:c82:b0:75e:6837:19f8 with SMTP id q2-20020a05620a0c8200b0075e683719f8mr19290818qki.54.1687467521509; Thu, 22 Jun 2023 13:58:41 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Mike Rapoport Subject: [PATCH v5 22/33] hexagon: Convert __pte_free_tlb() to use ptdescs Date: Thu, 22 Jun 2023 13:57:34 -0700 Message-Id: <20230622205745.79707-23-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 6F0E0100007 X-Rspam-User: X-Stat-Signature: smrjbsmqiypwhh83fpjzssqjgjwad93t X-Rspamd-Server: rspam03 X-HE-Tag: 1687467522-392305 X-HE-Meta: U2FsdGVkX181/pRnTWgRL7bmcQAmfAU5O1x/neX+opPCJwrFlcT7WS3nkhPeHl2CNTMgUTrIA12tomy+SozV6svpiE5xMmgKktaEtKam0PsWOPF15MAPcnjvsCnEwCZAO6kOoGgwjBEr0RylN4+OuFQwxwNsSGQS+luQaKHdjZ1oqnQ4dyy2VrueBlbj3kWIJQYtNF2AYnX3BfXkyxLcmbu1qg8C2xPPeE3AIyKruTvuiN0lYMmMvFqmREFm2fs5WU42q50/OdFjV/fylTDxA7evsuOEL5mXUcweJbnUmjuTZVDlMbwoypVT3SZimItiaYdB/rTz2lAN3HlK7J9CWgASmRhy53yIpWRpuNHcPaT6TmA85opz36xcz3KlNnCdh2lS5z7+kOfXR+v5quHYKjrU0MDd3N3znsGS4EvZgtIuZCWWcg9NyAQ3EHqUSU7QlExZWmj/6xXji7v5q1v6cbkJAJXACngQd/FYF//SrVcZPxeYzfZ4c/9w5oQekGWGQd9NltUWuO72HJFYPH3dVINqBHjDoOKw1zUUSbNJmZVuJhAGgn8mb+ioAZvrR3fE6S1osQXOmpZQphR0ZQt/yL6PBzbrdrS96H541YktOLFLiWaKjt2wS31VN9jq6NqQN2hp7IBM5+Mzg78+2htA/f1zVfMJM8WgnZ00vnmaj3VQbz7eKOseYixeAI6IoXq1/SwoJ1UpsyauSFRlpo3sbKTXHZu8LHaTMPu+QuyeL7cQNlWfb2OtQCK8GqP2xY0PfpJGiMKiLdOr0KJVbQYMVkIV1bmhUiIUEKykEqNMhKUJsssFR5euqBacRlOGBYpucMCJjQWjz0zmXJpIaWKZLkUwlwx4gJkJQqGUQhE67iRcjQw1TM1boS6M/9gyE9FenU4Kb01fvLAQ7YwlhVfhfEyObGCoXD53V54+jjsDnrTqnr84zbZ3kphgE4QBpUchDFs7SDI+4lILtpF5+sm NkvVqGER L/NFbUw3sdq8picspS/of0ac22DxV+0wR2xN9jowYXj7+yKhlDBx2E7GRoUM9PCgzqhi5Gk/haOXj4/Rr7ie47/49/6MRVKSnEQoX3hYNiqTiPtRWOj9V5SdliWTCE5k3bIffL2hDQ8g4roWuGgI6smlAHz9YuFFY/8qfDnU/+oZiNy8cxWttmKZwtiLIi7YQsomgJ5iSDInzfKyrhmYoQAHTPVbgYRZMmslgTSzwL0Zt3UEooCtMyJP6ulTDUgJ50AQ7cvseaEX83c3jvYW93t4vMSUpUkOG6FXDyhpGGA1ExjTDCCSqkbdzK6/2gY3GhSLm+ZSB2V/Cg5lITtQ73xIyXeAq6Ed2ruWhfIKFrl5bfrVwqH9qvGoPA9zfXVT+92Icga4glIjvpXNCMp+gIvTjI8LI/dh5o5SC9ipRiwsrrl0ofKl3mTiDe9d0PCbBL7E/NJ6tqAxtIszqVq3aNRDMbCUz11e7bO84E3eq4zMk042cFRY948Wlj8kVHfYEI33xMlEgMD7jCARMLu++g/mdeD10DY3iO0Z0Cz8Rz1Qd756Y91K6yh7w7qevh2jtyQdNdPvwI6AoRn4pNj9RL4n5BfFBT/ZwiQH5K7U8P3MKwArYy/9uieGbhqTvlxTgLCf8qnlrdJhWqng= 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 Thu Jun 22 20:57:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289620 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 3EDB1C0015E for ; Thu, 22 Jun 2023 20:58:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC69F8D0019; Thu, 22 Jun 2023 16:58:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C77CF8D0001; Thu, 22 Jun 2023 16:58:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF16E8D0019; Thu, 22 Jun 2023 16:58:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9D1418D0001 for ; Thu, 22 Jun 2023 16:58:47 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5FBFC12016A for ; Thu, 22 Jun 2023 20:58:47 +0000 (UTC) X-FDA: 80931597894.21.1D07AE6 Received: from mail-vk1-f182.google.com (mail-vk1-f182.google.com [209.85.221.182]) by imf20.hostedemail.com (Postfix) with ESMTP id 8AD211C000E for ; Thu, 22 Jun 2023 20:58:44 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=kdaaDiZK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.221.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=1687467524; 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=i7gBmadxzCHf63MPYIjSUQ98PEac8ZNdfmGvUXdCEHlLplu5pGLaERSMkWq4NGI36wZ0bK w3xUoZMSFAsGW92t4zLkDXo7XgmD4YX1dV0Fy1eXklFDj3xBN+YFOX2Kbq12A8JRGgY+ds p5vwBfEEMaHe0fX+axKnWfFDSrwZQVs= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=kdaaDiZK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.221.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467524; a=rsa-sha256; cv=none; b=6FaePcWxMJVyVJmOJxwGF/rvFIOX/r0aAE7SJND6COqH0cHWuUprhl1s8NcSA/0O0L5N8U 7VobNND81PqtXyOT38LiP3QU7B9QtUXg0ooxRfMp4f2Id0pFdQH72xWYsGrgRuVGpcmoxh vBgSQHns3I5LvkjszFnp1ua03tv79tw= Received: by mail-vk1-f182.google.com with SMTP id 71dfb90a1353d-4718f761333so2381571e0c.0 for ; Thu, 22 Jun 2023 13:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467523; x=1690059523; 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=kdaaDiZKntiVJqU6E+Fdy3gZ3zaYbFA4aZZ/ujglTgT5Y9qcAssURDthairv7t75pp DZxvPr4/eKE0doRm+U97EupNPOOTaxsU7MNWazhNoOvbWE4XMk615RzVbyQxpiQSMZLV teIZa5P2Nka6xv2fZj5Vm1X3bRNUsisHvvXMCnaK2ZkQVxJ23k+YXES8hxX51riBNGcy dBs/ll9Jvj9PkoRHnWQsnOHXYAxD19XHIBiXUNkDRQVqZwqJb6khPxnLaSebog2ECYc2 chI66X4PTb46Q3YOBBlw9vYeA9+HI9TiAAm+zkoHCKp+jdKVA4Qb45V8N3EiJFN0K5gl bLCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467523; x=1690059523; 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=UzQeUJE2gr6u4cyIJa83ceSTPstTUdCj17yXEKDvD3+bfdoP1C5h0/iEolvUmqU/UW FzVwrkJ+fz5ttrUn3f0VNjfNmIwsgNo57Czj2Yu753xIy/mf1SoiiDMuFQVTtBkD9c7m Vt9pkT6UBF/S2scqxhwbARMI20JbjQynDI8vQBBq6OLfXufZVgHkTGDxMDsQhvuDJVHS TY95Y3HThdhpnjDzr2kuKXyUMSPCK03Yzurfig5kiiXK/vKV0p3T7GfDH8WjqGsv4Gnp Bj8vw0o89sMUnLchkkFQ5UeHUpyyKsvqoUYCkONcngB8hr8e7KB0A9RM3Ao3kJSDi8z1 AjIw== X-Gm-Message-State: AC+VfDy1XiNfdrwYHCb2nYSmyo0u5gRXhDVlzEadPFt8yp/MGolbJSkb fzmyMyI57LIESKfW+TLZnzE= X-Google-Smtp-Source: ACHHUZ4CnESNgKf2MlezH4s3DCtDkik+QVMr2WtnXejWDaMJ55d+3hRh640wmo8yJZi9qvEIVubjUg== X-Received: by 2002:a1f:c1c3:0:b0:463:b57a:e927 with SMTP id r186-20020a1fc1c3000000b00463b57ae927mr9637913vkf.4.1687467523563; Thu, 22 Jun 2023 13:58:43 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Huacai Chen , Mike Rapoport Subject: [PATCH v5 23/33] loongarch: Convert various functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:35 -0700 Message-Id: <20230622205745.79707-24-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 8AD211C000E X-Stat-Signature: 33mjp9en33n16zabnsze73n9qfu49xr6 X-Rspam-User: X-HE-Tag: 1687467524-524987 X-HE-Meta: U2FsdGVkX18mBC298G7LVq687o+peAFjD3wfVV9A7EaowxaBSjC166T+HMf53z+gqzuErd29jZ4efRqlGiWFBpXn0/5e9kI2RfE8QrP/XBwssPCArtB5wy8x8AfW8OWfrea+AhLhRz2lQ2+KrTH47CwHsff9B7OqZ3a4ZkZL+vqh3gEylnZAvr8/5XdbeUC7LajdH09/hdLiPObQRRti+dJUw0jSpS83RH43CMHZQHqz/37kVPv3Jep5sk4XkBUGg4SIqyLQMthuu4EE1anrVfjmeazhAOPb0qPiwDvwO9FM0uipHhMiNJcYrUiR8G9uSH774KqN+6zgazBRaOyFB7yIaRIGrZdHj6Q8nL60WkwtnFNVWOLPSfKIL9ufxqi3AxZ+bEmee0bnxAnaj/4odOuHVTONGI29eBQA/Ue6hMLxHvugAcotW20+PXZnT8DvvcYOZWl5gpz7ZxS3l//PRly89w8Hz8pNROAkxBjFJSg02oODFdFhvBqls8jB4qzlp588DXsN4JZMOL26pQAYry9A9L/Dt2Ff8hn2FadPsy/Cinv3Z8lMyuaOGemSnMB/L6QNSqhd7LKK0VYbxoTac8hH27VEkyMwGnJVtfkSRoSOooRjK6uDVebX497MJZtHu23m9qcfG0PWJvsw3VjLBgwQvkRB7EIVUfRKTmrImVHXRwxwaKzY3BNwbRZpXX1+Tzct24yxeYV4R2F+K2Hej0LlU2HBRXNz2VMGVQHdIbE8h5kho7rvdEpfv6Cwhi1vdIJp55OG1kVtzMtcaCJtW5Nz6JkUzlp6p1lGb4VGrwBGfxxRAl0/tfdhwdmHp8ggQiDckZINKELeg/ccTHZDSGYAxTrqJqxzzE5hOXw6kBUG/fF7ySmA3mXgmdGUjiEoR08+Ldi7vJaXn45J6O1bQKm8HkpWDQq2C136PQBR4z80wSLzQRpafmK8WGRVw8XvgXWrgTjYEbhSXO6yXc2 5C2y7fTM 1c3mhGsRFb1lRhiIvPFUfv2jDyNo9US6bH9tPf5O1Uz41eL+zNRaYqDh1sQmoB4bYT1iEpbxPbbAWpXz0ya5x+Zz1q82ZAjjIDohfEAzf5Sy6X077GBytlBZuaBD3eKSUCWWUrLXXBKENRNSkBr9+cPpbjw2acf5iwSCaIYlgG2mT3e0d+wDYSM0/SP7GAFnEfkdLVSTa+X7/rxRowLGQzGpgEbKs4JWjj1S7+I1Nr2hisQhsMKBde9SZoUQRIKeoP4supL8jqRIi54GPO17G1edM3CRzsg2E+18mUPWM8LZR51HLyDEvE38h5wMko6D4iWSF/ElOOJzo1gv6OVUqaxC3jGY/BefcOpQ+pRGR7aebu7eAC4vcXAP11lG70+Auq9MmcK7MDkSlO4M5sNoGVGW8BWdR9GWV1AgYsGD/Z0HODEx0o8oUzV+TRZIjlnkZgEmwYGouYnLXwmmO1kHiDguic2bTDV3b2bItJZvyHxUeEdmBpOKLSuSnPCUEe+Z8A3s+LQqSQIEvTfMektPKMKXRDHKRU+YDyWlyGIWJYpg4Lkgp5tuUhDA/UATUN4yTiDVB6omq2IWZLD9S01VUAE8xvRp78Ume312XqhW3+UJZV3o5mI4sGdjXl6jajYSHKwNm 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 Thu Jun 22 20:57:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289621 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 6222EEB64DA for ; Thu, 22 Jun 2023 20:58:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB66B8D001A; Thu, 22 Jun 2023 16:58:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B67668D0001; Thu, 22 Jun 2023 16:58:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E0248D001A; Thu, 22 Jun 2023 16:58:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8F4008D0001 for ; Thu, 22 Jun 2023 16:58:48 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 60AA21C8C0F for ; Thu, 22 Jun 2023 20:58:48 +0000 (UTC) X-FDA: 80931597936.12.5C1F061 Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) by imf23.hostedemail.com (Postfix) with ESMTP id 8C8F8140016 for ; Thu, 22 Jun 2023 20:58:46 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=kdBMDjj5; spf=pass (imf23.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=1687467526; 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=hySW7brzBg7/Cj99gTTdUd3MvFvqZB/M9ynkCaO3FFc=; b=oOOEIrjZbrCTQ1UHizZ/e+3h3ZimZ3aLBaOHmT1EHVng5Ezz7hua4crIMuqCz3hdYnJfvj BCj91qYc9KTcpKnpn4vNkf+7pdw5Ikoa24Gx18m3gG047BpMd5KMl0BrD2GGLZfeM8UG/R Sp3VsuGVQzF6D8PvzKj0SvjtcJxsdRs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467526; a=rsa-sha256; cv=none; b=InlqpXfHTf/KO2ZWAX+ZMqvpS37e2SIHZUhF8eVxyWlIUVX0dEwbNOcGyeI67SuYhAG0/M tXHjPeNQ2teLZ0wUKuQLfYrtrLLGrpnRXwDwCV4InLBkJpnHDySr5zHtyLH3//C4Z0ZayI 3VwuiQuh2Ur0Ra5dKEDVAtvN1AUnKPI= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=kdBMDjj5; spf=pass (imf23.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 Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-57012b2973eso85136677b3.2 for ; Thu, 22 Jun 2023 13:58:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467525; x=1690059525; 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=hySW7brzBg7/Cj99gTTdUd3MvFvqZB/M9ynkCaO3FFc=; b=kdBMDjj5wIp60ZYLcmWrdpMg4HGlypB71kW8hDPlIqh35A3b+v1T4Y1ydaWZz/xhee ZA5Wg86cVGIjXA/B7jKyd7KddQnHiyBrO7oSeao90//6ecohToH/3Eu0AvlHwhcP3OFV 2LpxjpRaH/c4lq6Z4eUITJ7RmwHPPRTtaIS3uYsOOd8x22FkyOEoLStjCJ6IEsjRHWMb 9n4Ph82ODGWg2AiQDJBhn0Lv8MIpG0JlDo4by6Q29EoMH8NyeBmUg+qti5r0raRohKmw K67ualO2cW/10KKjteAwcv5HaO3xkHdj+vI7ODmKcr0ceaF2dvSo3pCSjKcanq/h5Cgw ij4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467525; x=1690059525; 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=hySW7brzBg7/Cj99gTTdUd3MvFvqZB/M9ynkCaO3FFc=; b=XZghfILvJ9HJA9Lu7r1SmOHuW0c5nLoeQ7MR2Fd6nef318dCYSG9008rzLETvauuD1 zI0XGfzjrOGwvd5ccQ81F7iKb1xT9y7k/0DB1kRBD4On/P15434qexg7b6T1HF186MLN bpBCxHiC/E+KbmPaYb/bXYrPurfXH/Jv8Ke4CqAndGkYCJSDlT2KT9oFhZVEGbbSnfri 7r6rEDvyAxKb1gsgq2eZ6l1Rawdl9J6Nb2wCwTEKVjfolrMRnQdMcT/I/1o5dErMDpvW 40ohx2a1VIgssFZqLRS1EJu4e7MXr2z65dqVG6iahkQ/fiIUsAfk5MgT0o61WWWkJHBF 2UwQ== X-Gm-Message-State: AC+VfDwuTUGK+R7Y4Efrs+HouhMFthJxQSUPdrkZBupHiTLJZDy+5QU2 +K7z+D9e9z8D+zc0D+cpios= X-Google-Smtp-Source: ACHHUZ57HMpnicW72R7dp4/5KYNv6JBaVpOvftGFkmzTzwziBVHjkWFtItA58L9caDWgi5cpht4WKg== X-Received: by 2002:a25:ced2:0:b0:bd5:8616:2579 with SMTP id x201-20020a25ced2000000b00bd586162579mr16452165ybe.36.1687467525581; Thu, 22 Jun 2023 13:58:45 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Geert Uytterhoeven , Mike Rapoport Subject: [PATCH v5 24/33] m68k: Convert various functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:36 -0700 Message-Id: <20230622205745.79707-25-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 8C8F8140016 X-Rspam-User: X-Stat-Signature: qpwj7zoznjp3ab19e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QOmghytpruVe8j77Ioquadwj0qlc0GUrtERsT7wZ7eHwM3pL0PlGlI3fhBOg0utbQw++g65/O62oUdA/rD4pp1CyRtgSS6UfTrQlSkwidwvi0SEw3RszMKzo70SYxNANBM7GPFFc/WllDRjp1WO60XLlW/HntVB9az2CLOCutA3kRcVhJE2rqaEpbKsNBsCteNTiY9FaVZBMHWy0HIHKjmEwTF6kClW/A4EwRi0unUNyh6ceV+BxYKTeR3xdjD183qM240qdDR/gPrQzGmlyEyLyz80uo8Y3BMbdOaheV/T9MVQiRT1R1lU/X8n5hcM48yG300MY2HAYOoy0p/nesBIQbny9lAIR9mqmH6w1MbsROVSWLLRUgRx+e1zLGD6QtNI6nyt5bJCD1Ymi6V8fGL1TuMFm0cHhPZPVY3pbmVYTwplpl9RBOxyqNm7FCmCz7AOda9hdp3hIm3OcPzwh3o3xCPzFApuOTK2Lf7rTcMtTFJh2IF4ObNXuO5rkiF0ssVaYm7KXNBahcgrQ/Ewbkj7WjCBKGiSLJKzVAEfE4qgneL0DlUxnd4Cn363vIEHjL5GBzK0t9gQo= 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 | 43 ++++++++++++++-------------- arch/m68k/include/asm/sun3_pgalloc.h | 8 +++--- arch/m68k/mm/motorola.c | 4 +-- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h index 5c2c0a864524..790ade4e778e 100644 --- a/arch/m68k/include/asm/mcf_pgalloc.h +++ b/arch/m68k/include/asm/mcf_pgalloc.h @@ -7,20 +7,20 @@ extern 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) { - 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 Thu Jun 22 20:57:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289622 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 4D755EB64DD for ; Thu, 22 Jun 2023 20:58:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB5768D001B; Thu, 22 Jun 2023 16:58:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D3B318D0001; Thu, 22 Jun 2023 16:58:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6A368D001B; Thu, 22 Jun 2023 16:58:50 -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 A2FA38D0001 for ; Thu, 22 Jun 2023 16:58:50 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 77F29A0218 for ; Thu, 22 Jun 2023 20:58:50 +0000 (UTC) X-FDA: 80931598020.26.17A00C5 Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) by imf06.hostedemail.com (Postfix) with ESMTP id A7936180013 for ; Thu, 22 Jun 2023 20:58:48 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="DbS/FVmf"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467528; a=rsa-sha256; cv=none; b=Voc5IfSaflz69gJt3dVzjmp+ZIk/T+KmeFvchIYvd/vRpvwETobocnNrceaF4YoTeQWKiX ZbkMW6TA5mlhYfmHktPXJ8ACpPEyWpP7h9hy0n00eqfog8IFRWajpL6hmEZabn9TMQQd3O kCnhofxP0aWp8kTh3sJfNg+x98JSxRI= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="DbS/FVmf"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467528; 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=INFvABlBGPZei79/94Knc0BJDqaawscgQvpgGElSn4Tjd1szAqH8o67dJaKQg2+EgsHgPG aw/v0lwV+jTg70fJR+wCsCBfuhDaPWS2GvmPmpOzUG/2h2GywJrMWpq+xpC6MHNKRExlb4 W1eGpYIHQHUyKG3D+RxnFWEQHSn7wUc= Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-bfe6ea01ff5so2380990276.3 for ; Thu, 22 Jun 2023 13:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467528; x=1690059528; 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=DbS/FVmft5J2VICO+Nf92XNy2wvgGSGG4msWs7E9V6KxYzm+tSzGTprRX7LY1Az4z2 YpRpjh1gFRRLJ/li9beG6PIvlUHG9ZRwTYplGkWymenSAyOrWC24owgK1fhjKR3yrEtN hDpVadLC+93vTqzcu4H8sHAK66wH4JJJgH7pIr7Eko07frtpGYI2AQVOUDXreCJkOXFd 1tssjWaKiQ/O8SbW0+/XdEB5l3eXLYaeBTMZyr+OokbQWbFNHBYbcUGqZxcWlMHvdqKX xSAVDlOu/6aRWjk6xB/QGaUjzCCA1KdGOVBnKZ7vKSpcGAQnSE9HW2pjZqAURJ5Ds3lR MAFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467528; x=1690059528; 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=FYUDo67BKUsNGhJLLOdBQCItYHjImNHqChWbLuy7A0UYAbJaySeH5Hi18sNi5cr5Ww eXN203Vt5WaX18XyyWl1MF84uh7zaMVpDefBpE7QK9qOTCBJwTIhySCMDoeGIEODOMd4 ZaE6S6qbGX0lwc7npPcN11/X/u/A2EEWFvCoGSdzsUEV3sms/gJaJLub7QUwF3UGxub3 qcBL9wyOxaBdEDEv3MLiTdVoPhkM6y33H6jvmwA5ASuxX33y7/SQVmxoMAtx5M1goNW1 scYSP6RGK8dhXCYtwWXzpCffD6TYkAXydJvOVOueina5upmHX8Pkc/uPWS26+VJx55WP zD1Q== X-Gm-Message-State: AC+VfDxMoVAq2i4zw6rkLItIdRxuBRc7OP1qJR5+ZAbaIvfGRlxeFnD6 lLVXxjqqSKviNF8i2MrDpy4= X-Google-Smtp-Source: ACHHUZ6vkVdQ+2aFbexAEsw0zpg6DZHD2/vRtLHLUIl/mOJbyXKI4RGZmCd4L5PdfTZt6ngBy4nBHA== X-Received: by 2002:a25:44d:0:b0:bfe:e65b:cd1 with SMTP id 74-20020a25044d000000b00bfee65b0cd1mr5470842ybe.46.1687467527711; Thu, 22 Jun 2023 13:58:47 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Thomas Bogendoerfer , Mike Rapoport Subject: [PATCH v5 25/33] mips: Convert various functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:37 -0700 Message-Id: <20230622205745.79707-26-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A7936180013 X-Stat-Signature: j95p99d6ndty7fckbiymbe4rb476xmw9 X-HE-Tag: 1687467528-92662 X-HE-Meta: U2FsdGVkX18VD4xGWKAkj1GshhEtW1EHT2/Px8rdxYy0dVRE02EK+NHlIB0tGEv7QBjjwerEFakT9YTH4vgJDs4nR5trKN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z/4RyIYalKEeQANMExnLqgkzs2Jfqzcu9v7jwu4klLnP49FneXEKjxjVQgdHsP/ZH8EihhuQGscs8rnV0xYw1kVjJOga6bHackhVVPSGTvq+KF7Zp8kkDfhRf4GUdDHa+BtLT34EeFtNKvSDds6Ng2E1r2DA5IkXxwpQWSIEZhKHH/gkobBP6/vs9HWedtGLVBSEw0RWKHhJBsOVlIHkaWBZm4YpFY1K27qTFVMySFB5Df8126ODx95wLV15zN496wWaOfnfw7BBkbhruqp6gra9GGeCuHgHxostRLtYdtXs/tj8XqYEIXYyHU7Qww+vtgW8trnx5MGs5AdWzQFo35XeJbIWkvuPzV/RSbGRCOQI04kPBs6i22G/59SvZKIBc0OlgqaLvlJOXLR9w6dVee80dp32+fQeHQ== 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 Thu Jun 22 20:57:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289623 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 80634C001DC for ; Thu, 22 Jun 2023 20:58:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 092358D001C; Thu, 22 Jun 2023 16:58:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 043358D0001; Thu, 22 Jun 2023 16:58:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFE248D001C; Thu, 22 Jun 2023 16:58:52 -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 D1A608D0001 for ; Thu, 22 Jun 2023 16:58:52 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9DC288011C for ; Thu, 22 Jun 2023 20:58:52 +0000 (UTC) X-FDA: 80931598104.12.7CA1906 Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by imf26.hostedemail.com (Postfix) with ESMTP id BD72F14000C for ; Thu, 22 Jun 2023 20:58:50 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=F65orfGp; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.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=1687467530; 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=dSsj72OOim1moFehILf4IJ+e4eXIj/xtfG6kDsakLCY=; b=v1VQa2J9VMmJs0v4Z2P8AeEBKChjGyBkHtmGGo7o9aMe8oIWYczuJGWlhdoh+TLb+AW4i1 S64XHCLcruradOw7G1ObuRiSvntv5F973TyrAeGFieBobdtFnXgAk0FlXbTmmcs8E89ivh 8y3G/FWRDalEqW60QMo615D1G0D6iGg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467530; a=rsa-sha256; cv=none; b=Z8TVUBIaFv1iaH83O9PqgOjgKl997J7nv3UnAEu0o7UEgTshZA8+82GwW50TS3OqTfqE+H 4JyBzFc8sWfDhYn0gtSZQ9ppZTsJLQaXhlCZsWwhlhIa9FaDrBP0Yovu/ldmXxH91F2EcB yyT1vvlCs6pRxrGomxXW/xjnNfcRPmw= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=F65orfGp; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-7624e8ceef7so636887785a.2 for ; Thu, 22 Jun 2023 13:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467530; x=1690059530; 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=dSsj72OOim1moFehILf4IJ+e4eXIj/xtfG6kDsakLCY=; b=F65orfGp6lPWpCrD9sAMHQjbb/7dPkBeEZwnbqaqoaG+jHKHFKOpyv5U+mRswUePBl O+w6mgJQE0929R7HfQnempO9NwPEm6qT8tc34OERTuMiOZXiohUbt3LRN+VbVJEKUKkc tcmSj8t+FV4PGg1S/0RDnwUBY8C4sUVvlY/c/d4jqvMe/jl29yqPCuiM1limtTye3/Mt Xl+0XJrX90O7Fe0pzMoOa3o991eJyDuyXmsTPhqv2ERTFkUraPYZpwk4UgntXrYBzy7x tG0gCzAga9PV8hPLOnhqVRtX7sCVqxvHBH7A5BvtHK+faRxZPp8TVFIuHWDaefij0y+Q y3/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467530; x=1690059530; 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=dSsj72OOim1moFehILf4IJ+e4eXIj/xtfG6kDsakLCY=; b=gJGkPHdmUvsePD+MQqNo1jSRbIlky1K0yZFZdFDc14pcDlfsOIiX+uJiPs2v2Zdlm8 ZmQXt1BVCpXp/5TIro4nR7R2sBtqM7aAQqxp8KGI+vI/vicO+ibE564uafWxPaS677YX DZotan4qEl5CjeLZVLtGs6dsQrJCUtMF8oz9bhzfsc2EXefsD8jvhmjSnGp5WPdEF8TQ veic6vSzpbARhsZfcjq6cZdXc8V5sUDk0HzJz7YmVxF2X0xqfMD84h6Utou5OoMEDRgA UV9M82wPPNNzWtpW1MisZl54arRfobb9oR4gsNtrPz8hlM2sa4MCItr4V/ziavR/NEgN eQMw== X-Gm-Message-State: AC+VfDxNbeEjwNXHkF6R4NY736tpkMcuGtoJrUw2cCL6Kes4Fe8FN1vF onDW6eZok1Mum9cciQlhgdE= X-Google-Smtp-Source: ACHHUZ7lI8iuHKQsEsdck4SAEFHmt9QQs6haysqfy7wOJRfjq9Goxv7w27b3gm3WMVCksX2Z3AB04Q== X-Received: by 2002:a05:620a:84c:b0:762:883a:f5a6 with SMTP id u12-20020a05620a084c00b00762883af5a6mr11201137qku.41.1687467529856; Thu, 22 Jun 2023 13:58:49 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Dinh Nguyen , Mike Rapoport Subject: [PATCH v5 26/33] nios2: Convert __pte_free_tlb() to use ptdescs Date: Thu, 22 Jun 2023 13:57:38 -0700 Message-Id: <20230622205745.79707-27-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: aixesc1wgp1zrpf31u1pfzu3qh8s68ny X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: BD72F14000C X-Rspam-User: X-HE-Tag: 1687467530-7822 X-HE-Meta: U2FsdGVkX1+Z9FXvLwJhIyPk9rnmc5/3FKV0ai5e5PHBp4IcF2R3pV8LVIc8CjZpycwQEhoisyaFzdKmAuucup0Z4Ztvls5A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k8NYThnewS5neam68XG242KVnxJTlUQFwjVPfwDI8VTW1mlRZqhdXxLPZsrIPRHo5E6/dDO1okfFkv3pDLNKDth5NrKYZPW7KL2tW6a0AySLlZ8W7XJNNBMXhG46WpgAira3FySSub0pLYaL/z3s1NDsFjqBVe4fSL5/yWRYzeciZ37PGY6jRE6LQ02IfpitYu2QIZDWbm5J/cpTjhz2s3iezZJf3tTlAaAvjw6Gt4atS8JGNg96hLUCuKBZvrEF1OUcnr8ErAVFQKcQtSQUq6GoAOp3wxlklEx3HoDUW4JeGoO0zPF5e3XyDrP2bZMgc6TMjOr7bJn9XUZ6Ps1PJMKNFZZS5akKmgHHcd9ZFwYs3jf00FDwMsXy0XU36R5UkdgV4T6+2UAGHlvBPN9RAEUPNzQECGJYC1dQYvTfUs1RU/C6Dro9Q7hIMrmpTelKFcVZCeHMcY= 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 Thu Jun 22 20:57:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289624 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 C2187C001DE for ; Thu, 22 Jun 2023 20:58:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 550558D001D; Thu, 22 Jun 2023 16:58:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4FD4E8D0001; Thu, 22 Jun 2023 16:58:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39F128D001D; Thu, 22 Jun 2023 16:58: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 280098D0001 for ; Thu, 22 Jun 2023 16:58:55 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id F0CA54027F for ; Thu, 22 Jun 2023 20:58:54 +0000 (UTC) X-FDA: 80931598188.22.A785AB8 Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) by imf08.hostedemail.com (Postfix) with ESMTP id 2A35A160021 for ; Thu, 22 Jun 2023 20:58:52 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=iN2FzqOQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467533; 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=uhO+nUIODIrKULeqjM/a71MI4ONKIj5l/DxzuRDhVi4K0ij35pH3sRjLzwp6pBOtfUhB6x TZNDnvsoyZSYNfgZ8WF4BIQrVI0Sp/bjSPXEOWIG92l7Y9KRfVY79X6iZak0mCA2qx+QEy qpGsgVQw36pVh9lr9tBr9N3QpSGNJkU= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=iN2FzqOQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467533; a=rsa-sha256; cv=none; b=noBxHnIJhpZbuacpZVRB+/gnSi6L8uGt8c7FNwmkkcYrLFE3AroQpIJanHfZpg7te8RHWd uQi6+/sx+PYos8p8mZmizipfrfqZEPb1bS4hqXtXFTLzNZQYyUl1YASgCY2tmqxGczAuis wtpthGmbs8rECsdWDLTXtOlOofIVwdI= Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-bfee66a5db6so2126615276.0 for ; Thu, 22 Jun 2023 13:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467532; x=1690059532; 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=iN2FzqOQCGlMw61BHmPlvHKCi1d4I+83kYFUJ+05be01GNIJnqIJIlehoUIlvwUaVM d/OWGkj4lxemSlNpzjA9vagyXYnKzygaSW8qGOFAS4kKsFBEkls14ZpomWkO/T200zVH qlBgWwV7Su2BIgoVpSS5ByD582z4lmvR8XQqnfXM/x/kcWnUDA1l8EH7UvhzGe/a36fq qzeiYGkPPC0vXVHADUCnvEqnbyiXBVZ5TrMcTAX4hM8+UdpZhrwM5A+KI61Sp+b5buW5 P1n/PN9/guunik8p7869oduuP/QEBbbnDZw3HC5F5neXLeBMAmnYdB3CF11sup6NCeqV 0mxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467532; x=1690059532; 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=d7VX23LpS5o1elN2kfaov7cpoPl8rDxRyGaz9KAiasHGqelXIdOI50VJo3hT6lryH5 nH8babA9OKt7nhNrFiNx7+F2WCQKP7Y1WwJJd2+rOm62wu0diOowx6jTfMn0Flzh6xkE p+B6Lhwl6nUz0Pqfk0dTagCjpnpYbOMG+aOF0DO58yXbz5sKs0m70oIfl47kgqO9GTAg ICFe0OFB9Q/8lYkdD54uxq3mt+b6Ug06DQ0JZruoiaPwFnJOrZAyibAe8LA4jI9/mcFF zts7pxc8SpudGGZYD2maqMszLAneVj6xk1p9HbMIB7duFRe39swcyfDNj54m1fEMsW/3 CzcQ== X-Gm-Message-State: AC+VfDwjEqz9qZOiOfH9PMK8o2w3q6O/99Xnm+XJkDdUo66t7P2rrx/W itwvVQKNRhk3DXW47Rupk8E= X-Google-Smtp-Source: ACHHUZ4L0O/ZcQJNV1a5FO9DGWMsGkRAWmV2oZ5bMU1z3VMLdsFOJ9p+X6w0stYIYuPTzeAJzZnheQ== X-Received: by 2002:a05:6902:1cf:b0:bff:78f9:ffcd with SMTP id u15-20020a05690201cf00b00bff78f9ffcdmr4883793ybh.38.1687467532210; Thu, 22 Jun 2023 13:58:52 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58:51 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Jonas Bonn , Mike Rapoport Subject: [PATCH v5 27/33] openrisc: Convert __pte_free_tlb() to use ptdescs Date: Thu, 22 Jun 2023 13:57:39 -0700 Message-Id: <20230622205745.79707-28-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: pqrw9683hetm8thr8nnhofwfsxitfze9 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2A35A160021 X-HE-Tag: 1687467532-484092 X-HE-Meta: U2FsdGVkX1+C1xmSEV2JU2hILUegp1HDvmPpTn69bKBwJYKh9ETFndrIWQm8m9hO0X2XNXtPRjeQet46b7cdaw/fT38M5lm8m8xXYrngoUv8h+oQLT+3vWb3djpvooSmmv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YVW7uul2ds9DZT2GDAqFuJ/bDwzDz1nQXil0QGErv4O8DUVlgSEB3mIeyQoauMD3by7bs9N0QPzzF47Tlf7YLEIBCPgvcqN7ZrQ581ka/TvOib8+CJYMMe/CJ+7NpK9RkmJiWkdlY59Ql5ip9mb6UdlSiW/hRlX0BWVwX827rlauie4naX6fYKOdPG8nKPRr0C4sGyJn8XJomiR6l8jewi7BLzmMkHt/YhZZk/4hVv+PaS4ZOujziSHePOXfAuqZCdg5XRudHMC49zDlpXTXXrUXNALGMV+S+WCVUJNr9GNoueMMVHmcAhsuEtU7mfdjL7kvGfXVI8EF+QR46fLF/slDh0pZ4XDfuYHX25B4nTJpoWxNQVo/ifRWCUtkltLsf4NjCPEz4rE4lCbhLfHvdyEe2hNa5/ 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 Thu Jun 22 20:57:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289625 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 CA97EEB64DA for ; Thu, 22 Jun 2023 20:58:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FC298D0002; Thu, 22 Jun 2023 16:58:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AB2E8D0001; Thu, 22 Jun 2023 16:58:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 573A88D0002; Thu, 22 Jun 2023 16:58:57 -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 44D158D0001 for ; Thu, 22 Jun 2023 16:58:57 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 22EC516045E for ; Thu, 22 Jun 2023 20:58:57 +0000 (UTC) X-FDA: 80931598314.13.075BDB9 Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) by imf05.hostedemail.com (Postfix) with ESMTP id 47D5D100018 for ; Thu, 22 Jun 2023 20:58:55 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=TppJif0B; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.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=1687467535; 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=Ibj4DtPZtFn2Nvf+wPpoa6WH19N4EG/R+Qf3fkWU2+L7HOByjKWe72QleSVtaFIP3eRPDT /W6AH+K1BTj0JX1mvjcTiUf1kY1QxhMGD5EGlxYriCV5goD7V5tgSSiAuGHxZRGUOPpwRg Rl48mGLpfxBZBhqM8odjHfm+V6aGR/0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=TppJif0B; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467535; a=rsa-sha256; cv=none; b=0/TPK5V+Hmhn7GxP4hEOj3hZwTd8ndd6a8HOloEItN2zom1i52uK4DuVc7N1AeBfn5zRmZ agUT/pB+B3FrEsha8sYEsngou8/geiUVF86AFdCf+10xG+4cAml7KuYmHVvMKPzwTkSdVw qm5Wnqh/2Q5kn0+aOjHegqpwCZRxK8o= Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-7624679c9c4so545979585a.1 for ; Thu, 22 Jun 2023 13:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467534; x=1690059534; 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=TppJif0BHo6hnPlcQL9KC8WSGCLNYWnZ5TWCUGNi9Yse0euGomuzrLUl2hHWg+xOcN AtrgkmMfCUjy9KLBFfUuEG2s0Ihpe5FTyr5metIKFf6zbktuYMraC91YUKi/KWfbgyVG lvJTabP9ygpBud7nE/7yiG7FvQtoPgmdiRSK2sy5kuq4cEPaMRzkmi7ezbneoKdvpKLs RzOr7Yyw6OYIFnxYXzw+JpXxuwUJk+Gv++J63O8G6cjfEEYoESBKv3QgdI5Gny8Js2Dl u397T8c8ML9be3fyfcRz9z/KIcbHqeskiUObgkxyvqYvJ9bImtnagHyVKviaetoXJ3oC RmxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467534; x=1690059534; 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=HpqQodJ5ISs55eWQt7crT4ceifOHqMHvRV1ODjR+Akpk4DUMbbN1diL32qN09+qL6S 4cdhY3rP05gMWghZNuC6AZGrMU1Tp4wDm7x8lw7EqY2MPNyTAIPdyvSXf0uFwYOTBMO9 6SZzZ1bDkEWsmOpeOpg8NTkbn2MFV/A5b43QeAGVyYuML69DT8AQMcDSAnySug6o0yx7 eJ9Nw09+W34j0WkVVz9x2YseOVo15GLWyB2Ss0BBYgQcG81onfppUM9Q5SUNCJxApZjd M6WuYhls99sI4+LNZN6JepvAwwOuUi6HnLwlVM9ZKqkkmJSPwpRSRzRfjmGKU4QJhEu3 BlsA== X-Gm-Message-State: AC+VfDwHLsOhehEtSTsan5mznGAj0pnzFnp/2wI+LYt6VHRTo979zLjr JvfwRTutXU4eeg9jiN76jMc= X-Google-Smtp-Source: ACHHUZ4bdUBNX+PQFkV86pN6qHx4P8fCpAOyeLEg1MMh49m7gk0ETU/OT0t4ehwniJxuP5YNErTIxg== X-Received: by 2002:a05:620a:2455:b0:763:de2c:1a8a with SMTP id h21-20020a05620a245500b00763de2c1a8amr6902545qkn.57.1687467534343; Thu, 22 Jun 2023 13:58:54 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Paul Walmsley , Palmer Dabbelt , Mike Rapoport Subject: [PATCH v5 28/33] riscv: Convert alloc_{pmd, pte}_late() to use ptdescs Date: Thu, 22 Jun 2023 13:57:40 -0700 Message-Id: <20230622205745.79707-29-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 47D5D100018 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: xf8n5yu8e87qxfo69hbfwtwrueesoz8m X-HE-Tag: 1687467535-687978 X-HE-Meta: U2FsdGVkX1/lD6XIXqNx4MVfQupx4nHmiBx2mguf9ucdTN7LzSVgjbl0r1DGoKls4Y5bSOh/Ba/b2IevO4vRjQgnMpFxKKPYwKT64dQ5NUzgBTxwIEqS3FxAH/oqLCVUN7P8ZNPX1OpT9A06PvjM1ZReFZwmWMI4wuwBQWl4r18UIiw8EB3ySu1lFFamDS88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rI4EYxwzyA53N2DgR5KG54CPU+EewwnjPFor4xWdEwn/JBDSiWyixql3fdNW+q2M0z8Ls4pY1GsQ9IasuW2UEiIAaqvPlv4WNW/bU0YpBk0uKu9xIWc70aXhSeVaOXkHxKhU+R9wI86792/d51dGPQauN1gFt5EVoNjrNHAO07MWsTajHRLF6/tWKUZl9qeZ8ObLQ77TuHosw8b2PFDEqKYA3l54yHKzwVrYeAiisMmFAfPT4OSBohn+0ULq6gUNhMNWjX8hALYadBoykbDqs5yTlIVTUGry5eLkDYJdNRnwDmemuR/IjNwOCHue7LNXTLl5UaWDp8/FbPyH5ZtOYXjxlhMVxNM9Pj/8jEVGQdmUsZLKMfQNdSjeUrktro2nSUPeU9kY7GprNFLTLgTl/SKOoa4l0um7mTvZn 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 Thu Jun 22 20:57:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289626 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 2F457EB64DA for ; Thu, 22 Jun 2023 20:59:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C79B08D001E; Thu, 22 Jun 2023 16:58:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB3D48D0001; Thu, 22 Jun 2023 16:58:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A06628D001E; Thu, 22 Jun 2023 16:58:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 91B8E8D0001 for ; Thu, 22 Jun 2023 16:58:59 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 5FE6C1A046B for ; Thu, 22 Jun 2023 20:58:59 +0000 (UTC) X-FDA: 80931598398.25.9BE5A2B Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by imf01.hostedemail.com (Postfix) with ESMTP id 73D1240002 for ; Thu, 22 Jun 2023 20:58:57 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bI7F5jd8; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.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=1687467537; 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=Zv+9LHkd9WhbaCTbxTwpFdbbYsnC25GH3fuxhT9+Fn8UA3L3qLQxMpxLDDe+0x0yRdDc0w 4eyzPhGbeti+V7vXpf/EA1juw39wZFr5i8LgFSmGwzklJasA1KrokqqqHfWHKPGcF0+uAS z5oUOveRw20Qeq/rG5jmtCIR9UiB9aM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467537; a=rsa-sha256; cv=none; b=NYpOUhSGtl4agSJFNVYmAN0CTBIHjlB+nUIPO4IcJ5iTGNWk9TlPJ2NTlhewhHCFLs+RXV p9vGMPaH1ITghmQDqqoqzTEmqA8DFjuEDc2vfK1syjOKMgvWqkUhnk1Q1armhiKGPja1qf PGTZf3tDXESAW4y/1K+h+Ce45BUoMYw= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bI7F5jd8; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.222.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-76244657caeso578996185a.0 for ; Thu, 22 Jun 2023 13:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467536; x=1690059536; 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=bI7F5jd8U0pmZoDCjrDdgbVISfzJlV2CUqYAibSVdHZ1OfrWu+Og6tKjTlcLZOSWFx f+VE9wjvDVgQCRSbWCOuVgmL30v4mkM+TeOOIsHTqjG+MpjulK0jZg8Kight1gJqL3EJ uelPGFi4K83pZcziIo91nBQ/Xb1a7VXoH5rDwteSo81u0B0E0AB9v0ZYlD/3EFJOnXaR LHJhz4j3eKvixa2uY3tcUc56YA7rm/NnSwLp194pufjXDiSsyScPz/VvaVef5k0S3cDu KA06LddfVd5MnGrcrI8kMVYj85Gsgf9HVHh6xfDQTCqtTE6ZYhHSEi5n5/a6D65T/xzp 1jRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467536; x=1690059536; 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=c+kR2vewUK/KNQOCQKlW7CRpRCh8CzI24nDekrdFXX1wwtlYiYmSwS+DEkLeievnpT uoO9M0V/Cltqdwbyc4Uxh7l/xsdcOrqnQsU/j7o+38mLsFjwr97PXhScowczwKYvwCre F1T/uQ084pwNUf/NqTlZDqtM+cnJ/XnFpD01LOIKqI8cm4mFWnL+FSVYXxfnoxuW0Cdt KE4lIWfPz5N+ElzTVoxBIZ32W3MtZCQG7BJdMEu+FxuN1gHohZwiBDk1UCXHSHYqtlQj VEVlw2fvEZ/FOjbwWOZRxB2CwpEuNCmy6HV1mXfFe/OnpV+mhH/SAEzITbiUgHqIsMQP tFvg== X-Gm-Message-State: AC+VfDzkdPRsJc/3zWHu8jyU78NPVsi8JXf0Lk40ghODpdbobSuitgTn dQ8OzXmnnoHjblnINl2cYXU= X-Google-Smtp-Source: ACHHUZ6PptFNgBqCV4/Z0wvxz/N4kUJPrg8w5rC/9pu7Gesur9H1ncl000IRfhTCjlej4fSGBBngjg== X-Received: by 2002:a05:620a:c55:b0:75e:d11d:51ab with SMTP id u21-20020a05620a0c5500b0075ed11d51abmr23662404qki.9.1687467536577; Thu, 22 Jun 2023 13:58:56 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , Yoshinori Sato , Geert Uytterhoeven , John Paul Adrian Glaubitz , Mike Rapoport Subject: [PATCH v5 29/33] sh: Convert pte_free_tlb() to use ptdescs Date: Thu, 22 Jun 2023 13:57:41 -0700 Message-Id: <20230622205745.79707-30-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 73D1240002 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: kcdebo8i9yn8p78hc7xxrasektqgphzs X-HE-Tag: 1687467537-906870 X-HE-Meta: U2FsdGVkX1+Nf4qlPVPY517jZV3W1sD2veYpa2nuwWyvZKXQVVUTgxM8RUqQnFE/r4ap6z+7V72iQuHoYNDF6GzCSyk2oNK/QRRppRvAGlCgXxKqlMjJBcs4jtN7OB5UUDEihaoOZOBp3IJFSF42yfjnlN0vVANbXfIVlHy7r+KYSZXyFjHs+3znGSVInYRrgkWJ/58Gh0CQ42Rour9++NGx/yrD973YoPbvlb0f5oYwf/4fACSPax/4ZkNtTjLrAc7776Mt8MsDRGtOilpJDtnFmtcmG4fUYcb2uE8O5oakGsDbE5QNlusFQ3vPZe5OszG5Vo2UljEX18Uw9j418dA1M2Mz4oxRm2fY3pqgTSjhBqqJ1GmZGPUcKWaODnwtkUGAh3Y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8iR60vX/d1A7SOVw1b8FX2MDbvp5rYKq14BXWCZLjlSzJdr/RHcEH/xmiPUpQPhVhm4apBtWJekwql66wgw9UtEkBZc56Jp85Qoh/QbHXDvOlJg6jWLpXl8d40lfELNYz6olqhPyJ9GEWq+zfETgDuFQdyXywQy9D6BEQGWlwUnacGpHPVtA= 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 Thu Jun 22 20:57:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289627 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 58720EB64DC for ; Thu, 22 Jun 2023 20:59:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC2D68D0006; Thu, 22 Jun 2023 16:59:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E4D918D0001; Thu, 22 Jun 2023 16:59:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D13F58D0006; Thu, 22 Jun 2023 16:59:01 -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 C29628D0001 for ; Thu, 22 Jun 2023 16:59:01 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9D8131A0594 for ; Thu, 22 Jun 2023 20:59:01 +0000 (UTC) X-FDA: 80931598482.04.1145877 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf25.hostedemail.com (Postfix) with ESMTP id CF611A0016 for ; Thu, 22 Jun 2023 20:58:59 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YrTQVBS1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.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=1687467539; 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=Jf64YYgjMix+bP+84EGlLYToZrQmhYBhpHwBSPDO7lwebpLsBXJMKg8bVQ1y1TIF0Aw8A6 yoFcq38eRDtEy4q5LPUOClclFROLWCe6kmJV9oaqiA9fs1Zz1zA43Ocfog+uehvi+WRwTj /KOPb9ZaZbWWj1rAJUgzzJELv+jZyZ4= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YrTQVBS1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467539; a=rsa-sha256; cv=none; b=xdxp3pHbV7luWz3z1yDeXRAFyVm2fv14LaqqANxsWMMDTz1tGpuBG05569hJ7pfglY/ryX bhS+9C2JUY5aVa6cGMW1p2RnhBW2L1vePLKWryVUZUJSkpHtCY9S2iB51szvlvztGlUs2U oNsX1pjLao61K3c8Y4zraatCAO3DQvM= Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-c01e1c0402cso953342276.0 for ; Thu, 22 Jun 2023 13:58:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467539; x=1690059539; 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=YrTQVBS1aaA3+7mVapNSFssjb2+AQ4IJNUOZvGKIi0FFDtk+PI4lWjji8UMW0kBniw NnyjjbhzJwR9iWxQ73lOHY6xUHgKO2FQSJubgoxvZQoc6uqJluiv8iO+GgjzyRPTTUNL H+9Lt9/vRpqFrdhngSNsPgL94g8nz/f64RVJUcVyBqSkPnGnipXpH3S7tTsIQsIL/Sfj /1Ey+dh+UNfiOBDZVuuR0MUQqWyu0BLKscPyo1/sCfwSnYduy/XWfVP10dsKPKfMX/jd CyoAvKAcNWnuFLqmsDX4R/ZAToeYgRboOEEoeu7mlCBRRzYoIoPibXR4stY18tIHtLmi 9aNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467539; x=1690059539; 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=YD49zsrqOdU2w0G7/oekg1OayHYRp93CyUxOEMn2S51bcT4T9FLh8PcUZLQ5pIJXli zInMmPAL4HuSO2zMxHobnrPkJ6dYX0xz79RC4C9eRjoh1uqDTJMJR1laccwbvGGPoksu 5n+vJsQRNFcKoRT0RoNj8jIC65rw8gJj0HInbHPB5ridHRoKa+iepe6PQtUZzgg24PBG Hx1L5HuOnJmF4B35mXn8sEWMCXihvWtCBJ9eEPqcjyp02yJcpERdPs/CnIfZtqHHSHFr Iodf9lIFR7TFWTtbzF5wH13kIBX/noHUr7VSJ/1b64174RmxCUwtLDpzSOmg7wEdOViC BqPw== X-Gm-Message-State: AC+VfDzHHtTTF/Ooafvt1TpLS+lksT4oyY+Ni58D+Q/TamLQQjUeXO+W ovIHyZptXUmFMHrspI5/gsQ= X-Google-Smtp-Source: ACHHUZ7RSJK82blK0n8uMP8fjUDg81SPK6py6Hg2BA1/I5Xa80rVzDG2S/aTt1mnsQBJvwPYu3STMQ== X-Received: by 2002:a25:2102:0:b0:bc8:914b:c83a with SMTP id h2-20020a252102000000b00bc8914bc83amr11442005ybh.22.1687467538676; Thu, 22 Jun 2023 13:58:58 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58: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)" , "David S. Miller" , Mike Rapoport Subject: [PATCH v5 30/33] sparc64: Convert various functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:42 -0700 Message-Id: <20230622205745.79707-31-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: CF611A0016 X-Stat-Signature: msdqbyampfxmhdhkesqg4oxgirrsipx9 X-Rspam-User: X-HE-Tag: 1687467539-674519 X-HE-Meta: U2FsdGVkX183K5ux+CRff/nBTuImGadxc0wdIisA/vSiUhGhcV9EeMyWZeqVbtaRAOGD+KIDXhnyYGZRTipMtUz6fpIPFf0cjcwJJ5tl5GBvrb+FAaZHEVCbLOGkFgPdQLHOGW8wIo1tUso6WMkqhIlrpbPA0Cr45SCyZR3XL9ZIOdK0q8bUDBfUsYNW+OqeFb7FWKK5xJlRcL5TQxeW/zPMb10rwg+HiTMBWK03G9V5xN5lTBFMZjWKG3liPpgjSAyN94amgv7vu0SrFAC3oUJBX9tZyPAB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Ka/N9wXtyvgTp1gzM24zMFEatvGcesWKuM30I6drWv82kh6vu5lIeIT3aS3CqlfXi3KgFypPjYsBKYUP0NxaFp22zHg5MXWsLmeuw1iVV8DnKe6oudBE8czzmEhVMn0rLG0YV7ezybXkyBNUFtJg6Ho1/rwph3ixw5qRfkFfrYx3W/55//6wF+59fQxjcEzud1LfQYsL+S+7JUy2a+nyOhOqhwGSMrIYrfJ6vkmRS3zJd2SQJhl1p7KA5M+ea8Kq6adE9diSZZVl2qzh6LFB+hDkvegysNqWPAjlxy66MPNrE4e6gW3xAmrtI1aa3iDAWzux 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 Thu Jun 22 20:57:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289628 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 9CE7CC001DE for ; Thu, 22 Jun 2023 20:59:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 378108D0007; Thu, 22 Jun 2023 16:59:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35E0E8D0001; Thu, 22 Jun 2023 16:59:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F2978D0007; Thu, 22 Jun 2023 16:59:04 -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 11D558D0001 for ; Thu, 22 Jun 2023 16:59:04 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D9C49B0378 for ; Thu, 22 Jun 2023 20:59:03 +0000 (UTC) X-FDA: 80931598566.14.D3E5BEB Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf16.hostedemail.com (Postfix) with ESMTP id 9F04D18001F for ; Thu, 22 Jun 2023 20:59:01 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=oM2eqoar; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467541; 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=MULBJzljSEMpKCkYcBoXAPe6pzMgvw+4VomlZmcG5tZ0/zNgk8iCDdA+VuO/iPLZQ1KbTU MKyuuKuY7P8BJg4FDMAomAtEyrV8TebIg3z2ZsoTKeCvEyeuNuZcs2kUw1+U+l1v1MzpbD Zi+wh2QqhLdTGefv+xoa8XIFkG0E3XU= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=oM2eqoar; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467541; a=rsa-sha256; cv=none; b=7h+TKbPhTD4pkBNpVwlZn3/Ne3DxVZak+tewpnaUO9Zv9VrUhRanm4aIqh8KcDdi1L2+sl FZzSPODmk25hJbJETpZuxzCxB285G6OLbFcBr4p/BD/j1Ov/vyqEa4T1kh3XMbjklh4XWv JpRSmq3MCCOuFn2DcAkOXmicdq+j+Ks= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-be3e2d172cbso6083584276.3 for ; Thu, 22 Jun 2023 13:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467540; x=1690059540; 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=oM2eqoarO5mbV/RC9CFfzfiqtalAJnN4v5hz57x8U3YE+/nDsUrmXb6G6NrrfuA0hI XHlp77eZ+DzSkin9lWOejdHXde4PpTwM3RiXeCXAduuSgLDQHciXyNj0UWZkZs6yvfTo QiJ21UomG7h0wL2TX1WHwgye+s/VKR+Tvt1mxLr3lV1WjwsNROzbcgrXcLO9VnGSpeAH 7uCU00iH87QJVCo5EKIyfZlW0ogPYyMPi5bY1z7m39x6DegLfFGe3afEY/9WN7xyqGjN dkO4NEs5eZtRaUa3RiJYmwztOORKB/ecQ6EJlrLWdOw/VRXBlFmMwGL9APm0v6t4+G2k ZQDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467540; x=1690059540; 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=egtt6i2/2BWMs17SE79if00T0AbrO8Dgo8nUoB0191NvqhogGgQGSww86iqUCNv+Ss uOF8MJLGy+3tltNJEZNDhRvHw0YNUjfvr9aNZKQsYbAxYLglvtI5RuhQGMJLzBenLuSl xbVkjyXBO1iuJSjxttZxTnt4rj1BedrUrH/2l97mYcDFZshfq8U+ToiPWRZazbSF5R8d Zboko5ela05BFhy8YP7SCVxgy0bmQiywRPl/e36kBp+G/6GAgHh1DQbG7dkyj96Oo79S W6qWCI1077qPfTqG9xa9CPqaVevBp0G/1WxIoacZEnuyDsSpbNcLuf8Sy0nQNHKcUwRT PuBQ== X-Gm-Message-State: AC+VfDzfPq/PUmwx0ymsSdaEF/IxttTQSVoB3KJyt6B4faIuAy7c8Ytv kuW1qyJ5r18SMVH2i6gvv/w= X-Google-Smtp-Source: ACHHUZ6Ec2kbAX1UDgGMj9ZCyBvb/VNaStMToJEcOH7SUf7INOW9CMO0HLoZFa/KezNB/PETnccRFQ== X-Received: by 2002:a25:bc53:0:b0:ba7:db6c:c0eb with SMTP id d19-20020a25bc53000000b00ba7db6cc0ebmr10225049ybk.3.1687467540710; Thu, 22 Jun 2023 13:59:00 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:59: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)" , "David S. Miller" , Mike Rapoport Subject: [PATCH v5 31/33] sparc: Convert pgtable_pte_page_{ctor, dtor}() to ptdesc equivalents Date: Thu, 22 Jun 2023 13:57:43 -0700 Message-Id: <20230622205745.79707-32-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 9F04D18001F X-Stat-Signature: dkp9p4zj3rbkohb69pdutoc6ptjwfzdc X-HE-Tag: 1687467541-750274 X-HE-Meta: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A1ghWzWYvfOI7CNpn5gm3EWLnPczgACIhYWtWQOinaG2rqvstR+XmmKHh9Amq2cMy9i6XZGSOEbsoyAXQ1IohiJXW4bLexkvrAC11TaYDJZ7Fq3vsb1dM+YNCS8/QTDppzU/8fFWdCJ0EvfwJ4WlajQGVA4mL20zlqarwUbSJ1Io8NuoU/5N4k6Ha0IUwyzzqtoIR9tCLVkRYL4FJx70B0Y94xuwU6Y/Wtsttr/nSYPBXvlHwj3EfroVXsJMUHzMkSGz1uzSFrkJBOzALDIFU+r2yWDBj8QHn5Ka7yJavg+o263Bu3RNbyyvZo3A+ad5EYdaVYMZrkDXuWBG9sx/jjtOc4E21gw+TyAaSOtdRXY5qcmAq+N+LbGm/Q1nhV09O3MmlAm3Y2stYFScw0YbiWbbFNY9uyJ8sDtPg7njYQn+CDxa/BIHXWAIS+1X9NJYr3jjCwBYAoCJmnpd+XqNhil70R9X2BjIL3JrkYEFdPcCqqcV6d83RvrdPO5kR4HGSXm11CmMaBJ4Nbm0JVu7uwkuvc71tgRq1QY6B/3gNDOXJ0= 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 Thu Jun 22 20:57:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289629 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 E5E75C0502B for ; Thu, 22 Jun 2023 20:59:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A9268D001F; Thu, 22 Jun 2023 16:59:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 80B028D0001; Thu, 22 Jun 2023 16:59:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 684248D001F; Thu, 22 Jun 2023 16:59:06 -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 5A5F68D0001 for ; Thu, 22 Jun 2023 16:59:06 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2DE5C14017B for ; Thu, 22 Jun 2023 20:59:06 +0000 (UTC) X-FDA: 80931598692.28.2680CB6 Received: from mail-vk1-f180.google.com (mail-vk1-f180.google.com [209.85.221.180]) by imf01.hostedemail.com (Postfix) with ESMTP id 3302940014 for ; Thu, 22 Jun 2023 20:59:03 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=JIPmtJWZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.221.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=1687467544; 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=IKMpHYvIh4HqidfUipAskXV2Cfl+jvHpMn8UmFh32X6tLWbALm8W4HlV7pzUyJI1c1wRkx sPNMdMda8Xyd/d0k1lnwWwW8fhqZLDZt4noXgAoujRSfl2dTxMs7KP2dNe8eb3ye39UNbn mwJVa+Ss2/1zbn5rylE33CMho+aOFnU= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=JIPmtJWZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.221.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467544; a=rsa-sha256; cv=none; b=d0UXlD79zDN4BDXkPCMGozXxEmKY69nBa7mZOWKgDBPEzJiXux6nfj2mbrv9ZrBxNifBTd hMuT3BK9S5qWtJwisHu4y/JTp5cG9fvN8RsFq8Mi4mXzfYLbC+daLIAncB/22KUuPkSnDl 25ltGuc3MQzl8Z7l3fnnnhzc81ppEV0= Received: by mail-vk1-f180.google.com with SMTP id 71dfb90a1353d-4753de0807dso1171546e0c.2 for ; Thu, 22 Jun 2023 13:59:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467543; x=1690059543; 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=JIPmtJWZzsFuYAbPd3iclg33SdIOk6GD+7bRoJGsXkLCA1qQrwoboYccPvVKSwty8z /qB14KJSfGNtyZY8gC2KXxRSZzLDqLeIztRDYfuoehM6XT+tgKnz6817MlJhyGs2y+Ff nzC5sPDHJyAHEqzN9xTnBixLp+PW75W3jhf77P4PsuZDMkZ6OcWV4Xi+Rqew178LHkOZ sutRPAF9NDYk2/4a4fGlPwKxe3Z/pKSq61jE0ZBiyKHaHi8RSPhHJpH4MRgs4uLl46tG QM0pvqokM6W0xltWNxHmZb4kL6K9Vi53nErkSfWOsX8epBIiO3LuoRLa0NZXa1LOWk1D I+ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467543; x=1690059543; 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=KYz29+ZTmm4q/bsEcj1gn/rQoC0fbmYHiDmEQBq2gs1W8LJFyJLCOegMxWsNrPSTwF 2qitVfwta4zbHz6ZRVnH5nRNbZVFCHBpgxJeHu+NzcvaFdeUNcUTYKq8qegVSgLxAvol W1+k0WX6vwsOrZH+NmyvuXLqOG5y0faoMVoyF+CLiiegKKPqBbDTIlUogJaVfDtyzc5x MKZ1PYvaOOgM6ay9uMqQQPuofMpdWQ3tXR3hg3V2yHhVng1iw8mr7IovhH5vlzQ/8thU 66r7rJ2l6EDkV48NtWrgDcbm2Hz9Wq7xWDHU4ukp+uUUh9sG/RMtd5KPD2ULnL7mJ6gp R2zQ== X-Gm-Message-State: AC+VfDzhLRqBivUFdoPa+MxCDhZj/NWzLRfH63gibp6cn6OuPmDSBK4T jGSSYpq0UA+gDuAgAtkCPP8= X-Google-Smtp-Source: ACHHUZ4B8dweYtEIi2rY8Mw0qtzsz5NxOVUlUIQPQfiDh4wzrLYoG70uIa1HADP+PMU/T07FaShgdg== X-Received: by 2002:a67:d087:0:b0:438:d4bd:f1f2 with SMTP id s7-20020a67d087000000b00438d4bdf1f2mr9462119vsi.22.1687467543144; Thu, 22 Jun 2023 13:59:03 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:59: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)" , Richard Weinberger , Mike Rapoport Subject: [PATCH v5 32/33] um: Convert {pmd, pte}_free_tlb() to use ptdescs Date: Thu, 22 Jun 2023 13:57:44 -0700 Message-Id: <20230622205745.79707-33-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79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tHKX4+293qLEdzN67TinhFDaRcJkYldgUasJXZFx1bmUBfPKtlxir8jpwlue8WC XT/O9Bbp GLEgo0tdGqYhY97kzP/0LmzCPqYtAiPGm4R6ef6X85QNru+51crXLbzT6rwOcFab7BEmzuBBuHx6LFI1FhdHKweoWL6gXcg1xPLoMeXFzy/9ZoCdLpTysn/J9gSbJLY2OV6ZeUn3k/vbfMOctNhpMuc3YwRF4UP6LDzT96I+lTw8nzGAtqZuGHw41Yrnw8KXraLjwTnp1CNDWVy/4g4XPa0y/n0NLe4G13BCvQ+POPk5JjWXnrMLw7f++6HTiSpfHFsgbOAmE4otMF4oQx3C/Bbs8sh61u0SNK9iwmcWcCaC2bQ/BoXqR8JOL/bMBfos2EOR7dP+cEIeZRfpcHzKNjhAngWnjsYx7tywlgA30+N+/PJsJiYBuIvj+X/fHU4CH27jIHcMwMxRnwrQm7vyvMSVmfENhvxwZkNZCYqwKitKM8D04cJ8izo34oGLYSmZpc7eW4cqb6xWonVhHgswe0Qp/RMZhIrAJLikRsnkxt0U5HxQ08YIyGO2EEuazp+faZ9QeIdCUxTHtusZ5a6c9JiOPM9f8dmE3xzdBQKWA40WJDNdfHZrfapszDND9JlcRgbuOg2nFTM33ATKPClzSz3Hgz6HBBaXQtAvTbX5JiLxj2XPIdBKzZ/erILidMpzjlNxzkpLW59/5XbcwLchp0ibOK28/pQ4b/f0e4BowdiR3xEhNpB8vdyZlPAeFlRW0tw3z+Ld/RMSLpaU9Is938AFIGA== 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 Thu Jun 22 20:57:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289630 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 E8662C0015E for ; Thu, 22 Jun 2023 20:59:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BE638D0020; Thu, 22 Jun 2023 16:59:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76F058D0001; Thu, 22 Jun 2023 16:59:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E8148D0020; Thu, 22 Jun 2023 16:59:08 -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 520D28D0001 for ; Thu, 22 Jun 2023 16:59:08 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0E5EA4028F for ; Thu, 22 Jun 2023 20:59:08 +0000 (UTC) X-FDA: 80931598734.12.D55C1F9 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf08.hostedemail.com (Postfix) with ESMTP id 32615160011 for ; Thu, 22 Jun 2023 20:59:06 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=oQo8Ww3r; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.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=1687467546; 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=M3B/eiKCnJPIi6JIadhUsmjdRe9kcbhFUzHQjYlhXFUPmZoGTtR9XFmzXYX8YujK6tPPEA Df+3W+iePZbWS/UfxDRAOn7kC6TMe5S3KusiujPtq40/TcDjjafxkkpR/L3PFi8I6Ncjnm 7FGhrpAKaunkRKnkMMIow1wfLd07ULM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=oQo8Ww3r; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467546; a=rsa-sha256; cv=none; b=M5OQmgbyJr7dp5D/RQSc8n21UeDZ9on1nJ/bXkMo+ju4TL537WVSXAWpmE4IdRZsq1BCV1 v3QWmJY7t4kh4ZfUtQMGNSRMmFXByUSV6SIPEp9LPNLZ8mrRZhFBhm8VybgGN1QxtepRiq NekczKJ8XECTJIWqdGRZj6D1MbmelZU= Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-bfe6ea01ff5so2381185276.3 for ; Thu, 22 Jun 2023 13:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467545; x=1690059545; 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=oQo8Ww3rkcQ6O4ERZYbbm7gIN+KUZJBSX76Jt+A0yqxzuaw5csFJ7AbMPXoNar1y+V tZQraeqybmf35Qo5xoKl1awKHEBN/Nxr+iHHL+iOhynJPYAD9oID72CJXajJ9Jf7DkVt j26rlavSXJqsTv4JH9m0aLFnC9iK42GCsz7JUCHqTbiCOXGPKTX89JvhbmgJctDtXiKK TITKlfKlRxN76qLZH8F23nvkVHDCJrlE7Pe9NREUl+WlgOK0PObb86E20s865la+XsRl r0ny/7zkkdzJjzv/4f5M4RYeUYdlHDKmxWEXxa021UXcBJ73jIQME8NWHlpzSqT6M39a D91A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467545; x=1690059545; 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=Dl1t+c7s+mpxcj3d8+FrzkctJxe7p02pZZ72uQBO+bQtaIfWst/UPwfHduHP+KBCEV vVUPSRM1ElHtuwpBq7KsPezsbbKeDi1VMoxq6xK883agZFs0h26AWmcaldwpoG4RdWOY VV4r5DHeZzq4xUgpR1aZOg5o05rFeN6dnzbzkMNM4CBfb0f4HY+C5zxCKNMTbyPumbvE Y2gcUZPOBjUPY0OxST6QjV0DA766B+IDRqrAssdp1oarATM8FLf6nJEtVocWBIJn9kwA BoLjUMohtbabxrdnxbSBgVUEsy3P497vLVn1RwKGVYqX3zdkW8uUS6jfn2cHZCX0caPi u/cQ== X-Gm-Message-State: AC+VfDyZiQO8sbE2sTCoBUo2NqhJY2C6HXTE4QvhkygAWrGLqTRCna5B HFoT5NgViPUavi4zUqVDrq8= X-Google-Smtp-Source: ACHHUZ5/16pTE8w+KmQXtTEHVbvOJ9pX8CyeEgbjUI2ZBq46DEtB7j98e4dbCDGlFjYL7Uz7mrOclw== X-Received: by 2002:a25:d707:0:b0:bca:9c66:e53b with SMTP id o7-20020a25d707000000b00bca9c66e53bmr16719019ybg.14.1687467545228; Thu, 22 Jun 2023 13:59:05 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:59: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 v5 33/33] mm: Remove pgtable_{pmd, pte}_page_{ctor, dtor}() wrappers Date: Thu, 22 Jun 2023 13:57:45 -0700 Message-Id: <20230622205745.79707-34-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 32615160011 X-Stat-Signature: kfmijzj36rqzb4id5znm1atti181am6m X-HE-Tag: 1687467545-392230 X-HE-Meta: U2FsdGVkX1/E6LpkY6WeeDmIJgClwhRFZYCwOnAoWA5VxsS77NaER2tCvSMEUawkSbBDtWzHmgfAKduySqUQqfwiH9fLceUuUWTGnIRlJnhmt5TwuSheB/wte5UfOpODjitPdLYEksLslqGo60+u38o8qgU2SLNe4eWXNQ/bINfW9gYdas2j+Vnd0Uz2Pkhkff65mqEHaYeWNb/XYj6GEbaI+JUgJDzTkqeqvdLuDcbYPbftZLpog6OCf2+ACULQNH80PvXW8yTNwLnmN0FyBLNbPzgKps0YzQxXqDGZ9ku8OH6kbV23QJJcH36EfgoRSd4H+beKE6tpvyLKz/DncrH8hWO+GsD7lGlHuwUyF46ZoEIVymopzmJdrpVcZM5hlaW32lCATxYgjln5lH0vtaZoTVLLl4JJC2E8Aug6PMIDkwTeUPZnPuKiwLghqtcKNDg6i/FU27Ww7Iwsgp6TNm20P8lHwBws8V29QMN1TDaUIzkX2s7PtWKBQFwJZQQCcHRQhuLss/k8Dd4rV6Nniipq+AObeUCA9tiBExFEj+a4S2g3D4QLAUWP9c0rFv79yTEg7eQfYasQc1BrkpthS/zAIht/3mk5du+l6DY06+s2/MbngDBxT85B3idtwXdaZVJ4hGVt6V4yw7GGrLqmPtAiY/9kZJ+XsShsOhK0sVHgNJp6RXxkFONceS+QBqX3ci3czdEqXZAErHCnczqu7Pktd1tcQwSKvOQqq06ZCUJj9jzOuqGXyRtXf5jXnGNIAC2CACHrpnfYUehRbKQe9grQSoXLrzRe2PQfx0g2VeyuobMfx3c53+F49A8KCXRDRbKh+te3KBOyfILH8D9croSdjI7piVjqmU/ZwX/BS229ed71ReAOIXweVW6DXBe8Jtqr2jfvo7NwTU0cp4MZPVuBk8yh16Uolxbw7PXcqlyq6gaXmuYE6KBQNRXM8/SEe/DPDzpW7WzV45u1mym XIZP6zSQ xcAQXVeDaIRL9oj8hWFcBueGel2yTEoGui2h+TAU0M8u8VGRzABewXvKd7M+3kgQqLTlxAai1yQjSt09nj8RDa48N2K8kcF4hefprHPu1KJx7Kxm6osgw59bGxfsAhZWwufY8wTevTbZuSTF9L/Y9k2KeUy/4MEiGyE6+8hYngttCNEl/aHrHcRg+H9/1l0DUDp1RJUM9o8iArNwbquClNfxtN0dCprIcf2vHFSU0gapNrXn7immtToGrR91egiSFPF/xIWxoaVfaFSNrQhLZfqIHWt84ZIkZwveUUTRaJERUuvamyeQ+Un+LZQ/vRCHTtxg6g5N/KNrGLx8JmZReuS+NWQvQ7S7yz1dhtwrxpfLIhqht5KeWrPGdEysSAsOwpuGovi//AaSustwR+2DESci9ckLLu/8z1qtdlMZQKY8sCBXKlUdoB0G4DJ6ljjOqMQ+6/7xnqJtZvmLMsHtRvxXjNeahB3WN5d1rXNichfxiknpqKzFEdM+hEvblk1A87f75sIQ4x32Uxtf3NHKNxii/lXIxt14tRfkVskS4tfS3Uag6f1vloHOXbi7X/vzFOGOWGR7EBWujG/dOe5pgB3D3eAGSxaVx1v2nFnT2Dl2SUT7KziQ/eBGTIFsle/rCIkh/8tB1j6Wiuao= 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