From patchwork Mon Aug 7 23:04: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: 13345285 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 A88CFC001B0 for ; Mon, 7 Aug 2023 23:05:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5E218D0002; Mon, 7 Aug 2023 19:05:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C0C3A8D0001; Mon, 7 Aug 2023 19:05:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A86AA8D0002; Mon, 7 Aug 2023 19:05:23 -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 9C7D38D0001 for ; Mon, 7 Aug 2023 19:05:23 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4D3D080185 for ; Mon, 7 Aug 2023 23:05:23 +0000 (UTC) X-FDA: 81098841726.17.88C548B Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) by imf27.hostedemail.com (Postfix) with ESMTP id 761F640022 for ; Mon, 7 Aug 2023 23:05:21 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OAmqT2Yp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.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=1691449521; a=rsa-sha256; cv=none; b=Yl0Vpo7hKWE04QD69XvXmkA/oqXqsHxZA2xv4GpVylfdaRCyimFkGLwvUSCRi0ufa8N/g1 bG53NcZ5jJqm63HaopEoAaCiEoit5oV8PK37entIniPuJUFQkrrR/E+VNsuplztQHAy2Tx ULKd8O1gmPaa/lG1d7FIVEh6N+BkPa4= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OAmqT2Yp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.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=1691449521; 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=4fjhesd7+rMkDZLOr6Kc4cG8956dLxCQQb+ozfQX3UQ=; b=DsfFLJ5+yn1QS8sW8kD9zLSNHkyYP2PH1qBCDJMziC3V+8An+bmRVIRsSPgOpM8FjtGvfV M3AR+S5yOO0JgdyqCQrLR1LN4mgaDX27rWv3JAYPYLwicqMnLn2tjeqMOclLwqr1RNF9Z0 oIPAef+zfHg6m5HFrGNiG4Lid7dyDQs= Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-d1fb9107036so5482618276.0 for ; Mon, 07 Aug 2023 16:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449520; x=1692054320; 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=4fjhesd7+rMkDZLOr6Kc4cG8956dLxCQQb+ozfQX3UQ=; b=OAmqT2YppB9CjfKzA6MbkbWQuHnOV3YDebJzEzMnvrYaEBnGvyiGDdIgN+UFddYCO/ oWD9ALjnIUimu69EOXrUSOl0V3EQ3lBA7Y1MYmMc666cwORz5NLJr1mYNrQUbkaEMEWb UevlkxC+fhWM5pG0rXCbCmrqQYjTZk13aOAK39qUeW68Z9nV/2KJzWOSzi4xEeDeVL48 AtQrP4AvQ44B2EZwMOx7Ik4iUJ1TvzBS0XzBfxhLsaCN0UqBFIO7A8RIwj+QqN3o+IuJ Kl4ISRZis5dwTBUexOURKgSzbeO3folaxRuVtH/QGDwOd5SIJ+mmY1APEfvTznAxJRIC w6YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449520; x=1692054320; 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=4fjhesd7+rMkDZLOr6Kc4cG8956dLxCQQb+ozfQX3UQ=; b=gE/vtZyN8SzasYMKFc8Vm8uxR8kBUOrewX0Vo88zyX6jnF0dFwNIOg2FYyu4u9bUaa VgKMV1OYQRZxMUiDXLSgeW8FzEH4Zmi70PIdi9E77zML9lobzpB0HOlMM+6Xo52zZfhg KQAwZl2N6p8JiCpWQL8uMw6KW53KVjG17oHvr6ZoXPhPHu5jCh2UveuuN6TX4fVJpzin 5J65bxYZsS1gachBp6DWRvFzUpe6qpcRXsFCb8hgD0+nGdbW0EXg4nRg47/nsrVczPN8 6iWiZ346T9S79EQAvTutFjo2MewA3ImBkPe0u+Gp4tWYVHDT28UbXkqoXRZAAE0mnSwt K9Fw== X-Gm-Message-State: AOJu0YxTIEtsOSDmce1gmHJVUasb6nwr33+u0SD+7HP5qn3ltaAz6+JD HIVOZN8Oqi604Kv4jA7tVzU= X-Google-Smtp-Source: AGHT+IEx2gi8PNow/7jZZuthXFdwcQBm4qVvrwXdHrr7o3CRr4bjoCnJoA9HiZN+Tg0Khw5JdZ/TIA== X-Received: by 2002:a25:6088:0:b0:d2c:32cb:c631 with SMTP id u130-20020a256088000000b00d2c32cbc631mr5682581ybb.27.1691449520366; Mon, 07 Aug 2023 16:05:20 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:20 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v9 01/31] mm: Add PAGE_TYPE_OP folio functions Date: Mon, 7 Aug 2023 16:04:43 -0700 Message-Id: <20230807230513.102486-2-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 761F640022 X-Stat-Signature: jymgpqrq5o8ez96ps6q66edcg45gytr5 X-HE-Tag: 1691449521-324410 X-HE-Meta: U2FsdGVkX1/BqntY0DFrBjlEFksu0iuLcD3e/H41MPDtByuDpGS4kYEnTG0QjVM6s2Rlb3hmTL83V50WSRm0oMNuWtowx296IAes7hE90phaumVnCTK6ekKrt7mnz7/HseBHQLISzCSnruDNhaW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yjqq0WewbRhXyb2KxTLxzlks/2wxlol36Tgje+11+i54KzXVq9MUuf2+tlOjWzP8UZbyLhflg2MdrLxxvpf2RkumPVbD4QNicY6ziSZtQxj22PtlaJiOjkTLZjkIyDOI/+LEmlWt1t5TJMPwLMT0T5REX2AJNESgqgsnCATr7MDGZXBxVpKxZ3AKs7XKDwEzgVkfe3YyD8CKv6h2QJRwl5O14nTadpEVmvbPzcjqWhE2hr10TS6DUVI5T1naR/MgUd+nggq+GBIqHNjTcFxOrEFGInUHdt+IeXWK7tDjiDVpNPdy96XTmq6zRbLQEVS9HHgEun/iz1YtHF+O21jK2v8uWM/2LoHosq65jkbNBI6T2Z9JmZFXTrpD9CyUnOKmaARhEFsUPSApfLeFbtIw= 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 Mon Aug 7 23:04: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: 13345286 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 93E14C001DF for ; Mon, 7 Aug 2023 23:05:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C4E28D0001; Mon, 7 Aug 2023 19:05:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 97768900002; Mon, 7 Aug 2023 19:05:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7EE148D0006; Mon, 7 Aug 2023 19:05:25 -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 70DEA8D0001 for ; Mon, 7 Aug 2023 19:05:25 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 4E605A0B12 for ; Mon, 7 Aug 2023 23:05:25 +0000 (UTC) X-FDA: 81098841810.29.147EB4C Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf24.hostedemail.com (Postfix) with ESMTP id 78D6C18000B for ; Mon, 7 Aug 2023 23:05:23 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=oFwky5a0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.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=1691449523; 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=a34f21esV50lWBersDNDqmppsx1/6ilmHOTavl/xl8o=; b=IfnWIFMgpLlxc8vI/CkaEiwtnIeNTAjVZByclGf7jT1JfLQRToGSB2ks/41XbkccUFlOWJ p2357LaHARAcXyt0b2oSZDIsbIDNBCtRkO82x1JzdAQKtqaYNVl0vqEpo14Hsnsse3yU2Y bbrGgODt/TDjhtFP7b+VIwvMvMoYOqg= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=oFwky5a0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.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=1691449523; a=rsa-sha256; cv=none; b=vVDRvj+QEGxbf8QGRHM7InV+FdWgK7UQL2aoubHtc34HlLbbjbkNmydQZX9SxJymYiZD0Y Xi1swP3A3vONekXiNb/pxhhDkU8sgvsHwLA25lrvZPRtnQoG02dF6dn741K9zNea5tnZo1 +B79lJmYyjizjla2gugx9kFoYjCCakM= Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-d5869d9651aso722674276.2 for ; Mon, 07 Aug 2023 16:05:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449522; x=1692054322; 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=a34f21esV50lWBersDNDqmppsx1/6ilmHOTavl/xl8o=; b=oFwky5a0u6RDMZneanUwrrMHlk718vp357up6yt/zwnqVYFChL1rvBLlof3lNCzIMa fNsEK2lTF1AVBptjZ1CNiCZUzihavKETKYN9gVvYQI6adZVOr5WVilhYnG1hRIdUadMS rZHYG0cY0MgC9spT/xtrGp0Z9RSAR89ub11+qTFSD/NHXR1SOhgGi5SO3dghfFZLOejg KputLo/y59tBrGZ+oHkk/Miwz+ltthb0+dR9j85/GLscklo1srlDZt2wotLowv37n6A5 LO+9uJnrNQ6hj9u600MpE0S2h1+9c+75UpIga0Og5F4xShPF0bPK2EhAmwZTlcxr2oZQ 4pBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449522; x=1692054322; 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=a34f21esV50lWBersDNDqmppsx1/6ilmHOTavl/xl8o=; b=eV6ohadCRc0+8MHPUORNukER15MjxMX9KTbg/eANrtdO2fBe1WkrUh8KPxRApv5I+M TDaRDvo5IcugcqKhv8OUhEUNrR85/JX52Knfu4kcC626egUnfv65JEx+EcFW3vYMkzGU Zl02TGJdtoVqck98ZjhIJIcGm2rnsQqIUdRzhUgI8xU1dSHq4PxlP7FjzKMsgcxcxwVb 7W1vwzm0AFpxHFUDLZFnT2f6I7bPAQd8IsdfYYa3y3IaTf3aJHtHNGn78qJPt5n17a4R zJ43mRFw8lw0nUrN9RVjHSFVe9dTEobOJqfxWOn04tTuq4gAKtBhTWRKn0GgHQqHwKL3 nYpA== X-Gm-Message-State: AOJu0YxNi9DGyvLq7JFMs31p5Pb7C/ss7rBAv0OO4g/0InL0SFLTzL/3 ywTWgO1G+WW2rAAPsN4Rh00= X-Google-Smtp-Source: AGHT+IHp9NHIhzlo/URxP7pkQYxSTPvQNJLHOzpXCbXbudXygK+XnGEho5KZf1Qzac+pXhrvkYZIBg== X-Received: by 2002:a25:320c:0:b0:d4b:64ac:a4f7 with SMTP id y12-20020a25320c000000b00d4b64aca4f7mr9519366yby.62.1691449522393; Mon, 07 Aug 2023 16:05:22 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:22 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v9 02/31] pgtable: create struct ptdesc Date: Mon, 7 Aug 2023 16:04:44 -0700 Message-Id: <20230807230513.102486-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 78D6C18000B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 4d415zcumy9a577jfpqhnbq4zy6zq6x9 X-HE-Tag: 1691449523-270476 X-HE-Meta: U2FsdGVkX1/HStTZTuzrg1AYC+G1xKTU4MUp63Xnl/Ds6DPjOBoqHqY/I7tRX+IQlcAGhMa71J3oIn54iWYwHFcKXl0434ckfhL1MDcARvCwuLMa6L2nd9yObIbym3Qu8/5+BZb0ljF9+9YXyK38lF3YMschGzfmmBYxkI+Tg+s8OWn8rwiXdg7Ex8CyX19gK7KqgizKm30/KVapRA5Vas+lhga03xX1q+2YLi3EkzDasFePRXV+s0q77ToKJdqxfXcIuvDXDq3/4J+HNsny5mYzLnsdIMWk57WajJZVw3dHplBwu2eOj4VenwUuBlqgAu9ttVf31oDCoOT/mCXtWfwD1wC0Yxe+JmvRKsF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HtgBqfvxiycaA+0C85kjILb/zPmM7rzdOvtgm9zFI7lGe+vKmtWuYCWbbgrRt9GT3pm8iBpM2AP+ejeB2hxI17rYeQFrI3ri+D+BURBXRKUCU7vo7NT0g0CBMwTpDE8Kfll0Xh8D28tFF9E66CFQ== 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/mm_types.h | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 18c8c3d793b0..cb47438ae17f 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -397,6 +397,76 @@ FOLIO_MATCH(flags, _flags_2); FOLIO_MATCH(compound_head, _head_2); #undef FOLIO_MATCH +/** + * struct ptdesc - Memory descriptor for page tables. + * @__page_flags: Same as page flags. Unused for page tables. + * @pt_rcu_head: For freeing page table pages. + * @pt_list: List of used page tables. Used for s390 and x86. + * @_pt_pad_1: Padding that aliases with page's compound head. + * @pmd_huge_pte: Protected by ptdesc->ptl, used for THPs. + * @__page_mapping: Aliases with page->mapping. Unused for page tables. + * @pt_mm: Used for x86 pgds. + * @pt_frag_refcount: For fragmented page table tracking. Powerpc and s390 only. + * @_pt_pad_2: Padding to ensure proper alignment. + * @ptl: Lock for the page table. + * @__page_type: Same as page->page_type. Unused for page tables. + * @_refcount: Same as page refcount. Used for s390 page tables. + * @pt_memcg_data: Memcg data. Tracked for page tables here. + * + * This struct overlays struct page for now. Do not modify without a good + * understanding of the issues. + */ +struct ptdesc { + unsigned long __page_flags; + + union { + struct rcu_head pt_rcu_head; + struct list_head pt_list; + struct { + unsigned long _pt_pad_1; + pgtable_t pmd_huge_pte; + }; + }; + unsigned long __page_mapping; + + union { + struct mm_struct *pt_mm; + atomic_t pt_frag_refcount; + }; + + union { + unsigned long _pt_pad_2; +#if ALLOC_SPLIT_PTLOCKS + spinlock_t *ptl; +#else + spinlock_t ptl; +#endif + }; + unsigned int __page_type; + atomic_t _refcount; +#ifdef CONFIG_MEMCG + unsigned long pt_memcg_data; +#endif +}; + +#define TABLE_MATCH(pg, pt) \ + static_assert(offsetof(struct page, pg) == offsetof(struct ptdesc, pt)) +TABLE_MATCH(flags, __page_flags); +TABLE_MATCH(compound_head, pt_list); +TABLE_MATCH(compound_head, _pt_pad_1); +TABLE_MATCH(pmd_huge_pte, pmd_huge_pte); +TABLE_MATCH(mapping, __page_mapping); +TABLE_MATCH(pt_mm, pt_mm); +TABLE_MATCH(ptl, ptl); +TABLE_MATCH(rcu_head, pt_rcu_head); +TABLE_MATCH(page_type, __page_type); +TABLE_MATCH(_refcount, _refcount); +#ifdef CONFIG_MEMCG +TABLE_MATCH(memcg_data, pt_memcg_data); +#endif +#undef TABLE_MATCH +static_assert(sizeof(struct ptdesc) <= sizeof(struct page)); + /* * Used for sizing the vmemmap region on some architectures */ From patchwork Mon Aug 7 23:04:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345287 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 C6A78C04A94 for ; Mon, 7 Aug 2023 23:05:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72E62900002; Mon, 7 Aug 2023 19:05:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DC30940008; Mon, 7 Aug 2023 19:05:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57DF4900003; Mon, 7 Aug 2023 19:05:27 -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 455FF900002 for ; Mon, 7 Aug 2023 19:05:27 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1FA3C160598 for ; Mon, 7 Aug 2023 23:05:27 +0000 (UTC) X-FDA: 81098841894.02.C936BC2 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by imf17.hostedemail.com (Postfix) with ESMTP id 4989940014 for ; Mon, 7 Aug 2023 23:05:25 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=L1Go0rwX; spf=pass (imf17.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449525; 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=CHNVeLQ4ERi2aiC2atfDR7Ra/O6uVctCEHn/pbNh+mQ=; b=rz8H1xPB2aRt43ghLUmI9j14Qd7iIw/t0TOx8EqBthrYVT7y9VHSg9CROMRN9dL+FnBmsc jD8QPstWhuI1ORk18l3j0f5ANf4PEFYuraE32GO19Tyfbz8sWvcU1IHHw2coZuUSJjff2B XWFs19f3WgA9vqf9OlBVcg4OPyEu3Bw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449525; a=rsa-sha256; cv=none; b=5FAHG3yc+K+1YLJvt91ngjJDlvZL60+Kd0CqqZELphZGgm8wJaCEIqqd2SDCRY3W8ROpeq 4fYjhp8wxmVhLnSsMu68P4GBP3we4YJ4d73rzSg6leCFpqAQ3u6+uEJ2JUlWN0E9Zuf8qS U8jxiWfymbC86/iI6ru4GgqgD5Fmjlc= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=L1Go0rwX; spf=pass (imf17.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-d0b597e7ac1so5664492276.1 for ; Mon, 07 Aug 2023 16:05:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449524; x=1692054324; 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=CHNVeLQ4ERi2aiC2atfDR7Ra/O6uVctCEHn/pbNh+mQ=; b=L1Go0rwXz95r8RKjbEpMnhh6c018jiQRjrFUv0ntz442yZnhpaeW+aHqb02Xo98603 EPNoaJuJCjZc6fdKeFl/4FxJrSloFA7bUFX05fyGjegXA7V7cuLZVOde3eglcKPAc2dh 7JAUmVzhkgUSMtLYpwSzyd8Ca3OvJH/6CC+nMDpgrmjfqgC7q9SKrYP1x1rjn8+euG1c w/F3CAIitPe7XXZVoEz/F21xQq4ZfepD4AFcrR4pjaM61cX8qLF4fMMNmTw3E/GvPxLQ CGZCqn+AGAHhqM6FL6AO+cy3AaHEnYT+L7t2jnss6vAgyAEw9i6+eoE0/wpeJRdeDqZo nMqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449524; x=1692054324; 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=CHNVeLQ4ERi2aiC2atfDR7Ra/O6uVctCEHn/pbNh+mQ=; b=IG4DxhZFX2Lfg61tR08NlAPV2xXLhZIJqDz9t/ZDqx1aeUSjSsq48IaQvEgFWxhzoy LIkTE9eLo5zv2me3DZMH25lju2xfeAX6BQN7QQHbFJOW38IY+J2PpqlflpdAIuReB7sq PvsigzMiMZ6cNV+CpAkWnd0UAS7O1zZouPUFnusLM/6I1WNJj8JcjfgR2clNAF0Emy+I qLvuYiuB3j5h5grwHb0TStj2eOKn4o56++g0R8YcrmsUwAaahPf/tbt6/iN/5QtJnvLl 3ZU1X5td1w8zUPPP+ZHB9gaGsNId9muu34VbcTWr8tKmIk5TZSliC8u+lPQjz5Q6oyLb xvtg== X-Gm-Message-State: AOJu0YwvnMjxvqv/v0k1N9DPhSQ56zb2rRJLXdZa3o48+1cNAePqwGLr NoVE+1S1m+FqcMXx0YSzZtA= X-Google-Smtp-Source: AGHT+IF30NcYMYJc6ATZDEFP+FAmEVcusnv37vl/vjImNQWmcJZtPuqM/aGhVMbEV/I/t7ROvZmYcQ== X-Received: by 2002:a25:ca58:0:b0:d15:9cdc:5d0c with SMTP id a85-20020a25ca58000000b00d159cdc5d0cmr11907374ybg.42.1691449524354; Mon, 07 Aug 2023 16:05:24 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05: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)" Subject: [PATCH mm-unstable v9 03/31] mm: add utility functions for ptdesc Date: Mon, 7 Aug 2023 16:04:45 -0700 Message-Id: <20230807230513.102486-4-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4989940014 X-Rspam-User: X-Stat-Signature: s58869wiffy3fy6wh79m7sncmcq9seo5 X-Rspamd-Server: rspam03 X-HE-Tag: 1691449525-382133 X-HE-Meta: U2FsdGVkX1+kyWfdWEKe5R2Z610k2uk6w8qODR3QrNt9wl/51EHPRSDP+KdaoPApNawPWm5BLW64Eb+lAXBK5+aF1Dlo2RzKVWz1/9/e/0/7tTn+ehAYQLFwOmrgS9Gh8xJDh+JfMbSPCUt4XNMXszpwL7Rp8BK6gnwkw8TIK94MNXnOUNTX+/AmhpEFwnzhgVf+fBIpwRjfEkfphzYTU17zbzG96x4HaVevtqRRKkTROfFCNaMuEc7GANM5saAEjOaZBHzqpsmbFTE/RD9jMzUfXnMMQBaedxv6wS3JUnNMPTyUmngakSqFkEh1BRNEOOc1NXLaxVteCyq2fvPH9+2yVJQchuFlciJA3aaCUn2PRKnZ2g/LO0pyP8P1WqrNa3LR5Wf6Qz4I+b7iQC2Zq4m8T4Tgvhlo/n06lUGeZYpLVOklUqX/5MTx4NLey2x43LrbndifL/1VeLNdLvvWI5iaIoi5pEIzrw+wZWnk9hAgAkM7WkyAV3wFhbbRh6Ksq8V2sFo3N0bw3JyLXYpJDsTLGvyVjq51VH35XtLNU/ykB1lCkIglnpewZeGLjAaQjjGc2ZkpWEwJHK28nY8dFlcm/zTwesktBjx3G9eUnbcwlntRctrCK7Fj3rgze5TuoHxnpfITraQPWhlCSLpb+WpfuDUt/fDKW5ngUhwgsx5sRR8fTIctRev4METHTCer0M1/QN/CQ/xQpI12rQ2jcOvn4GJDMtkrrFwYpjQvX090p3CsgMEsRqs4dt3BRBsnZpKJItJyASfPIRAUIhF4bWVngfhFWvxOcQfV8S2bYjJ+OY8daa0edFYEwGIqAPTAGNCh3zdzP0QNPkxcoxapAaVYG7ftoKv0JAXQ8iQyEcL3/S25a4uxQrflDizpTKtrhmQgEY9QqonBbVUx7HduAZ2vjBp43+Yi8i6WQIXUz6nVQXv4Iku2WXWe8zfyjhFch/KzmoiEdL9N3RGSRCl 7J5w/Ajo xoGHLCXal2XPRQ4dDIz9z+lmrIWjZJHaMoR7ZhtHqvYjZgPXQH0LLHc/w2vj1l+lXYRbgbkpvs1ptUmDM4dmkqV2qMFj68xiSli20UfkbtG3TVOUELy+K27XDet6IgABjt2hbId0DY4frFEZWOt2/HPozvikRU0dNJ0ADbrGDDiw8nSP1/8SdCOPYK19LBW34/2/ZYiRtTmEQq0RlaToAcfWAMhVtOCUlfN7I1MRV+3WFt5D6s9j5n2qDeSznOsjw1EKCmQ0oJBLCYsU44RnZw441z1ZNgsCz8ZfdqNwbEV9sy8qJ3MXZsGhFZD2YbjK5uGsh1bt68YJI5W7EjHFvXH4DoSWTvM+YGfj6v603Vmyzl5beWic3n9t9dyW/UA98abLyKIwRV8E90ENBfelHaowAaJE4Q9+rhnESjX8ntDKmAs02pvynWEuxrw6/HVrxjJzkzkakJ5WcniZgNzQNAt5Z/OTuRRRWBEGHJ1s6Q7Z378clEuG1ZYxK0GDkL3k0hqFYzv9Ab6e8XqBM9XRX93JlCA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Introduce utility functions setting the foundation for ptdescs. These will also assist in the splitting out of ptdesc from struct page. Functions that focus on the descriptor are prefixed with ptdesc_* while functions that focus on the pagetable are prefixed with pagetable_*. pagetable_alloc() is defined to allocate new ptdesc pages as compound pages. This is to standardize ptdescs by allowing for one allocation and one free function, in contrast to 2 allocation and 2 free functions. Signed-off-by: Vishal Moola (Oracle) --- include/asm-generic/tlb.h | 11 +++++++ include/linux/mm.h | 61 +++++++++++++++++++++++++++++++++++++++ include/linux/mm_types.h | 12 ++++++++ 3 files changed, 84 insertions(+) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index bc32a2284c56..129a3a759976 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -480,6 +480,17 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) return tlb_remove_page_size(tlb, page, PAGE_SIZE); } +static inline void tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt) +{ + tlb_remove_table(tlb, pt); +} + +/* Like tlb_remove_ptdesc, but for page-like page directories. */ +static inline void tlb_remove_page_ptdesc(struct mmu_gather *tlb, struct ptdesc *pt) +{ + tlb_remove_page(tlb, ptdesc_page(pt)); +} + static inline void tlb_change_page_size(struct mmu_gather *tlb, unsigned int page_size) { diff --git a/include/linux/mm.h b/include/linux/mm.h index ec15ebc6def1..54dc176b90ea 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2806,6 +2806,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); @@ -2932,6 +2983,11 @@ static inline struct page *pmd_pgtable_page(pmd_t *pmd) return virt_to_page((void *)((unsigned long) pmd & mask)); } +static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) +{ + return page_ptdesc(pmd_pgtable_page(pmd)); +} + static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { return ptlock_ptr(pmd_pgtable_page(pmd)); @@ -3044,6 +3100,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/mm_types.h b/include/linux/mm_types.h index cb47438ae17f..ea34b22b4cbf 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -467,6 +467,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))) + /* * Used for sizing the vmemmap region on some architectures */ From patchwork Mon Aug 7 23:04:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345288 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 6F56AC001B0 for ; Mon, 7 Aug 2023 23:05:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BFE1940009; Mon, 7 Aug 2023 19:05:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 863B8940008; Mon, 7 Aug 2023 19:05:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72CD4940009; Mon, 7 Aug 2023 19:05:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5E661940008 for ; Mon, 7 Aug 2023 19:05:29 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 27888160BA1 for ; Mon, 7 Aug 2023 23:05:29 +0000 (UTC) X-FDA: 81098841978.11.FBBFF83 Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) by imf03.hostedemail.com (Postfix) with ESMTP id 65AA320002 for ; Mon, 7 Aug 2023 23:05:27 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=g0HQFm0I; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1691449527; 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=fEHGQmND3TVCalts2Xn8ptU7qEA2BpyVbaRRrUVwgj4=; b=2+yys0F3x0C95lYnMueocSl8UD5kTFt/6/nCtUaBs+CANSBJVlCchSQKwuOb1ECokCTqfI 1xX8NJPAp3pI3p1j08NOXxyVSrrE9H8ohX9QjzcFtvzFVkUqtfi79XkVPltdPBvdcBnmBz a3lDmJPxU1+5TBOtxBVR5MvdK8NSqW8= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=g0HQFm0I; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449527; a=rsa-sha256; cv=none; b=3NxDqxEGgOhVSdwnj0OR43vun5555qH6/0fCAWcCgkYW6ny/cZTSBKusqpU0WFLkHJPt2b p8+VAkhHTmzUu61Ur4YTZJ7ScztrMPiy5h7atHdLboBn/lonsNps7gyzViU8jfbyqG4KRW huPYCY8j5h+pMwIj5U5yndhkCcNd/Ps= Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-584388ec441so52570697b3.3 for ; Mon, 07 Aug 2023 16:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449526; x=1692054326; 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=fEHGQmND3TVCalts2Xn8ptU7qEA2BpyVbaRRrUVwgj4=; b=g0HQFm0Ih+ONj9bbGpN0SAoMFwZH1Hyy1LHhk9Yh2p6W+FyLdnCJ7RPABmEq6UvV+/ I0mwYg/T2n8LaliwXnPTiC9GBqIvZu49Qi1V/N0MmNRCKbxincxnUS9jodhc4yydOwRP aDjCJ2ni1nNWMxe4NQznDsxKIox8DPgLSsmzUNzOiHFpehQua0QatbJlVlVObrSVTwwk ZCujc6+dVnog1ei5Zro9QqEP+ju61k33bEcuj8U0Qr32h8YYXwWu+8Jh8gouVCHVOaNS iYc6V/t51fkGJ7ybJ/9xFdZCGVtXquz95wk1/VRVK/X9HGuHOqtxoDT8S6kl5FuAfQB5 VZ5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449526; x=1692054326; 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=fEHGQmND3TVCalts2Xn8ptU7qEA2BpyVbaRRrUVwgj4=; b=YJbjdqo0y2G8YgF2AUSMC/AAD094YsyyiTRvGz8wVYmqXTnSLQcmvhKFScQPhOjU3/ RExDhFKQvXlNhfRm4pAcnhiKXdMInUXErSouU8tdSVaRDqoauN1kYXlKdtqNDQRne/Oz 4Lm7wuKPJkDpIhGQWDrRfiVxybjTI4hkE2l5GoTCVNU0Qk36KN2PXlUk4LC3JwWq384b i3Hx+5jYOUbCi0cHZuf/hb5foIALvBJs3YNuSgRuu5NzeP0jDRPouj6Am66b31+VH25v 7BTk1N7Y/R1lIg9VlyM0FuCJeWvCzaL+Hut4o+nw9pRW2JCnFKtlApzvm+MThetngeIV NqsA== X-Gm-Message-State: AOJu0YzEkJYnVBhcElXUE8VGXpvC0CWNtljZKdU7IvsCrQ/2Sq/XT3xq uoJ7aUChhVfeNWUfYf2LM4k= X-Google-Smtp-Source: AGHT+IE5Cb4oRalCjMZQpBv2Qvb3EAIojgwuAgurnfPzGGotvhmzGY7E65P/TqlBpHFwkOco7I+V2Q== X-Received: by 2002:a25:d56:0:b0:c67:77be:9ad9 with SMTP id 83-20020a250d56000000b00c6777be9ad9mr8584839ybn.30.1691449526389; Mon, 07 Aug 2023 16:05:26 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:26 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v9 04/31] mm: Convert pmd_pgtable_page() callers to use pmd_ptdesc() Date: Mon, 7 Aug 2023 16:04:46 -0700 Message-Id: <20230807230513.102486-5-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 65AA320002 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: s1id1z8a877wx8xr5nhhi6di4c4uxzou X-HE-Tag: 1691449527-691393 X-HE-Meta: U2FsdGVkX191dbd4iamdqN/7RgCtKKJbn9BlnlhMGRTTzBPpxMEaT/A+u8brSS+EKBkHn0NwkSKT5owWoy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vM2uuYVadxgxpZx3VjsOQm33HneCUJb99OXHwUdDGivxKo3W5uqeRnWy1C7m6+cNxxKdcAlcS85npxP1dd1wD+tkTXhMYPnJxy1hNCM18B0I4Uv9YqTjKkxzco7A9KQjrFdrO6/MVDI5OkspSVHMdQ3FgbQHO/p+exSqnw8/nHM4j4EneiVG8jJbDlGxyQl0OFN5yo+qDiXtaEvmVf/Xo6QOkPaxWtfcp9yEfSGeJS0cfXMPZT4psnkQq3BG/9U6+M9OfHl48xoqaHNCLkA8U3TZbCd44NdbttYSAhjAVy+pDfg65mnmIG0zCLClKCpbF1IE1VExkESJkEZPUa3jeKpxZVOzBPFqPV5AN/5ZLQA8/ehu0UXLKaj9y1umUONdZCj3/QmeFIEFwRexkFnYC7aj3ipZgsc6e6nux7THutPIhS75qX/42A765zFzkxYhj6cvcAcdFy/kOqdylcDUc7R4tWtHUco5zXzhHAgkOl2eKpqI X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Converts internal pmd_pgtable_page() callers to use pmd_ptdesc(). This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 54dc176b90ea..f6d14a5fe747 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2990,7 +2990,7 @@ static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(pmd_pgtable_page(pmd)); + return ptlock_ptr(ptdesc_page(pmd_ptdesc(pmd))); } static inline bool pmd_ptlock_init(struct page *page) @@ -3009,7 +3009,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 Mon Aug 7 23:04:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345289 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 CF38FC04A94 for ; Mon, 7 Aug 2023 23:05:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C5EC94000A; Mon, 7 Aug 2023 19:05:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 97621940008; Mon, 7 Aug 2023 19:05:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 754C094000A; Mon, 7 Aug 2023 19:05:31 -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 67640940008 for ; Mon, 7 Aug 2023 19:05:31 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2DE8F401E2 for ; Mon, 7 Aug 2023 23:05:31 +0000 (UTC) X-FDA: 81098842062.16.6DCCBD5 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) by imf01.hostedemail.com (Postfix) with ESMTP id 5C3C14000D for ; Mon, 7 Aug 2023 23:05:29 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Q3CUliIC; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.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=1691449529; 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=xo55EeeiRtqMJzFppY7LfosEC+4EKSW+Y1wbH/R/zko=; b=RjmJfGXzP4ayf4or5yYGYG7RaOLJHjeEKGt1B+cKe4XOBq4TEz6EntzUvkhBwElo8O10FG bZHiAFV+hhgAZa1r3O/5qwhLs4j8vQ0jsnMg+/QazDncLF+rzSfP/i33p04400qUXeTi6L XbgygspyWNQXeORjiTPqcoWOnlq1iIs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449529; a=rsa-sha256; cv=none; b=xBNev30JqwqVTFys8ubyhpaectsTcHG0oWYL5SmOPjDd/Bkw8uW/BJwukMD7DkSZpBQMy0 aBrQ4zTsZSqmowvhZf4Dek9ndqMWahum32/X8TMJ0lVpCbYDk2uCboYtP/prf3pdwodGNN EYK746mLkRX96Lt7Dnr8cE+5hyDwBXs= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Q3CUliIC; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3a3efebcc24so3748053b6e.1 for ; Mon, 07 Aug 2023 16:05:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449528; x=1692054328; 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=xo55EeeiRtqMJzFppY7LfosEC+4EKSW+Y1wbH/R/zko=; b=Q3CUliICB5ucW5n1+cyfiOVvgvAwhYv3ZRrcZge/C2xN1y7mPAKTaAhnTC4tg457In GS5yV5pdx2fEbQ6Paw0G9gZpAwxLk7uLiA6v3+SIa2nM9cjP9BC4TMrWHjABBg1TkaAc jFqkxuJnd0T58a+3c4oi7Pn3k6jPqHaryISvoGLWFF1pysLGpyRN4pc1ANxWoEwI+30p K69XzaaIceuwI5auke9JvMGfHaTbti7Lrj0CNiE6K9RZ1Cm9I6s2gJdVHKhyUn9Bc8fw XFhL6ezBClgRYA33kHsXSFVngHlISmggGRScePESZQUU6OPVK5MugkAHJIXH8vtrGuLn AiPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449528; x=1692054328; 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=xo55EeeiRtqMJzFppY7LfosEC+4EKSW+Y1wbH/R/zko=; b=kxHNy/zdyX8+xKee7Tqh8erzwSxTytANdybQ6xDV0HUGrjxWC91CWY1PSr25Dny2UL jsXvc2BrihggHVW0uzuoB7bK4Ck/k0S7pWD+m2FHZK0KJgGXKcHlIoHWXAjh0C7pRGb5 7tXFyFG3iC5OPn5ynWbDim1xu6rXmRL/HuIyEVgfxg+nsRte37Bw8pDsm1OHchTLqlyi H7ulNu/Z7Ot7Rf7E8d2mbqNpnFEQnXcso3XoT6uhU25jh0O4ToZfSJCbVIgDuJQkiny8 plOPjQ38xcIU86JJEuqqaq3FkVNliJ1vMTNhWptIlCd02ShfC+M97kR1tXWvFP0ldrr3 wDyg== X-Gm-Message-State: AOJu0YwESIhrtX3E2fBh+NxFq7fGRCiy7EYmPh223J/oJLExR0ZaEuqe QpmDG9sUZQaFeC5HsRkT22c= X-Google-Smtp-Source: AGHT+IEuvpqTpP0gccwCdePAresyzfHn008a21Ty6dvsje55NxjSSMn6qMCPG3M+rc/X2+vc3Y/lYA== X-Received: by 2002:a54:4886:0:b0:3a7:238a:143e with SMTP id r6-20020a544886000000b003a7238a143emr10421463oic.2.1691449528538; Mon, 07 Aug 2023 16:05:28 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:28 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v9 05/31] mm: Convert ptlock_alloc() to use ptdescs Date: Mon, 7 Aug 2023 16:04:47 -0700 Message-Id: <20230807230513.102486-6-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: nzxwpe9rm3t8w8agng16zsuceoadfafg X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 5C3C14000D X-Rspam-User: X-HE-Tag: 1691449529-638473 X-HE-Meta: U2FsdGVkX1+4IN0L+9CFb7hTf9Mj1ymu1FYeTFGlApzgEdMOoNS+DFKpuUMuU8CgIR6Zb9pBDhl4k6FgCR05O4fZjGZ/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9CkNf+MN3/jX/ozOPsqpw8cZzNANxlj7DkCdSfRkXZ6i8kLrzsB1QnvXj9yR9f9Oj7NDatiHTF0LA4wZLDGT1IUCY1iZ3feFKjoWxcWph7k4Wn8jGUoPi8lnhWQQIa/7eqtRVyZtD/ZgKmlGLIwxv86t76c2kSr9L/KQRatLSZJ8v4Yrr+kpGHHtiuayBkcdztUtbP2BOqGPpwV/nwYbD2MrwhFOcltHWf3Lufflv8zuFmdAHUuMFo9/ox+j6Yg+7u1AKmTtVHTJrwTc+JdevYC9f40SiLXL2un492qJX3f9yHP6l1q/2q8NhRHd4M8G+XcXpE0Drax8UTxfM01IyNBzHG4/skJvioESRzIK5Ax+vPqOkwlSRScG4Svray5JbYAIEp4n2DtrAG6F+7GPNz9va/W4dJF0XC2z96j0kLZ0g+WFkXTNT9obWJEM56jv16YBWjX/RLKbkE 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 f6d14a5fe747..6aea8fb671f1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2860,7 +2860,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) @@ -2872,7 +2872,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; } @@ -2902,7 +2902,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 956aad8aff34..3606ef72ba70 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -6134,14 +6134,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 Mon Aug 7 23:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345290 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 19CB5C001DE for ; Mon, 7 Aug 2023 23:05:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A3A5094000B; Mon, 7 Aug 2023 19:05:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C466940008; Mon, 7 Aug 2023 19:05:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83EAC94000B; Mon, 7 Aug 2023 19:05:33 -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 5F484940008 for ; Mon, 7 Aug 2023 19:05:33 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 307B11206BB for ; Mon, 7 Aug 2023 23:05:33 +0000 (UTC) X-FDA: 81098842146.27.55ECAA0 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf04.hostedemail.com (Postfix) with ESMTP id 689B440008 for ; Mon, 7 Aug 2023 23:05:31 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="i3yG/elN"; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449531; 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=nhRFpHY9Gkw1pvDSPH6l3PWFnY0Equ+A7zpvUAn8VQI=; b=DFRaU9aQzvmqZ++HvixZpCsXoj9MN+jno/YPSEFYABUGY4YOjCKrSi4LqTqRbZ8atVbnMa tKEPH6dSi8pyA6ZyUctt+OYg8nefjhEXlFxURFe37nghjWI2sXPiKysNFl8bK6ln5SwUwM b9nDDEG0NElF9KaQM84s2oe5kH4vAIw= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="i3yG/elN"; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449531; a=rsa-sha256; cv=none; b=mszasKn57E6AMHjYMVNK9S8ul1NTfKbas7J4+3vJAU5jBEZe33/NMgcEaHa4dqJJfCxdjs 1fVWbHlS7deGhB7mi9YqM6pi/uays7v5oQSLLa/YYwVzlE9cB4Mc6bXGYIzS2XnWWyoUP4 NON+2KdGOBTK9UZ5rCdIL9aj5NR2nbE= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-d414540af6bso3652496276.2 for ; Mon, 07 Aug 2023 16:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449530; x=1692054330; 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=nhRFpHY9Gkw1pvDSPH6l3PWFnY0Equ+A7zpvUAn8VQI=; b=i3yG/elNSvAKIQpu+LnaQkf9aWr2RTSDWZ0bD6C1RLjObUv19W0XGp5nQ/WUHqv97k 3F3d9T+x+RGssi2D5sQsk0sbYNBszDeUty4Uz3WYnNNnOAOtum0uoqfNv64CjbJYI2vt 5W+yDKCq8CPlPCKNltLocOrpvWmx0Hi9m5r7qQtJGuYnsVLA+FFqMS9EVAuWM7bu2InG Y2OLsVw1zQ1ypzE/Wu4y0WN08yQxAbeMR9OdyOcp5d10YTszQgqk88e/T18v49VnUb5a Be+cx3DsqCXaxjSPwUg4xCjeVNpaDlwm4eDVW83zp+7fbc6H/u+IOUuZtg+F6GjbM9PA 0MXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449530; x=1692054330; 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=nhRFpHY9Gkw1pvDSPH6l3PWFnY0Equ+A7zpvUAn8VQI=; b=lRyD11l9zW8OK8lae0wgc81VTEQEwHzpF5p3ydeiinRZAUxZ1RGu5gy4+112U7eVPJ 9svL2oLwGjOGW6vrXx3L9hq6onsYGxcvWDkBVOlkR87Yrt/2FhoR8h31KeQnUlpxOoGz nDzB/bHc0uhKGDsQDaOD3NxBRLSurgWfI/vhRnkuuFLpKbGTLqvQ4Th9+Wr/YqXio/3G NxExpcxc8Im7eOqbdgNuan6ZfJuNOfknB2mkm0j5qY+gUVnyXGiXiGH7L2mx1WEKJ3Nk L0Hr+WFf/Nx0Y7rb4Vzyi8HtWjOcwZLenee4QkUaLLDi/740WQCBKYrQt5+sFs/xlk1N OueQ== X-Gm-Message-State: AOJu0YxnWfkcZxkItigLSycWpRo6C1k+c2C2xXYgmK3JVdjh71W0crMu gfUj3eIx+zBZ3TkeGcOMZ4s= X-Google-Smtp-Source: AGHT+IH0ZW2oaxdE5zMBv/D24ibnqwE3DqpI9lmZfRLWAk1KAOJsXcFTPw6pcD+tvJtRgJ78+52WaA== X-Received: by 2002:a25:fc3:0:b0:c21:4bc4:331d with SMTP id 186-20020a250fc3000000b00c214bc4331dmr6829336ybp.43.1691449530544; Mon, 07 Aug 2023 16:05:30 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05: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 mm-unstable v9 06/31] mm: Convert ptlock_ptr() to use ptdescs Date: Mon, 7 Aug 2023 16:04:48 -0700 Message-Id: <20230807230513.102486-7-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 689B440008 X-Rspam-User: X-Stat-Signature: q377wju375jscj6hk7hzdbyi8g88qrwm X-Rspamd-Server: rspam01 X-HE-Tag: 1691449531-476782 X-HE-Meta: U2FsdGVkX1+o4x7DNilqqoCXVsjww9E8+MQcuATamja6jGLrislhnDGMb4buLklNdB5I7xqekQhNdOde+z9cZjPOnt/sv3OXaV2jfvQDoMYjrnnq4F9B+XBHUYvRWHBrWjoWU0hFtT+pLwRoA/e+iOuw39dZTceMfa6zUuN5a22h41woN1MM4XIyyi1uyKW/G+M7uLjgp9qiz2kWUaF3XjqC3vqn+l/dZq6zUFQg5ZuJrNq3GeDnMfUnKpW3GNAhnX/lOXG2mfvi3pXdXY5yboj9xfYyJ90UpGeldcBnmvRY4CUu2Iizd44YPdAzuRPQy6fEer3Jnq4fyrwpUzqzSResj05N9eAOkLjgmmfyoiakj1zE/fcGu/4d3m5KkdE2IaqTqipDMUwOsspzLd9PV9hG1VbbQvOIPxmCJwrOzcPZ5uKriJC2D3vLmUuigcP89Vjq5Uq8cupBP1RV0qH+M4A9S/cHxXTdHxHiemU8UHvgq+U0zQWcqLaNgL8NX/6HJ9ek+YtscktOtOdGVq8pm1K/XR4qJCyCiSBNHftC77A+JVa0Sh2b5chpaHoaAhfyqYuJ6AQgAaGfk5+RKZ5yk5zvjYl4yY0BPWY/bRcifwHQwWAQynTi66WEGiNfmIH8vQtx4MYmES5j96W7R7lN8BJcxPYCiyj2b7PksY9D5v8b2yistx3x1x1TmFAsR6W160TsoS5cIeKXeSUduGN3xSOGKE9GbPf1bnnVQWxkj6Lhp7G7b1u0qbG3eTr6+znDDzoud8LvqRlkIkH8sALBMDlyf/n0CTo6j8hqOf09AcVYY+lRdyAQUAXcF1Qu8BnxOJqI967IgmzyGTwtcjU92hXIePLygurGRvtfy6lFQRP9PHrciJwuzjYscuaPKFYr3+yW/4ppjFgeaKnUzZKo2Ms12ADrOGzS1wmzSwtFPLWpr69ZYtuZ/ZRgrQP7uP4VMvEjrlBdKxhgfF87GYV lEjycWoo pqBTyYqYYi0gim2gIE5C9rFBVrPGBKdTemtJw77dqtwxxOLHX6DdQ5k/0p7ZZfyYhp6IpxJSUDvnOebNJmaQQwkWEZ7VHubc14o9PYlE3vCbBtLqPx1/UfXI7Tv4xjSqFGRtw8Jg+SF6BeWZhp7+JVGncmwKa7nXVVXRsxAD9GFy7z6v3GC6MxLA9A4nAEWL5l0j+HlVbc3aBmEPBKmz0Y4Q/RS+5VuPn7PxyXkaA3He541kNc/wee5HhKeaJTkKrzA43u0U2R/PX8064IIk7fK4y2147K/aTt8M9wwPpoPM/2J9ynKPRvfM0Y3Kr/E9QVS6In5OTOvkxEwEfwipmjZT8iaTZYOOsI889+XCjgyTVAIb23Rvb6qXR/uAj2hSKY5yCu0GP6pPyM+/s/HQKg0oTpyZgt5VTnvT7t4oEuo6HuoVXPuZ8/1ry5hsc1+ZUWM1nELD0vX7hXpKc9qPjHWYGihJ1XWv84mWlYHl/PIQLBFrrycORmEasd5l/ee0/MojFMEyE8SmG6ObPJJaAbXkNfqNPPnMaURxjTWh9GIj1S8kNLvOKDQUpsXJclRXPgy2r8pu32M5ybfF39uORmE/7ht7bjww93Uob6GBQnYBwfVP1Ru+mLPzXhNPa8q7XVB+i 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 6aea8fb671f1..bc82a64e5f01 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2863,9 +2863,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) @@ -2881,15 +2881,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) @@ -2904,7 +2904,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; } @@ -2990,7 +2990,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 Mon Aug 7 23:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345291 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 A1861C04FDF for ; Mon, 7 Aug 2023 23:05:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E31E694000C; Mon, 7 Aug 2023 19:05:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E0998940008; Mon, 7 Aug 2023 19:05:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5BB594000C; Mon, 7 Aug 2023 19:05: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 B79F7940008 for ; Mon, 7 Aug 2023 19:05:36 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8CF351A0BFE for ; Mon, 7 Aug 2023 23:05:36 +0000 (UTC) X-FDA: 81098842272.23.BEBF79A Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf23.hostedemail.com (Postfix) with ESMTP id 87F01140012 for ; Mon, 7 Aug 2023 23:05:33 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WW7U9RxJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.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=1691449533; 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=dV51lKtiOhMWQgAl7GNvRpOxJtkn3o5Ia4Rm5PKGOL0=; b=4DzgIhawf5kHfmcTRQGsi7XAO8PfF80qjMy9edtU0o0uO47F2vr1GV9Rlz1bNNO60OT85g 5mKa6QCS8bVEcfEDmXVC/uHhGNTtXDNUqIlkpZwmmIecHAc8KDw0ZgtmJ0cNHEI1nX14RN YG7QDX1CfT3qbWXrlijCIX18pWDOiHg= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WW7U9RxJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.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=1691449533; a=rsa-sha256; cv=none; b=6UpEaFqFTno3RzMx4ZD4ikOPuahsHlbKo9wYyg2S/nAX0J7Qy81lPr7dmoeato2SkgT5BG Yq/Cq/c20QbGrbRh3gmYA/zKQSBzL48u5urSPkJxxQCpahRDKKn7g6uIoQd5xykMeNZtkF 4pEZZYPNrd0ceTC2kRuS2ZOMoBOrrr8= Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-d3563cb41e9so4205372276.0 for ; Mon, 07 Aug 2023 16:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449532; x=1692054332; 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=dV51lKtiOhMWQgAl7GNvRpOxJtkn3o5Ia4Rm5PKGOL0=; b=WW7U9RxJoy+3YY4y3qa+Z9OsxlwmyOU3wMBaX5rDPLFmIEHt/X6v4NdYOpBq8PRkh5 HGAvbPPuVPcaXp+7bIkcS5zKLOts7aoRAq2rmpfhl809GhQ5Z7qhyD2D1O9jUw02JT8D ByQrQ+74LtD1rxejz5iV5Ji3t3biqjBaLILP+cGmcXMABNbKMRqAqcPv+Q5eVbDOwvco pnySxrcubM/hR4SWo6309aJr0ghUYXqxorm9LprpxBDG4pKG7rw8FnMSIxuCIl+L3G3f pQ7sJFVehZ1e4LudKLyLwUTD+K2Hcr+cYbBqgmDPIUau/hEmU0pgvAzvLPGNFfNzyEIP WwxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449532; x=1692054332; 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=dV51lKtiOhMWQgAl7GNvRpOxJtkn3o5Ia4Rm5PKGOL0=; b=evVtpxdAL1BHAqFJxMZeArqcu19zniwr8anhfoUUGxk2VuKQ20jRt/R6NZamEhWlYS 8Ak3aE8qyRjwKsyz2G2U3XAB9v8Fk1o1qRoHoKX25CinYYNtKPZDQfH4WYyb0CvfJgsV mNu7qJwRGr2g7ZcK/10tOgwy6fHrzJZ8cacL1armXtjhRiTjc14WD/RwglIFjw7NObFE 61Bwb1fOYrq8tYLYSjzbOzKd/0YLEI8pkHEfxYxWFeoUEC05oEM36Bjw6o365NqDthoj 8PfNTfTD9x5cQx+dYTpKdyk2xhHorYScIaghug9CpCoNtxYkQLsuyfDLs/qRjh+vkbP8 zwRg== X-Gm-Message-State: AOJu0YyWcndvUSLt6lKQf4DuEi8BkePl+QwIeSMQh9Lg76TuUSEQtAuQ EMySCCSXc3tYitV2I1AhCpA= X-Google-Smtp-Source: AGHT+IEvrDCY+UE05HZYU4gf4n6Ovk9myxbAlbrTcNmkwiJKi0vLSKG9giGoSfLWvI4ILhQ42gUDlQ== X-Received: by 2002:a25:bd7:0:b0:d14:6e28:69a4 with SMTP id 206-20020a250bd7000000b00d146e2869a4mr9317696ybl.29.1691449532541; Mon, 07 Aug 2023 16:05:32 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:32 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v9 07/31] mm: Convert pmd_ptlock_init() to use ptdescs Date: Mon, 7 Aug 2023 16:04:49 -0700 Message-Id: <20230807230513.102486-8-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 87F01140012 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: wqsfchbdgmfc5q1arm946zhdxi988gtk X-HE-Tag: 1691449533-300260 X-HE-Meta: U2FsdGVkX19ASHm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TTLUo41Ai0zIpHmBqCjf47rTvbvWfIkzPAlLMk8L3edatBmVMnX2gqmy9lIplGdUjVtme3uS4mc13mo5GBpeONefaGW1L5cA8lFXaKoYx/WwwyikMoKYq7Vtdg3H91iXsjpGkghz3syqEtB/QDiM5dUhvV203B6do5vpTmmyVh6160ilA3nKeO7U2HIpL6TmmcDevsG3CUgF0SR829erSJ2JazfNNIY5h0Pghw+MBwfMxH2hFmNAbvkgSIp+nPfS8yyU0QDZaMU88wYnR46/33sRFhRQ9r8GXfiKLCtuodBhgTX9xHhBhyqP4v+39eHYsmlnWYaS1OecJnbRS7J9MP7c0CC/fjWBAR2rhOtiKbfQ6wqQ4C1kok37Q+I7F1usl9CqwSPzSt6PYxDIDruVFvAmXG1oL3hfDwJNKRPyzSQJA1TmBl8yWJ8LUI9EbHxxOEF0v5BYsGMlBbe6uVA5eVOKsHRnfi8vw0xhso3en+YbuFbEBn2aWbJhp5FfZaeSA3W5c1OEwaZZXcZXsDaEiTa9ovsMKnUIXuD4= 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 bc82a64e5f01..040982fe9063 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2993,12 +2993,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) @@ -3018,7 +3018,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) @@ -3034,7 +3034,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 Mon Aug 7 23:04:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345292 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 67317C04FE0 for ; Mon, 7 Aug 2023 23:05:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C105F94000D; Mon, 7 Aug 2023 19:05:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B4CD2940008; Mon, 7 Aug 2023 19:05:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94DD994000D; Mon, 7 Aug 2023 19:05:37 -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 877A7940008 for ; Mon, 7 Aug 2023 19:05:37 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 671AEA0BC6 for ; Mon, 7 Aug 2023 23:05:37 +0000 (UTC) X-FDA: 81098842314.13.5092C3E Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf16.hostedemail.com (Postfix) with ESMTP id 80CC7180004 for ; Mon, 7 Aug 2023 23:05:35 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=doFuHRFv; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449535; 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=qSt61pcnVgNBhKAHMe8eO3a6G9ChrNL9Px0NKJkznSI=; b=GjYumpcdvJtye0uwqvv/vikJv3VNqbyPZLU+MRI4R0g43v4ODR/21d5smrdQg2qKhtL7DA guapSCQ2UKV75IK0MXzc6xihSmI2vIpZArlkbyt563ETBmYDw42zb4xqoQ0D3veB7Rjz0L lbuyjyt31nrJ21le2LxPzUoC8W6yKDU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449535; a=rsa-sha256; cv=none; b=E30RQEOlsEt30zmOoOowdTk0g4E4fSh7W+JOw1ZPVhQq2IHQXS7npZdvVTtiXBLZYGhhdO Xw2qNctXcrTO1kpem9eiubH+VlnyGU5TWF1RUmtwECDXnqMqvy2PDj5Bt/5Zzs3ChHHdYr Z5Uu29J1wp64zuWb1/R9oiNBHZFQTZk= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=doFuHRFv; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-d58b8d00d74so641559276.3 for ; Mon, 07 Aug 2023 16:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449534; x=1692054334; 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=qSt61pcnVgNBhKAHMe8eO3a6G9ChrNL9Px0NKJkznSI=; b=doFuHRFvbyMJN61tPnMQYXox+6stb50QdP4/3C93sFPuLhCWwxu1z+tfNZJ4b6Wpl+ E3E2D7c/fVsu9NK1PuuCIKOAph+/dD0UwiupTdpLzihtqamhwaXNn1+eSFxg36XE1nAW 9YCYbT+6Netay+dE7igP1FbsCv8QYjddLC3kVasHRyFjUe3vhlHJ5pPzAaFOmunT+EhT TypcY3libiW+1xTSZsvLq3CfCOXA2FWQUiU+MigDUHm3gt0TV6nV3mcKzhVGZgr0Qhni PeipZMs+ho2QZuOrtBA9RQFaTSU/S0o5wnK6eQ2hY8zhXlVshk/VfS/NqhE6JdbcRNTR jImw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449534; x=1692054334; 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=qSt61pcnVgNBhKAHMe8eO3a6G9ChrNL9Px0NKJkznSI=; b=P5VIzmQ0LrV8VdeWYySrcBmKSTZGufenI2vT3JipbwpEJaEZZFlvdw8BZwaAQjHJcz Pb0QGOi7YjZCrurVeAlT9xc72ERkrHxypT7HiR4mT3P0otk2/QTZ6ce9lucjG6o31lYl 6dR+M1h7h3sVDHR1YFDbgE+v07aPeG7l50rG75mlmJxQwkVrYvhxiN2DYJ2dDpZFwG8V C1B3n6ZZ5xLQyZM84VfnIYXBC4GtIUW9xVZTHZ9OIaez6JFNhKSPYGEyv4568afae/jk Rbzoh0EgblBlUDTLKHgEmMn2aZ6luMhy6wsv2+MaaXPb+mtYogGmfG3dTHtFlDl0h4/x WVHw== X-Gm-Message-State: AOJu0YzFJN1XquBuM8pRfdhL2T38DSSpPnYYY4KBD49+Fns5bHiXrh1q nSRBWH6pGzZccsgZYXyuGUk= X-Google-Smtp-Source: AGHT+IH78clSYv8jjRwrTCz7hdEyV6ONxxFaBIBEI75jS+XpTOJin8WaSgmj5CyKgW8Moog6FuLvdA== X-Received: by 2002:a25:4c86:0:b0:d0a:d15b:3b0f with SMTP id z128-20020a254c86000000b00d0ad15b3b0fmr10002278yba.33.1691449534448; Mon, 07 Aug 2023 16:05:34 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05: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)" , Mike Rapoport Subject: [PATCH mm-unstable v9 08/31] mm: Convert ptlock_init() to use ptdescs Date: Mon, 7 Aug 2023 16:04:50 -0700 Message-Id: <20230807230513.102486-9-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 80CC7180004 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: euxnbquqa74qz5nuqok8b95exzu1bx9j X-HE-Tag: 1691449535-901458 X-HE-Meta: U2FsdGVkX18oOHY6trCLvNPnX5VujFoxCSAdG4kJihIr42OwHfetfSeFYsfRXKHOoYR6FJzwxQhktGYrcJsgoWls50RQ4UGpQpKUXnxoEGwwYOdHjl0VhDbe6wvh1Al7VRa64UrXGEJ/LhYWS5QToQV8xyitOZSoI2LzUfBI/ddSruqGEbHdYEcLtcI3IqJN4KGp6iC3QXu0SNiR7VOkfBO7nFc+G72Lt5nolSUfjxLGQL3TiBrjvUCA6vZryz/Zly0IYtaSPA521FXRyDkIKG769Tfy7LFA2e0IQIIXYUuqu5wnZVrV9w8wfPoVr42nB32bDtRCeH0orLD7JxDnTOByZmTrcLY26ZP5BNbw0Ov12b2Y2jhfxEc86K8LB0RIKyZ7LeigmTBalGczjGXq/kar/MqS5jvhaBknNvZlv1Pmwj/RixPYsRN1baS9ZTsnN0i3mfCMFbFRA5Q37mgMjP8+WvTB+DWUiUfvlK0epQ9Weeb+baARWwj96D2nHcU56u365WO3DkB6ml3rdBncQ5aGBtrdK/FHFLZRN3OlSm4x64C35xyVuLnHxP7AXQqbcdPEB1+6i/zQjhqcnimTGicywh8wqcLRthlme2VFyPS4cyOPhOBbJ3mRtYNbsCgmCvszrYJIbHCxxQngP5MdgHmQ84zuyQ57LkV0X7CcC+Ba5b+LNEo3/HeJhrMA+X4AIqdu6rcs3X9i8pqRUZmpxk8Jr9dHWr7sREZtsZvTG6OQLUG5Ai2BYxuRHSRVjXN5JZxvEw2Bk+xoWUaBrWkZrw3Wr8hQqOQxEhWGtqFX8bmZ4sz3AMZfu/BpPOtawgrGU6EV74FrA1AO5wAWpiHT2zcTgim0D2Lpr6FDA2dpdGqc0MVSO/tCg+QSWIIGRddYlkjaefZBpNbcUxtgSxONCE5oNmYF0kHhRE9DiZUlyx68+F3P2vPMU5b1k1FfNOKSQbUglSdXQf2NX0YIbfp K7pQ4mLq 9cHTc5TSu1VxM4MrUQgBT4CXumUdgJnSipJdofWjDBbxYHNfnoCap6slJzLF40PfgLbcbdiXx0jNzMw5aDpjrTNX6ljLDFnqirHmo2EjHSV5CE+avpVft4HV1Hwlfrbh2Lld+uJL6eo4tshY8NViXXe1zrIhvs/t5kt8p0qH1EwlT++6/ehN/UhEyOJFWhvgk2vyJ0ZOt3RAqdIhZqzQF1CybU0Cz+UK2D9BXTfcciFBcJOG+PHSUfd+ixk1sg3dIpyLHigDFZd8ZeNHjADlQVCd0NMTqsBVygDNjBqNOju2q/AFKWtOiPraIHqLf2+fdoCPja53wdxi5FTmwh5MQH44B9L9w1LjTkAJMbKIZbPuo23Pt2bXYz+5OA/JXVu9X4ENWdqOS4g6XJ5bLgqlvMrXy+cbDlmfOnJv978V5XEDIQuZkCcnGHk0x/BGbYK6Uc5p88kqNUvMkXbADDIrPSGSNq3mbB25+ybBthMdySVhvWb/LxI6UKgHUzbsYAjGTykM5kufv/xH47j+1vvnOXGiFxzs0Gz32lbJRti+DTtzrNbCZMaWlXM5TzoumHmI6yAI9CNGNaBbphbQf3jMxfNTF2GEPlD3+6hMXCADyrraNRI7FZefjWm9sZ2GfkPFLId9bNIzdaIJwxn4= 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 040982fe9063..13947b17f25e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2892,7 +2892,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) @@ -2901,10 +2901,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; } @@ -2917,13 +2917,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); @@ -2998,7 +2998,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 Mon Aug 7 23:04:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345293 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 8D3D6C001DF for ; Mon, 7 Aug 2023 23:05:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8DEDF94000E; Mon, 7 Aug 2023 19:05:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 83D04940008; Mon, 7 Aug 2023 19:05:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6DD9894000E; Mon, 7 Aug 2023 19:05:39 -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 5FE15940008 for ; Mon, 7 Aug 2023 19:05:39 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3D3EEB13B6 for ; Mon, 7 Aug 2023 23:05:39 +0000 (UTC) X-FDA: 81098842398.11.7266C44 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf06.hostedemail.com (Postfix) with ESMTP id 6982418001A for ; Mon, 7 Aug 2023 23:05:37 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="ipvaU8x/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.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=1691449537; 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=dL6AQetgHURU9peF5jMm+1QPkGPdtGd2X/zb9xq5Tzw=; b=BDMZtOl+E/XZnYRM/Fon+DXZA0z4w5BGMs5vmAHd7/cgUjaAtb/gMxzfXeRnoUG4T/ljgi ESzaCw3VLKymuvlh8KJoEc5agh2J0Mkoew5DI8FKasRu+qkspRW6ZcrixJbmIXJtkRcSuK pejNvAUGaA8gN0gRbRQYbN8zFJVBcyI= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="ipvaU8x/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.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=1691449537; a=rsa-sha256; cv=none; b=H6UqJG2fnHL7o4o3sXcWW/r1CdlmAGvuxLOZ7ZWcbUdwkE0pudxoeHpRsRE65f32CvcJM5 xEe0RpT/R5Ujo6azt8hUeTCdJ0rDbeD7dPnvK3qi/0lKzc/4nmxFMrsQzal1MBEozVZopk qUecxj1YImeIMmnDlmdscGNEUQtIhmw= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-d593a63e249so512248276.3 for ; Mon, 07 Aug 2023 16:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449536; x=1692054336; 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=dL6AQetgHURU9peF5jMm+1QPkGPdtGd2X/zb9xq5Tzw=; b=ipvaU8x/4/BvbPbL1JSP5UKyrvOXFJin5b02qnpk0+g2WqZ4eJ+PO+ktIgA+6wNoSm aaVqpEKee+fuDlQKCW2FfgF7SgMBsBqJt3e1nMH+AXWpM2n5M5vJ6ySCVS0SQ6gxdoiI D+Vz3KZ0hmlesWiSA/IngK6t1yMsQcmq6H5TLlpCkzZtF+sAfosr9KpkynHtpBKwq7VS GLoFH093mbAem14YxFU+jWVsiLanVvmYVX25waYX2eZafZZIUXESTosUd2Oq+mhwT6KE DFWO6vdcB84fh2CYUtre/BRV5qGnoLxfl2hREphZC8Q8m4iPBusEVSAtzxRpIAKFC+MO xrMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449536; x=1692054336; 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=dL6AQetgHURU9peF5jMm+1QPkGPdtGd2X/zb9xq5Tzw=; b=QOlm7sWgTNWo9icXfdK7EjHv+zVMyc1g1CPI1kI3Nnf/+3k9iZoXmCCs52kdRUlzFv jxT1dbT5Y9/9A/6mrgIQuaqDjZ7UMoiJlkkx9GQ2HNntwgK9RL+oSBPDxHNuVLGh9yNG WQqNgXAq1VysI939NmJnx3NPhtt7Fr/ZhqPQBsWp6pfvkWakoPIBL3zhz6WB9dyy1Qhq caGGy9qA8MHWBGrsLhz5Gl31FtL9sI7T3eupi5Avh84BeRZMzG8iPDrfuFXp9aBXd76y aigUJPyULMBpbQZo7VSGebXcAUeTvm5HIdjNpREd40w/ysI+j9lfFaxcdv3ucd5uMf8h YnEQ== X-Gm-Message-State: AOJu0YztVwPLBzAPhgfp93+mGl/UZQKrOtOn6a4JeMLRDylB6lkDkxH8 k4HS5urJgx+Ga/2HBJYLT5w= X-Google-Smtp-Source: AGHT+IEvxj9+7jMT4q6zEzLr5Igqcb/a7jma6HML30e7U0QAJ8Bd3AhAgHjN0UpvuwRaK7JUtc9G0w== X-Received: by 2002:a25:738b:0:b0:d09:7f94:6ea3 with SMTP id o133-20020a25738b000000b00d097f946ea3mr11456718ybc.65.1691449536455; Mon, 07 Aug 2023 16:05:36 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05: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)" , Mike Rapoport Subject: [PATCH mm-unstable v9 09/31] mm: Convert pmd_ptlock_free() to use ptdescs Date: Mon, 7 Aug 2023 16:04:51 -0700 Message-Id: <20230807230513.102486-10-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 6982418001A X-Stat-Signature: gce1owcenttxmtader76y7hqbfw6k536 X-Rspam-User: X-HE-Tag: 1691449537-188580 X-HE-Meta: U2FsdGVkX1+mKfiEFOG9LiBacpPi45y1GrsqnwmFknV4LWLa039XndQyz3p39jEMAmn7ysk1C10/uB4cP1t948fZu7GABBppoqoinKWSOySnH7KtUcxuGCguIPeNhYDkI2ztyeZwgepXz1UDFBEL4UGHrUQD3rr5vJE99nwhwIgONqf8/3kj/DKTwnAkCU7sNwp3EQ2jWYtlJBtLl2pe6exm4ZcLXFmDBS21iOq+OhCT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A214PMJWh/N0Hcje1If0G+1JP2c9hyHq/cq+4hbSnfRjHKrKnGuW7kHxz3PUbuRjt7Q/HnvfFiMuI5SwtW4NCiTdqud1kiK9u6GBHDi2ljs9FoLLFboq+EF7bgLGxGwxGRaRMJbNzCI+Lo+W/lN6o2U4CZfIMRMdetwBIboyRestdyGz4jeOjhOonGno7H5ZpudpCczMY01lYBcTMaf1WPED6oCxhmbs4tzPCLU0mPgF9nMoI0T22QSrJos0nVEAcGNJ6NnP5rvV0PThXJT6dtvbSxJuWqcKozqvvpanTJhzjvc7r3ZMLPqJcMYfrKBTQuva4NlWBuZpSxn9KyWk= 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 13947b17f25e..aa6f77c71453 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3001,12 +3001,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) @@ -3019,7 +3019,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) @@ -3043,7 +3043,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 Mon Aug 7 23:04:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345294 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 CE27BC001DE for ; Mon, 7 Aug 2023 23:05:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F2AD94000F; Mon, 7 Aug 2023 19:05:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 752EF940008; Mon, 7 Aug 2023 19:05:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CDBA94000F; Mon, 7 Aug 2023 19:05:41 -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 4EB66940008 for ; Mon, 7 Aug 2023 19:05:41 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1B7B31607A0 for ; Mon, 7 Aug 2023 23:05:41 +0000 (UTC) X-FDA: 81098842482.21.24FE5E4 Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) by imf22.hostedemail.com (Postfix) with ESMTP id 53C13C0005 for ; Mon, 7 Aug 2023 23:05:39 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Xru6G6ui; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.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=1691449539; 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=rO3hRWVBo6Y9vRkkphMYimV7kP+YdlMpTAZzrYQT330=; b=EtJPqFQpuVtZpeNIf2fLGY7rClKMWagWdl1oca+7LHQdEJBwZgXs5sKFze3YsOWsyHRlhz u1xFj+BpyqcET5M+zSDGqEk0AHnVnbJn2icbVHli/WdjIEQxXsF41pDvedJkcfYIY7juwW tfJv/UVl0bo8/p1JIAaT6QGDG9nOplU= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Xru6G6ui; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.179 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=1691449539; a=rsa-sha256; cv=none; b=PWtsUeIYjeSIuq6y7o9/6nJpur/oZavXQx0Lrczbe7svvKYHTun/LFmW5WGdFL0menAmG8 nMsrPu7DyfK5MW0n7LvynS54LyykV65gb8PjYJXvTI5JyHwL6vTY0qWbEixXYJ35JyuFj2 NqDMT3fd/fCn90Zf8JVN5iD7PD6PQJ4= Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-d2b8437d825so5087528276.3 for ; Mon, 07 Aug 2023 16:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449538; x=1692054338; 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=rO3hRWVBo6Y9vRkkphMYimV7kP+YdlMpTAZzrYQT330=; b=Xru6G6uiZe/OuMY5nm6nRGhKKZT+cMjFr3ywYmjJVtK6bJQBvGQe4lb67TeNeIpRR1 vU6ROYd5sljoul9DQ182dcYNUtIjSE0g9ryH9BBQnyweF2i9F3a0tNr39lnubSpEzEzx D9dlEQ3L7Z6V9tMyRKOuG3jp1VK2LuxNqNXMsa/r8JF3v1c5M1/VvDBiBALX9JEbGcjF BYD5zunEjYtVpsA/+5S4bzMaVg5Xls19tVXYJS5Y3GWWrR9cQxHo66Iare/M20jic/7P QScGaLnDnqCa6oKmv6Q3fNTRqyTkrnI7S8dkrsktkT3ibHnZIlamT/1RRAzAV+HV4mnX P1Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449538; x=1692054338; 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=rO3hRWVBo6Y9vRkkphMYimV7kP+YdlMpTAZzrYQT330=; b=DwQ8+3ZpVHetdtme/6vq9mLBb2PAMA8OZf1qO8CDPA9uleVTkQqY5EXrGGnBbbi7wx 9VD7ucwhxuX/EDXCu7qz7oxYiP7fBscRixWFvzue4E4a6zvC2zap44H6Y7LUzfI/bXhL ZbGqvqafwD1Ovqkbj6aED+W+/QocyP+iaC4rROlV8TroXkXeYLYomhwZgEM7cmtOBglh 4rPb4NNGztTNRWsrknKVx0+aTlnzeRKLmgBp4cbFTRGY0JAwijzzU0HGAJeRx8k71vyo vNJqLQQSH1s5nQAGE3LHf+O3tcVhHEuFVK3SSL99ZkE3e9QFHuMgaqeBC05fslXkmRmm mDSA== X-Gm-Message-State: AOJu0Yx2b6MurRYPGNDYXqUHWvkR8RyKkgixCsSQRUTLZUrKqp3CDNyh WwLf9UXjNRDw5pGAkI3m0P4= X-Google-Smtp-Source: AGHT+IFQ1sRvJZAfCY+VUYCk9fa9DxUgaBX+22XersqRcqzji4wcHGi6IN2gPixXkKaq4oGn1g4mnw== X-Received: by 2002:a25:8001:0:b0:d0f:ea4b:1dff with SMTP id m1-20020a258001000000b00d0fea4b1dffmr9335056ybk.8.1691449538435; Mon, 07 Aug 2023 16:05:38 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:38 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v9 10/31] mm: Convert ptlock_free() to use ptdescs Date: Mon, 7 Aug 2023 16:04:52 -0700 Message-Id: <20230807230513.102486-11-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 53C13C0005 X-Rspam-User: X-Stat-Signature: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ZuIO90AAWjs6GEfBoQKJGdQAMvgOkFnuRgVDVxlFO5I3O8OE+4OBy8jqg0ElzaUmT7v0GSEw6OFL3D2XTJj7KtTwl8EZuZpwZ8h4VP1l/YcFLm/oTtMwnJb16SayFKEYqpSx8naZeLHM5WXjoMf9q2EzgAtymHD22nCMzmCzo2kXl31pXDMvz2lo0dJofjp2FYlRj+g5WiPESk4NV8AU5PLFtUCSOYi7n9f/OJhxWbWXNvQWcN6hqEtsFQvd0blPaKp4uZrawuDpWR971cNfpXSTSHuwsTNGzuMMIZOG6mpn96fWq2ri72A6K6tIxTXjR3EAnqFbgR38H3NUrqobNcXzx5oJwcXQej+D419jTgYNN9Mgzk1spI+0VQK3+oSWUiS06J+9ZDyYPY6VPEMJxD7pNPM10wzVivIzEXLBkJNfX0botHjZaa9GLiko98xoiqp4TaE7k8i1sT5j5VuAO+gyB8vHR+60Go652LZJNhaqXLA9LiZizuHz8LPYDzKlqUqpp0uBu1kEMswQm7m9iIz6yRaOWSZ8HuSddOa6G5EN4e6ijA18YY2R6H6qNaDS2Iu39ig7Vrgq+VKMqo2atn/HILvfpFwSvY9jsMbrAIOuBPmS9zZLSxN0cL8W 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 aa6f77c71453..94984d49ab01 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2861,7 +2861,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) { @@ -2877,7 +2877,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) { } @@ -2918,7 +2918,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) @@ -2932,7 +2932,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); } @@ -3006,7 +3006,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 3606ef72ba70..d003076b218d 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -6145,8 +6145,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 Mon Aug 7 23:04:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345295 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 1AD0DC04E69 for ; Mon, 7 Aug 2023 23:05:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8DA86940010; Mon, 7 Aug 2023 19:05:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88AEB940008; Mon, 7 Aug 2023 19:05:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72C80940010; Mon, 7 Aug 2023 19:05:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5B608940008 for ; Mon, 7 Aug 2023 19:05:43 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2BF5D1A0B86 for ; Mon, 7 Aug 2023 23:05:43 +0000 (UTC) X-FDA: 81098842566.04.FCA0C1D Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) by imf06.hostedemail.com (Postfix) with ESMTP id 59EC418000D for ; Mon, 7 Aug 2023 23:05:41 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=aasPlAtm; 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; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449541; a=rsa-sha256; cv=none; b=hvKN7yGGZHnwUlBGKkwDbDRxSDape83yORcwMiu8FmaFXqqphUm/eUmwTfFq8LFw3WyBk/ Ovc6bglCU3OiZSonpnpa4XvB9x6M/noq4wYaYlJx9VXohXiVS2yERnMvxPaqBXj8tY+XC4 vkE9BHFMI/SXbVOY1zkXopO5zzZrVkw= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=aasPlAtm; 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; 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=1691449541; 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=XBjJ/e2vPX4j94DTkAO9XQqqbwuOMqryYrtpznFEgGY=; b=Ndg5yNtRpxWslUGJ6KE/kHdtLUJi4XJ/Yp5jAj7hJ5jbnA6Zc7n7AqGHwpZiXY0MsdfK+q lGrlnsOo6fC+om5R2nEixBoRUJzzhANWDCDoDIP2gNdUesJPCHvvQsfvuRCow83Q0SwSjW btIAE1qdDHT44DPajYgSwOEk9c59fX0= Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-d16889b3e93so5396147276.0 for ; Mon, 07 Aug 2023 16:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449540; x=1692054340; 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=XBjJ/e2vPX4j94DTkAO9XQqqbwuOMqryYrtpznFEgGY=; b=aasPlAtm5Pcd0yp6duryP473IaipZJS0bWZ4Z8XEGwFlj43AOqpIIC6FhirKlPve9C F1vUSIrLW1oYFLLrLilYCJzqaLsw1rmRGBb+Z5eKzeBY0HVz8f1HGASCxMQ2qqkeDt1/ NUUsoQwBHF6NBLlkSQcHcy9LC4jgcOdJmOlAy/6h3iyfEMCFdLo7Fk1Bu4KWGLpiNsE1 KzSFxNl6DRl46MY838sL7FF+wIJkc1YVhg5kJdFIQoWHplt5NksftMQPYk7wCakllMw/ EceX3OKTdEGMJ4GdFrkX3TffvwqD7i/AFN0kCIklmMB/JORnudk4URx0r/bcoO+F1Yl1 rD5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449540; x=1692054340; 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=XBjJ/e2vPX4j94DTkAO9XQqqbwuOMqryYrtpznFEgGY=; b=Y/i3G38F8SwrX9LE8E95dYJ1bujcbMj4Mt/Mg91XSmAhiYQTSIG4soL6QX8zYgs6oN Td3G0eO2FUMTD/h7NxsXWbsJppPZWrt0dtZt6u982FavR37QknZZtumpoDqki2Yaor7v SNFnFDQK6Lq7k2VTd2p+pejEqWYupo6cd2L9GS5IxFmF0adPmodnFZ4bRdQ/dDQRvxT2 bVwXZdytC6U0r8A8kUF1IRLxElyTJ+nNOgisc9Nm770MzrU/t8E9mqFvsIIEOiHggEVD qaH42y0sJGPuSf7W85Mh2rvdhqsTC1yolxTxq3uh9Eew75cNdIXH+HMMCdQkr3odlmrA YpDA== X-Gm-Message-State: AOJu0YwmNeBFexl2jC7f1USXR87pJZDvYgm5+q8xA9RTr8yeAeo0A7Vp wz7omVpfp8H8WxfKhNop2gk= X-Google-Smtp-Source: AGHT+IEw8LfaxYvauKrU5QG8lz4qzDMmMrsNvSvomqfZDfXz4mmURgWJbxHCG9LEh9h57v96do4e4w== X-Received: by 2002:a25:8251:0:b0:cb9:41ad:8938 with SMTP id d17-20020a258251000000b00cb941ad8938mr12329076ybn.3.1691449540449; Mon, 07 Aug 2023 16:05:40 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:40 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v9 11/31] mm: Create ptdesc equivalents for pgtable_{pte,pmd}_page_{ctor,dtor} Date: Mon, 7 Aug 2023 16:04:53 -0700 Message-Id: <20230807230513.102486-12-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 59EC418000D X-Stat-Signature: stmu7dnixeexppfodcayoqpmbjc5mn4e X-Rspam-User: X-HE-Tag: 1691449541-823136 X-HE-Meta: U2FsdGVkX1/eJrY29opr1RjTXv7PSchb0tp4X8QCiSq6g8c1+0mfGtq/1dpNSAjmS2fmiLuxm3uOJylGkCqFY4glJGRBmO38QJRthoy9sCw8P4jSHbl8i58SkWwmlDvasAVXFa8uKamtDinJMmCJfsVDjyIk0UWYrMI1qhoyWV6l3+zTolSnw1s3RKSDsk2CCduROggARWRhEZlPApFfkKlpMlLy7HJP8xyYwIN2w5m2m6MAFsSha0QFrAFXm26t5PIzHs1lqxZ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WbmIwxdSQVnZ7VNuX2uRgnihxa7JOScP0o9urGqDYYB+oStggHndH04tCIVhr4/NDLXoPCATYHXAGTb9OL/kCGbKDv7m9JA4rTftTwqN/9GAwJ2NHQ6a4lUOSsg/IyYYzD+jGMNEnK7dnodMbw2Qump1cOWbKIieHlMPzVCKSYWaGRfeJBQ3KiIc6zHptI0c1srRX/foDQ/ixbD5dl1khJ4VZf7c8aQfNumyukgBI2uvKaixGU2N1omuIYlPx/T1EQ9jwZzyrsWABfOZaBGD/r45faus= 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 94984d49ab01..6310e0c59efe 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2921,20 +2921,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); @@ -3032,20 +3046,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 Mon Aug 7 23:04:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345296 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 B1C5BC001DE for ; Mon, 7 Aug 2023 23:05:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A60C9940011; Mon, 7 Aug 2023 19:05:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A11B1940008; Mon, 7 Aug 2023 19:05:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83C6D940011; Mon, 7 Aug 2023 19:05:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 766F6940008 for ; Mon, 7 Aug 2023 19:05:45 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5288CB2231 for ; Mon, 7 Aug 2023 23:05:45 +0000 (UTC) X-FDA: 81098842650.06.6AEAA6D Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by imf12.hostedemail.com (Postfix) with ESMTP id 7ED8B40003 for ; Mon, 7 Aug 2023 23:05:43 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=rLWnqjmP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449543; 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=e+EvCLSRHEjRMcrqyzlI7nWwK61/1iPQ6CBOQpr2Pw8=; b=nPekws2BNP/+GHfrDKYlDhvCH3kC3KG3ff8OOHdc3LGNx6/PHUMAWCH2fR159JbH/hhq2W PRRLhYkOMGYDGqQG24kj9+UmO/0Lvgsc9UiFTNivi5pqQzHnGgMO0tvDVE7X9WhKNMnOkt psS7FYLlY2Bbg9yYo7ca/RyqrM0ovoA= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=rLWnqjmP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449543; a=rsa-sha256; cv=none; b=sJbJahbWHI+vf+m5L3JiM7b3vBMfrHzazNJXPD4Xzbt3NeSf5BYNA1QHBdVqs9wqWSItuC kshvyV1XF7avUQmjba/zJqa6/Pm1ZMlSKFZqh4mqfofaNX9hnaJR3QlN8l9+0dfGUVKMTu nQnBXykAmRuNRWqNQDYoThE1uSSLAy4= Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-bc379e4c1cbso5465266276.2 for ; Mon, 07 Aug 2023 16:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449542; x=1692054342; 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=e+EvCLSRHEjRMcrqyzlI7nWwK61/1iPQ6CBOQpr2Pw8=; b=rLWnqjmP7sRfTz6wua9GaZP1/2cNvCnICKswTRMyXqBTRclhVFHiAas9xRu3tkibLy LYukTLEi8jX6/fTdkYMDCO0fnSCk16sHemMQ8U4gAHGrsaCCSIeDnfo7DvoQ9Gwt06kp MQCzbSxxIL1LtUE5+14WQYgbc9OVNCm8xO/RCzTEhtXZ96UEc4E8RE98LQSraVgUZ0Fd 6Fmm1G6c9NfTk9/aagcsWCP/kTtnrTjipyvOL5pIzWA4ypsawqK6CLLX9Fl4WFHyAZw8 htPBGGPp0caQCANc0qVpI3FsKnfIB5iUg+Zk2hPevHBBDnF1Z5MJXUMKGZAmqsL9A8b7 0bsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449542; x=1692054342; 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=e+EvCLSRHEjRMcrqyzlI7nWwK61/1iPQ6CBOQpr2Pw8=; b=jB+podonAcy3AAzJkpkYB+2SwM/qRP5um8bkmr9PxvDZnC7qiET+jiglY7UJwbnxuA io2ZbxXsom56vsv5M20DdTEa//hFLSkr01eLWX9o+J8loUG2JR4VA8og6fmjXLOFIdD4 jTJMCFe7f5rhlyuYLUZfTwxlA9h+D7OXDdczUBux6fUHf5bbOIynzTHAPtNkW06Wbncw ZBFHfG4wT7QR/3RshA2f1Ynw/oy/hxwPANpy4KpaZYBxqf9mrMsTnEITWp+f2RhORp0e g3eFbMw0iRupL6cQKFsCtcUFDRFgIEa6DNkfFnJJmCSYIL8wwOAetb3Y0D/vpxUXLquh 8eOQ== X-Gm-Message-State: AOJu0Yzrj24XTV9X5gvTb8YF548eEgxpk7IVLycfSw363Ctl3OGiqO3K ZIDjib/3n023FwY1NGfXhzA= X-Google-Smtp-Source: AGHT+IHORUBL3sdiWUXupMQ7Z7czVcAhY9T4N3g/NpV+o0AxUxjNA5Mmjsd58yiAAKDk1m0/Oelmjw== X-Received: by 2002:a25:ba84:0:b0:d11:d704:dd7f with SMTP id s4-20020a25ba84000000b00d11d704dd7fmr11892403ybg.32.1691449542531; Mon, 07 Aug 2023 16:05:42 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:42 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Christophe Leroy , Mike Rapoport Subject: [PATCH mm-unstable v9 12/31] powerpc: Convert various functions to use ptdescs Date: Mon, 7 Aug 2023 16:04:54 -0700 Message-Id: <20230807230513.102486-13-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 7ED8B40003 X-Stat-Signature: 6e15ozahue36j9uhjseb3oj8yud7n6k1 X-Rspam-User: X-HE-Tag: 1691449543-360744 X-HE-Meta: U2FsdGVkX18VtBody2qccjyjFbf3mfY7rVOIhMdc7TXgGZ8/tf3RyHwzj6fGVFmT82jw69nenHUxWu4Kfl5Co+AqNBXDH+z7kG7UnfqrPWie30g/Tz7CWuufr9C/H4MG+wBL4YWfcfS27+gPZxLDVfajJv+z2h6odu/ngwTeP/NJYHvm3+XgQAyJYyuFYX++/8zjdhGyLLfAXEhftCJN8SJJW/ZOR/aPoggC3yh7NvQWmzIn5hRxidE04FtK2gFT/3ltiOFbJaqcR8xhUQ0BRCpkYln5PxpKzpmzKWEoG4rJuxSOmKrebSxqa3Lc8t1m0BRs7li2jTd2mqQ2LZaVkVGOjZEwT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HV0d+sRYFya/KIbQA8JZB9HrNkYKRBQKOOjyzd0qj5b3kKufIBuqpKncjJpj1ZJoTiSf2dba/YtFzZvw65smPIik8xSFEnA7wpsCA9VYwej46zAx0UnNcIaE8PcV4Fr07RE5pvmP20GXx7/93kv3KqshzTCIBrx1Xqv6w== 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- arch/powerpc/mm/book3s64/mmu_context.c | 10 ++--- arch/powerpc/mm/book3s64/pgtable.c | 32 +++++++------- arch/powerpc/mm/pgtable-frag.c | 58 +++++++++++++------------- 3 files changed, 50 insertions(+), 50 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 75b938268b04..1498ccd08367 100644 --- a/arch/powerpc/mm/book3s64/pgtable.c +++ b/arch/powerpc/mm/book3s64/pgtable.c @@ -384,22 +384,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. @@ -409,12 +409,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); @@ -435,15 +435,15 @@ pmd_t *pmd_fragment_alloc(struct mm_struct *mm, unsigned long vmaddr) void pmd_fragment_free(unsigned long *pmd) { - struct page *page = virt_to_page(pmd); + struct ptdesc *ptdesc = virt_to_ptdesc(pmd); - if (PageReserved(page)) - return free_reserved_page(page); + if (pagetable_is_reserved(ptdesc)) + return free_reserved_ptdesc(ptdesc); - BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0); - if (atomic_dec_and_test(&page->pt_frag_refcount)) { - pgtable_pmd_page_dtor(page); - __free_page(page); + BUG_ON(atomic_read(&ptdesc->pt_frag_refcount) <= 0); + if (atomic_dec_and_test(&ptdesc->pt_frag_refcount)) { + pagetable_pmd_dtor(ptdesc); + pagetable_free(ptdesc); } } diff --git a/arch/powerpc/mm/pgtable-frag.c b/arch/powerpc/mm/pgtable-frag.c index 0c6b68130025..8c31802f97e8 100644 --- a/arch/powerpc/mm/pgtable-frag.c +++ b/arch/powerpc/mm/pgtable-frag.c @@ -18,15 +18,15 @@ void pte_frag_destroy(void *pte_frag) { int count; - struct page *page; + struct ptdesc *ptdesc; - page = virt_to_page(pte_frag); + ptdesc = virt_to_ptdesc(pte_frag); /* drop all the pending references */ count = ((unsigned long)pte_frag & ~PAGE_MASK) >> PTE_FRAG_SIZE_SHIFT; /* We allow PTE_FRAG_NR fragments from a PTE page */ - if (atomic_sub_and_test(PTE_FRAG_NR - count, &page->pt_frag_refcount)) { - pgtable_pte_page_dtor(page); - __free_page(page); + if (atomic_sub_and_test(PTE_FRAG_NR - count, &ptdesc->pt_frag_refcount)) { + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } } @@ -55,25 +55,25 @@ static pte_t *get_pte_from_cache(struct mm_struct *mm) static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel) { void *ret = NULL; - struct page *page; + struct ptdesc *ptdesc; if (!kernel) { - page = alloc_page(PGALLOC_GFP | __GFP_ACCOUNT); - if (!page) + ptdesc = pagetable_alloc(PGALLOC_GFP | __GFP_ACCOUNT, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } } else { - page = alloc_page(PGALLOC_GFP); - if (!page) + ptdesc = pagetable_alloc(PGALLOC_GFP, 0); + if (!ptdesc) return NULL; } - atomic_set(&page->pt_frag_refcount, 1); + atomic_set(&ptdesc->pt_frag_refcount, 1); - ret = page_address(page); + ret = ptdesc_address(ptdesc); /* * if we support only one fragment just return the * allocated page. @@ -82,12 +82,12 @@ static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel) return ret; spin_lock(&mm->page_table_lock); /* - * If we find pgtable_page set, we return + * If we find ptdesc_page set, we return * the allocated page with single fragment * count. */ if (likely(!pte_frag_get(&mm->context))) { - atomic_set(&page->pt_frag_refcount, PTE_FRAG_NR); + atomic_set(&ptdesc->pt_frag_refcount, PTE_FRAG_NR); pte_frag_set(&mm->context, ret + PTE_FRAG_SIZE); } spin_unlock(&mm->page_table_lock); @@ -108,28 +108,28 @@ pte_t *pte_fragment_alloc(struct mm_struct *mm, int kernel) static void pte_free_now(struct rcu_head *head) { - struct page *page; + struct ptdesc *ptdesc; - page = container_of(head, struct page, rcu_head); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc = container_of(head, struct ptdesc, pt_rcu_head); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } void pte_fragment_free(unsigned long *table, int kernel) { - struct page *page = virt_to_page(table); + struct ptdesc *ptdesc = virt_to_ptdesc(table); - if (PageReserved(page)) - return free_reserved_page(page); + if (pagetable_is_reserved(ptdesc)) + return free_reserved_ptdesc(ptdesc); - BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0); - if (atomic_dec_and_test(&page->pt_frag_refcount)) { + BUG_ON(atomic_read(&ptdesc->pt_frag_refcount) <= 0); + if (atomic_dec_and_test(&ptdesc->pt_frag_refcount)) { if (kernel) - __free_page(page); - else if (TestClearPageActive(page)) - call_rcu(&page->rcu_head, pte_free_now); + pagetable_free(ptdesc); + else if (folio_test_clear_active(ptdesc_folio(ptdesc))) + call_rcu(&ptdesc->pt_rcu_head, pte_free_now); else - pte_free_now(&page->rcu_head); + pte_free_now(&ptdesc->pt_rcu_head); } } From patchwork Mon Aug 7 23:04:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345297 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 59D88C001B0 for ; Mon, 7 Aug 2023 23:05:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C35C5940012; Mon, 7 Aug 2023 19:05:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BE6EF940008; Mon, 7 Aug 2023 19:05:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A38FF940012; Mon, 7 Aug 2023 19:05:47 -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 96311940008 for ; Mon, 7 Aug 2023 19:05:47 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5C4F8405FB for ; Mon, 7 Aug 2023 23:05:47 +0000 (UTC) X-FDA: 81098842734.19.8C33864 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) by imf09.hostedemail.com (Postfix) with ESMTP id 64B8114000D for ; Mon, 7 Aug 2023 23:05:45 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UhBUMZPi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.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=1691449545; 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=ihu1ng4lrcbvJHo6oggggoWFWazhhGhN16w0HBphiiHWLx+nD4qcgmfDuN3JEVS3eBorRc fOV/JuFY02tafC/sNQ9RjBIwXk9Mw+Ka3J3CdtisFc0oIFH2H6WVR9qbdTvQ7g54W0Itle kk4cYEdLjPbYGXFi3htQzlDjqoSXFZE= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UhBUMZPi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.176 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449545; a=rsa-sha256; cv=none; b=ebb8BbeyAHHWHTWU1IkkqJanU1LSF6Jtqnh7udQRbZuSfO0DPvVOkJ6D1yt/uSkMi6Uar1 zay99TOnv2RVI4/N5bK8xvcayE7xuuiAg7UYyd588oAkuDSm0JSwkkG+wozXGQeKZrSDkB 00/2/ov3jOQ3VEGy7UKjLXexCixgNgE= Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3a5ad6087a1so2786740b6e.2 for ; Mon, 07 Aug 2023 16:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449544; x=1692054344; 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=UhBUMZPilOAQo3tCXIAniV7oZUOB/4OUCgf91AGw0VUxPIy18IwE3Hi+xzTQPR3j5J o20MFNZLnYngdlpCV7c18tsU830Io9A8DWdX3VSs8IZGcaz3l+m4OaxP2VVwR45ldftn z2kW31b5xPxYeP3g5UA46i7qsam8HRjTgG7guCbc8HyGEcYktnlbPJA40mgTTCO6Cfp5 i9UcQWRlBkevWdSR2pIJgYC6roUzquc+QXKeembvcRSerjkiIbuoDs27MkJKPDd/Xbpo rTtWQ/L28eqbGOEHbuk8Zg9jgIBeYXnwkb82KyyF5XFV7KZrtQoqdZyN2qkwYGLx08Fy p3Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449544; x=1692054344; 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=DGMOmShbMZjIKNbTuzCQBN9iCECBwrtwtYmQsdRSPbx90nPNTLapjVis8QTpt66Yha LT/u7Qkpv5Av3Vrkpwr6RhnPysv9dtH+QMbCUXIOzl1WhV5cPYdwTAZKaqbDKIunwWlk sQK8Lb7mDWvvE57s3nPnDZi2sCgeRKD6kkaRSrhHIUDrjCuUb3QzwGhDST7v3pQcXZ7A atfSjVf6JGIc6d/iB576S6gTg47vJe5IxkLWAHemXXY6wS24+nCECSP3aM0/NnATOvgV sp2Yubd+lwFWlWOilWDzKulJ988W2TngEX6Tp6HkEb/gRqizMQcHHDUXzDOhxCPZT7+9 LsKA== X-Gm-Message-State: AOJu0Yw4paLyg4gMj08sBSlM11zB6wsphI/6zyBxUQKAT778Gh34vruZ 8kOeUzTkK4VkD9Mlv+dyhUU= X-Google-Smtp-Source: AGHT+IHsTvUJyWq2o9mZJc1NQ3FrwP0s/yEHbaA4sDhb4UDEkTpN/SnOXwKPkJpn25/vbSLatpkp3w== X-Received: by 2002:a05:6808:df3:b0:3a4:8140:97e8 with SMTP id g51-20020a0568080df300b003a4814097e8mr8989196oic.14.1691449544486; Mon, 07 Aug 2023 16:05:44 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:44 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Dave Hansen Subject: [PATCH mm-unstable v9 13/31] x86: Convert various functions to use ptdescs Date: Mon, 7 Aug 2023 16:04:55 -0700 Message-Id: <20230807230513.102486-14-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 64B8114000D X-Stat-Signature: wiofnm5eatb9cjhapx8c6xtdronkzpsq X-Rspam-User: X-HE-Tag: 1691449545-990271 X-HE-Meta: U2FsdGVkX1/b3mJXUMt0B0BHttIxU+WDKp4aTISJeUUYyQR5WkosQpKGxBTItpuRuOdTe8xQaaN2daRVx29aBPq4gW7+I1tV6jn5g35HSZx/0HGITpcTRGxv3bZk6oVvvZjzsq0yt21KSTJDbgx67sPrF2ukOnmdQ/PxNOekGTiuFQ9vvC2PdqCj7ESuSflSx6ukFCYB/cg7kqJsu4t/493Ww6SV/hGiua3FuygLUNbN6dWdApFbfs1o2K5w3D6+lVOvbop1Q49P9m/2vLMC9HG2oNZJz0Oi7hFWGGcMXg/9dvAejg4qI/NY7SaR+29d15c2daFVKyI/m7caHNRGGrqDKgRXdfA3EnYct1IWZtes8fTqZ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bMuYifQAf4QHJwPzpU6+ZxCzwH5mFpAhXKpJmnRLXfPhakoDKT0w8rRShjB9ung3qp5vrkK+1TYexvxi8qxgVH3Q8UCQ== 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 Mon Aug 7 23:04:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345298 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 F0E22C001DE for ; Mon, 7 Aug 2023 23:05:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7374940013; Mon, 7 Aug 2023 19:05:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B245F940008; Mon, 7 Aug 2023 19:05:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D922940013; Mon, 7 Aug 2023 19:05:49 -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 7B312940008 for ; Mon, 7 Aug 2023 19:05:49 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5BCA94016C for ; Mon, 7 Aug 2023 23:05:49 +0000 (UTC) X-FDA: 81098842818.01.2CCFCE8 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf07.hostedemail.com (Postfix) with ESMTP id 8967F40010 for ; Mon, 7 Aug 2023 23:05:47 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bESfOv3f; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449547; 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=KTxrIV2g+RQp8x48kTjbks2V3Qkjrf9giqtKYKQ6wMQ=; b=ftNhp4pFhmrbl1WghWsXRn83NybVVJkn0FPDGHWZvY8xMAK/y4rHFCNM70/0Yi8C22SALX t2k6cqyPBDkR0tVnDpB1C6S80vJdvEv1dqHDma4hcL5KPtvV/4zQBTQXIyJzl6AjMrKnpU BcxYa1gey2SnK9sbjlY8KPLhJoIA2YY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449547; a=rsa-sha256; cv=none; b=CIaC3ducCfyQm7VVm1aotS42P4OS4KNvSB27r9M/5aXb4/pUqD/gDvI4Jqt416AAJHDllb CtI2fVO8xPmujJcIxLHK285fJIWxqkjjmeGkIYBabSgDMiKR5j932VFVCVjj+dLwhbH0fY ScMQoK5DSj9YuhZnCiBKQZxe8sZNqVE= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bESfOv3f; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-bcb6dbc477eso4162663276.1 for ; Mon, 07 Aug 2023 16:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449546; x=1692054346; 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=KTxrIV2g+RQp8x48kTjbks2V3Qkjrf9giqtKYKQ6wMQ=; b=bESfOv3fJjl6S2bDdKG26ChK560t/KurCf2BuIVrJugWlIetZAY8dkm3BlRqTb5F9h MmCd+fJD3FYKnm/uPsZqzHHfYqRAfZJ6edPW59b/mfQy9OnVPplxToH74IAxvuQBpZIp niQgR35WlLiV2T1WK1prVa+1DAnr9uCehUPSrpK2bRog9p7trBe4LuQ5wQtTiaXMkeR6 5WiqV9YMt9t6YbF2oMIpXApkWHFh9QOYyGn6c4/FtI6WKINzWjkgGMiBWrQM5L6cS45e +OyFkksfoYTyAHJrwLrJApoTt8RQXAw2BsSDClQbHPobWbdTJ6uW2JVwGx2BjRuJHUGC 6BBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449546; x=1692054346; 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=KTxrIV2g+RQp8x48kTjbks2V3Qkjrf9giqtKYKQ6wMQ=; b=KEdUj4/LqL4i/xz42hceGhBi66Mhc3veXB6lmL+NwMdq/Ez2Yqx8/q1ocD34zbUvjT UHUwO3lmEmLgntjFkMAe+cO1HSrHI+btayneWkEZbQwRzvFjBbnMtp8OAtrjKH/r7pRu Wbyspfho5ZqAVPCwHecMP5vKPmap6DFMNc3PiV3xrufZelFhJlXAyMpcLQgh6MoBMN+i gjRyC07JIc5nheYKXl0ytbvsz5ThCUuUMqTjDtQc/4SIY6sN+P5/xqA5ONeyeeDhBFTo EIXHC1cF2EKAB5MO56iDGyjkj4KFkU90Rap1J9jhHENYyXFqOX7+1WazAY8GmCvv38Z0 Q9UA== X-Gm-Message-State: AOJu0YwW9tEQwrmbY9Z4Lur9iWf2pQ8UesNzHeo2DysMEM2L9w0P+p9v 32wW7msvOx5usHaaGgu+5YY= X-Google-Smtp-Source: AGHT+IEbeU2d+G/u3Omk8ALzIFtGElW92WFOhX86na7K18OIxELxvZjq1aqGQvka/NS+TcgqvjsoPw== X-Received: by 2002:a25:d08:0:b0:d1c:7549:4e8b with SMTP id 8-20020a250d08000000b00d1c75494e8bmr8202835ybn.29.1691449546593; Mon, 07 Aug 2023 16:05:46 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:46 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , David Hildenbrand , Claudio Imbrenda , Mike Rapoport Subject: [PATCH mm-unstable v9 14/31] s390: Convert various pgalloc functions to use ptdescs Date: Mon, 7 Aug 2023 16:04:56 -0700 Message-Id: <20230807230513.102486-15-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 8967F40010 X-Rspam-User: X-Stat-Signature: izoec378h89bzh7gjc596jmnatyij6be X-Rspamd-Server: rspam03 X-HE-Tag: 1691449547-175865 X-HE-Meta: U2FsdGVkX19UalX+pwfJc+sOxFfA9mR2ZbpaSptJAYBO3a1JYuz4W9rQGcSd3Fir8P+psY/wqJaXcbyqC9JmHZkAl4KQztB/6pwuHN61fcOPsHApJtsAUFHleDVzGomr6rVHya1Ytz1XDSjKt03iVNvAVjx5dQY3gkfLRNqL76Nj5I/pyEHMkTJYt0lZiDfuAuZL/YoZSR9JDRT8tCK4CI73TOJbJXkTUa8VmCH8QL2j098+Tq7EeFAlYP/rgVb0hTpFwjtwCGxtGwuNcKSLrRHS/IBqhCifP3TIiXt/SS68dOr8mKjyrN+RP9I9hg+4WsC4xvi9WuipIkgCOjM0iijQK5y2aN/qfRScggT3zV3hIGMsIR4p0z1+YYVGgW8axoQHSPwJ7UI+56jyo8mSxKJOFCdXnuiqHs23qw7klQ6ueOzmmPDCaQyqOHIwd4MHbtMwmzK/RowDeY+69h7AB2JlR7P4MRV2dbrqkOmqPZTooDU71vmDD16GKJxQj7YgNZ7rR2CwI52qHyREP2JhlsbrqL2xrghUSk2tgGdjA8BO3KtS0reEM1tOohBrCnD4OrwS2nyV232KMRohCkPZOOl7L0ag6J5dAITGdMF9O/Cu4BvtvJPmQrHn9TJL3N++eLhnewJ4IG+KEIzHwhvsnHD0uQJMMhDpk0+Z6BnttS6qp6h5RwAamHNXYPBLkj3NVM+g4bnBZNO6t0sm4IysccI8uzhXp5VFMzTZmGCo1bEJgCjL9WDWozcR6P7O6nUKmVhnAtbICwXcStFVnS9ehJNMjQbiilFHlx0D8Z4vQl2xARwHI2ZtkKPueOh85jaAjk7dqoFoNEk1NcxbmbU80gP7nBXHnblCTUnaIFkyxKG+u+MjbsPQ0NkADhLn+hqNJ3kE8NdmUL+DtT+JA0TxtVX1zu1PKHvvP6NyaRS/5rnAmyGvLeWP5OcNoYMQsu+gE+KRIwUMT2uEd09AsxW whpezpvJ jvjkUX/4vr73t5+3yaciaIgFk3kcArkTWQbCsX25oZb3f3XbSlNa5ylKbcviz5DnuwQwV8B7QcNhKhpVfe9dw/mw/V4Pw6jcdtcDjH8grJ6onmqT4xugjfb1SU2slb72dPuSAYzyxMzyWX+gBoQV6QtOPzg+8OF3VhwVUXXY6Q8Hex5lmzOVRc7ibgy4isDLwHYE46xKFK0V1FPaDhSbsJv/9tYlfqyj5pUCLv2JiP85NbjJTIMBCFNa2PwmD3irGvlBrCaey9FmmHB46Wnp/hBtAszGc7F36WcL42wfovPhDRe1fJcsJlEjN2UZQKUfTkxPX083hmD2UjTTyT4hCIRpcGzlrJpBWGFUMgD6mplacjZKrLk/931XwAxxkJAbxnIU93mZ/pbyLyMKe4amRSw+U9d4X2EoWeS4hLyAjRWpKl0+zkqTabxm75n5pnytLnYZtQuLzbIBtEX++Lc6EXu0HpKsx6ayd+CjSfFRyXxfm42N/txKHrJank4JzSCAx5wWLIpxWpeWU0MBy7o8gIdfRXzNOAd2z/o44sRKl30bjm2TUQOOWn3z8UxAA/Jq9p9iGvQ2lnQjm4lcpmDVtQcaeijnoSI3lONVx7ChwtfJO9iBkERcOk9dKJA== 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- arch/s390/include/asm/pgalloc.h | 4 +- arch/s390/include/asm/tlb.h | 4 +- arch/s390/mm/pgalloc.c | 128 ++++++++++++++++---------------- 3 files changed, 69 insertions(+), 67 deletions(-) diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h index 89a9d5ef94f8..376b4b23bdaa 100644 --- a/arch/s390/include/asm/pgalloc.h +++ b/arch/s390/include/asm/pgalloc.h @@ -86,7 +86,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) if (!table) return NULL; crst_table_init(table, _SEGMENT_ENTRY_EMPTY); - if (!pgtable_pmd_page_ctor(virt_to_page(table))) { + if (!pagetable_pmd_ctor(virt_to_ptdesc(table))) { crst_table_free(mm, table); return NULL; } @@ -97,7 +97,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) { if (mm_pmd_folded(mm)) return; - pgtable_pmd_page_dtor(virt_to_page(pmd)); + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); crst_table_free(mm, (unsigned long *) pmd); } diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h index b91f4a9b044c..383b1f91442c 100644 --- a/arch/s390/include/asm/tlb.h +++ b/arch/s390/include/asm/tlb.h @@ -89,12 +89,12 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, { if (mm_pmd_folded(tlb->mm)) return; - pgtable_pmd_page_dtor(virt_to_page(pmd)); + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); __tlb_adjust_range(tlb, address, PAGE_SIZE); tlb->mm->context.flush_mm = 1; tlb->freed_tables = 1; tlb->cleared_puds = 1; - tlb_remove_table(tlb, pmd); + tlb_remove_ptdesc(tlb, pmd); } /* diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index d7374add7820..07fc660a24aa 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -43,17 +43,17 @@ __initcall(page_table_register_sysctl); unsigned long *crst_table_alloc(struct mm_struct *mm) { - struct page *page = alloc_pages(GFP_KERNEL, CRST_ALLOC_ORDER); + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL, CRST_ALLOC_ORDER); - if (!page) + if (!ptdesc) return NULL; - arch_set_page_dat(page, CRST_ALLOC_ORDER); - return (unsigned long *) page_to_virt(page); + arch_set_page_dat(ptdesc_page(ptdesc), CRST_ALLOC_ORDER); + return (unsigned long *) ptdesc_to_virt(ptdesc); } void crst_table_free(struct mm_struct *mm, unsigned long *table) { - free_pages((unsigned long)table, CRST_ALLOC_ORDER); + pagetable_free(virt_to_ptdesc(table)); } static void __crst_table_upgrade(void *arg) @@ -140,21 +140,21 @@ static inline unsigned int atomic_xor_bits(atomic_t *v, unsigned int bits) struct page *page_table_alloc_pgste(struct mm_struct *mm) { - struct page *page; + struct ptdesc *ptdesc; u64 *table; - page = alloc_page(GFP_KERNEL); - if (page) { - table = (u64 *)page_to_virt(page); + ptdesc = pagetable_alloc(GFP_KERNEL, 0); + if (ptdesc) { + table = (u64 *)ptdesc_to_virt(ptdesc); memset64(table, _PAGE_INVALID, PTRS_PER_PTE); memset64(table + PTRS_PER_PTE, 0, PTRS_PER_PTE); } - return page; + return ptdesc_page(ptdesc); } void page_table_free_pgste(struct page *page) { - __free_page(page); + pagetable_free(page_ptdesc(page)); } #endif /* CONFIG_PGSTE */ @@ -242,7 +242,7 @@ void page_table_free_pgste(struct page *page) unsigned long *page_table_alloc(struct mm_struct *mm) { unsigned long *table; - struct page *page; + struct ptdesc *ptdesc; unsigned int mask, bit; /* Try to get a fragment of a 4K page as a 2K page table */ @@ -250,9 +250,9 @@ unsigned long *page_table_alloc(struct mm_struct *mm) table = NULL; spin_lock_bh(&mm->context.lock); if (!list_empty(&mm->context.pgtable_list)) { - page = list_first_entry(&mm->context.pgtable_list, - struct page, lru); - mask = atomic_read(&page->_refcount) >> 24; + ptdesc = list_first_entry(&mm->context.pgtable_list, + struct ptdesc, pt_list); + mask = atomic_read(&ptdesc->_refcount) >> 24; /* * The pending removal bits must also be checked. * Failure to do so might lead to an impossible @@ -264,13 +264,13 @@ unsigned long *page_table_alloc(struct mm_struct *mm) */ mask = (mask | (mask >> 4)) & 0x03U; if (mask != 0x03U) { - table = (unsigned long *) page_to_virt(page); + table = (unsigned long *) ptdesc_to_virt(ptdesc); bit = mask & 1; /* =1 -> second 2K */ if (bit) table += PTRS_PER_PTE; - atomic_xor_bits(&page->_refcount, + atomic_xor_bits(&ptdesc->_refcount, 0x01U << (bit + 24)); - list_del_init(&page->lru); + list_del_init(&ptdesc->pt_list); } } spin_unlock_bh(&mm->context.lock); @@ -278,28 +278,28 @@ unsigned long *page_table_alloc(struct mm_struct *mm) return table; } /* Allocate a fresh page */ - page = alloc_page(GFP_KERNEL); - if (!page) + ptdesc = pagetable_alloc(GFP_KERNEL, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - arch_set_page_dat(page, 0); + arch_set_page_dat(ptdesc_page(ptdesc), 0); /* Initialize page table */ - table = (unsigned long *) page_to_virt(page); + table = (unsigned long *) ptdesc_to_virt(ptdesc); if (mm_alloc_pgste(mm)) { /* Return 4K page table with PGSTEs */ - INIT_LIST_HEAD(&page->lru); - atomic_xor_bits(&page->_refcount, 0x03U << 24); + INIT_LIST_HEAD(&ptdesc->pt_list); + atomic_xor_bits(&ptdesc->_refcount, 0x03U << 24); memset64((u64 *)table, _PAGE_INVALID, PTRS_PER_PTE); memset64((u64 *)table + PTRS_PER_PTE, 0, PTRS_PER_PTE); } else { /* Return the first 2K fragment of the page */ - atomic_xor_bits(&page->_refcount, 0x01U << 24); + atomic_xor_bits(&ptdesc->_refcount, 0x01U << 24); memset64((u64 *)table, _PAGE_INVALID, 2 * PTRS_PER_PTE); spin_lock_bh(&mm->context.lock); - list_add(&page->lru, &mm->context.pgtable_list); + list_add(&ptdesc->pt_list, &mm->context.pgtable_list); spin_unlock_bh(&mm->context.lock); } return table; @@ -322,19 +322,18 @@ static void page_table_release_check(struct page *page, void *table, static void pte_free_now(struct rcu_head *head) { - struct page *page; + struct ptdesc *ptdesc; - page = container_of(head, struct page, rcu_head); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc = container_of(head, struct ptdesc, pt_rcu_head); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } void page_table_free(struct mm_struct *mm, unsigned long *table) { unsigned int mask, bit, half; - struct page *page; + struct ptdesc *ptdesc = virt_to_ptdesc(table); - page = virt_to_page(table); if (!mm_alloc_pgste(mm)) { /* Free 2K page table fragment of a 4K page */ bit = ((unsigned long) table & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); @@ -344,51 +343,50 @@ void page_table_free(struct mm_struct *mm, unsigned long *table) * will happen outside of the critical section from this * function or from __tlb_remove_table() */ - mask = atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x11U << (bit + 24)); mask >>= 24; - if ((mask & 0x03U) && !PageActive(page)) { + if ((mask & 0x03U) && !folio_test_active(ptdesc_folio(ptdesc))) { /* * Other half is allocated, and neither half has had * its free deferred: add page to head of list, to make * this freed half available for immediate reuse. */ - list_add(&page->lru, &mm->context.pgtable_list); + list_add(&ptdesc->pt_list, &mm->context.pgtable_list); } else { /* If page is on list, now remove it. */ - list_del_init(&page->lru); + list_del_init(&ptdesc->pt_list); } spin_unlock_bh(&mm->context.lock); - mask = atomic_xor_bits(&page->_refcount, 0x10U << (bit + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x10U << (bit + 24)); mask >>= 24; if (mask != 0x00U) return; half = 0x01U << bit; } else { half = 0x03U; - mask = atomic_xor_bits(&page->_refcount, 0x03U << 24); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x03U << 24); mask >>= 24; } - page_table_release_check(page, table, half, mask); - if (TestClearPageActive(page)) - call_rcu(&page->rcu_head, pte_free_now); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + if (folio_test_clear_active(ptdesc_folio(ptdesc))) + call_rcu(&ptdesc->pt_rcu_head, pte_free_now); else - pte_free_now(&page->rcu_head); + pte_free_now(&ptdesc->pt_rcu_head); } void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table, unsigned long vmaddr) { struct mm_struct *mm; - struct page *page; unsigned int bit, mask; + struct ptdesc *ptdesc = virt_to_ptdesc(table); mm = tlb->mm; - page = virt_to_page(table); if (mm_alloc_pgste(mm)) { gmap_unlink(mm, table, vmaddr); table = (unsigned long *) ((unsigned long)table | 0x03U); - tlb_remove_table(tlb, table); + tlb_remove_ptdesc(tlb, table); return; } bit = ((unsigned long) table & ~PAGE_MASK) / (PTRS_PER_PTE*sizeof(pte_t)); @@ -398,19 +396,19 @@ void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table, * outside of the critical section from __tlb_remove_table() or from * page_table_free() */ - mask = atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x11U << (bit + 24)); mask >>= 24; - if ((mask & 0x03U) && !PageActive(page)) { + if ((mask & 0x03U) && !folio_test_active(ptdesc_folio(ptdesc))) { /* * Other half is allocated, and neither half has had * its free deferred: add page to end of list, to make * this freed half available for reuse once its pending * bit has been cleared by __tlb_remove_table(). */ - list_add_tail(&page->lru, &mm->context.pgtable_list); + list_add_tail(&ptdesc->pt_list, &mm->context.pgtable_list); } else { /* If page is on list, now remove it. */ - list_del_init(&page->lru); + list_del_init(&ptdesc->pt_list); } spin_unlock_bh(&mm->context.lock); table = (unsigned long *) ((unsigned long) table | (0x01U << bit)); @@ -421,30 +419,30 @@ void __tlb_remove_table(void *_table) { unsigned int mask = (unsigned long) _table & 0x03U, half = mask; void *table = (void *)((unsigned long) _table ^ mask); - struct page *page = virt_to_page(table); + struct ptdesc *ptdesc = virt_to_ptdesc(table); switch (half) { case 0x00U: /* pmd, pud, or p4d */ - free_pages((unsigned long)table, CRST_ALLOC_ORDER); + pagetable_free(ptdesc); return; case 0x01U: /* lower 2K of a 4K page table */ case 0x02U: /* higher 2K of a 4K page table */ - mask = atomic_xor_bits(&page->_refcount, mask << (4 + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, mask << (4 + 24)); mask >>= 24; if (mask != 0x00U) return; break; case 0x03U: /* 4K page table with pgstes */ - mask = atomic_xor_bits(&page->_refcount, 0x03U << 24); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x03U << 24); mask >>= 24; break; } - page_table_release_check(page, table, half, mask); - if (TestClearPageActive(page)) - call_rcu(&page->rcu_head, pte_free_now); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + if (folio_test_clear_active(ptdesc_folio(ptdesc))) + call_rcu(&ptdesc->pt_rcu_head, pte_free_now); else - pte_free_now(&page->rcu_head); + pte_free_now(&ptdesc->pt_rcu_head); } #ifdef CONFIG_TRANSPARENT_HUGEPAGE @@ -488,16 +486,20 @@ static void base_pgt_free(unsigned long *table) static unsigned long *base_crst_alloc(unsigned long val) { unsigned long *table; + struct ptdesc *ptdesc; - table = (unsigned long *)__get_free_pages(GFP_KERNEL, CRST_ALLOC_ORDER); - if (table) - crst_table_init(table, val); + ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, CRST_ALLOC_ORDER); + if (!ptdesc) + return NULL; + table = ptdesc_address(ptdesc); + + crst_table_init(table, val); return table; } static void base_crst_free(unsigned long *table) { - free_pages((unsigned long)table, CRST_ALLOC_ORDER); + pagetable_free(virt_to_ptdesc(table)); } #define BASE_ADDR_END_FUNC(NAME, SIZE) \ From patchwork Mon Aug 7 23:04:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345299 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 5E0ACC04FDF for ; Mon, 7 Aug 2023 23:05:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9ECE1940014; Mon, 7 Aug 2023 19:05:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 974F2940008; Mon, 7 Aug 2023 19:05:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7EEF4940014; Mon, 7 Aug 2023 19:05:51 -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 7202E940008 for ; Mon, 7 Aug 2023 19:05:51 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 36FADB229B for ; Mon, 7 Aug 2023 23:05:51 +0000 (UTC) X-FDA: 81098842902.09.BC6F5B0 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by imf28.hostedemail.com (Postfix) with ESMTP id 73947C0021 for ; Mon, 7 Aug 2023 23:05:49 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=A70KAiN4; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449549; a=rsa-sha256; cv=none; b=ysPE2swLDpMqujOk8VJIS3oSQLumEydI4Nkq7VoUwlFNTLWLzLGtMf13epqI0mSkmfnFAd apXn2DfzI0wYwuNBkcCs1rtYry0b0wOO+8jqMKpZmeBba46o4NR3MTblh+Dh62ojVmDhOD MKS5fBVFzx90wc4zxL9f2+a4vTJo8OM= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=A70KAiN4; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449549; 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=djDHSA50q7R+UyBiZfR1OlHjGJmDs73q9nwlLjbVi90=; b=uNXrDyZRoBnQEY4imQnozb8ppN+e+AH1MWydxMZPunXaebY1h9YLiaOzLDA0BRSoVonqFa CvANXFayx/ZNjG3UGraub60abAPlocvKHIstw5FUWw2iVLPEmq4TYf7BCzmcnQ4x89wPMY 29mz7TNKsu82AUwHphY63VDLaXqkt8g= Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-d13e0bfbbcfso7271216276.0 for ; Mon, 07 Aug 2023 16:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449548; x=1692054348; 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=djDHSA50q7R+UyBiZfR1OlHjGJmDs73q9nwlLjbVi90=; b=A70KAiN4sx+tlFlhyX9BkgJstVMLVR3VqHlhU0rx7I/q1gK7xadYJiksKbuvoZ1TCU vtYAPdjYMcohI4FUcCDaUSvo3KExkCCd8i4ZAJlLsd7GGEFa35HZ6ueu66zMG9Pjessv IfHL3oLMSZbSj2Xq1C5vYTgwWzjwrMyTCzKH7w07IcqqBjGPHvlKkPkr5yx2TrtnD3V5 vilM5UK235QUkkDj7spFvnAsyD47IB2DFcBmstKvpCiE4ENrGAtmtfggM5j3FhO6Urma yNzpPXlABiRMwP18oUglZegWP3XimvmMFaP4ALUxkyZmGiszwVYNBF+f3K+ck5Grr2Wp NJ/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449548; x=1692054348; 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=djDHSA50q7R+UyBiZfR1OlHjGJmDs73q9nwlLjbVi90=; b=dXpCLLd6XxLwITgvSjrEcciKCPZJ6fiQzwu4ZPjbiOjCxA4i5zPzT2+t6Ba5s2rxp6 oNAABPq2jM4nGqKScOWE7FkgOWKz5dTRBF2gmR5b7j3/P79HD5dTWP3zxQseoxlycRPu XWkmY6xaNBWTvwqr3i9HpMD5m6x65evX5J0IhdqrEg6D+hgEBSooUc0mo/rxNa5WlSMu 4Y/TmVQU2Du0MP7ZsvmMEll83wIDEb9YOmCMlrJtzI/u1Tjux4naXykoa8k/8qyGYPWi YiOR9xbNXUn2gOH143SBYiPN5rcNUMlMx6KJQAFewSWovrUqVJylGBKNooGyn/A3ifwB wx1g== X-Gm-Message-State: AOJu0YyInfKlE3/7SQKxAQkWBJfeuZhEMAZNoM7oQwu2dfoCM8TWusmX u/malmHpbhw7Pq4uaTxCGpI= X-Google-Smtp-Source: AGHT+IGTzP73V6D5bA3Obfkv2DqAOxUsUVIIigLLB5NQKEC9VyMSvyrKel3HyW7I0Mz7ccDZUXFbIA== X-Received: by 2002:a25:d8c4:0:b0:d05:2616:3363 with SMTP id p187-20020a25d8c4000000b00d0526163363mr9753736ybg.26.1691449548551; Mon, 07 Aug 2023 16:05:48 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:48 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v9 15/31] mm: remove page table members from struct page Date: Mon, 7 Aug 2023 16:04:57 -0700 Message-Id: <20230807230513.102486-16-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 73947C0021 X-Stat-Signature: 3gpj7wpnmjy7hn9djxtk3qe5tryig4tw X-Rspam-User: X-HE-Tag: 1691449549-491743 X-HE-Meta: U2FsdGVkX18tQjIUjJr0AuUZLCCKkGRcY/dhaP9/kj3NohDbGuQ/dFGBvFW1dFx4a09LlqdvyE8JWdumo9Fk75hgQ0HBrmOdELwrLoaSQ8+HPdQzXRTjji9hmsxxZlzwo7yT9Lvl4bKPTIXsb83rGdH+JB5tP9SKxkO4g8iuD114mIJIaC9HjQ78kT9FOwpRBeNhdrzTzBaN/XjL1R7+vdYNn6Yh2ufUcTIbZ5iI4VKJzLxiYRgSTEcJcr5xe9yTDRa6vAy1bQBpXR17GSX/SelHjAncfMhjH0+OcocJLErE44mhntLL8mr5gkUiuCvGtUXu15xBpcikD8b4DgAuPyQGwddmdczajLmlaByvj5fKXPCNBLEFJAuZpLZN5kxit0tkoIrqXOtRPcJFwQsfPonIQLddwu37TETidoYvF6Qe7PzxYa+eTyJJuH8P+KQWxGOAGVG0NQZRc42c38MavzUBO9YjVR3lGRaFANlw5xVQaL5uKucWi/OmlS+HFbRY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VAGtKVAtw== 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 | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index ea34b22b4cbf..f5ba5b0bc836 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -141,24 +141,6 @@ struct page { struct { /* Tail pages of compound page */ unsigned long compound_head; /* Bit zero is set */ }; - struct { /* Page table pages */ - unsigned long _pt_pad_1; /* compound_head */ - pgtable_t pmd_huge_pte; /* protected by page->ptl */ - /* - * A PTE page table page might be freed by use of - * rcu_head: which overlays those two fields above. - */ - unsigned long _pt_pad_2; /* mapping */ - union { - struct mm_struct *pt_mm; /* x86 pgds only */ - atomic_t pt_frag_refcount; /* powerpc */ - }; -#if ALLOC_SPLIT_PTLOCKS - spinlock_t *ptl; -#else - spinlock_t ptl; -#endif - }; struct { /* ZONE_DEVICE pages */ /** @pgmap: Points to the hosting device page map. */ struct dev_pagemap *pgmap; @@ -454,10 +436,7 @@ struct ptdesc { TABLE_MATCH(flags, __page_flags); TABLE_MATCH(compound_head, pt_list); TABLE_MATCH(compound_head, _pt_pad_1); -TABLE_MATCH(pmd_huge_pte, pmd_huge_pte); TABLE_MATCH(mapping, __page_mapping); -TABLE_MATCH(pt_mm, pt_mm); -TABLE_MATCH(ptl, ptl); TABLE_MATCH(rcu_head, pt_rcu_head); TABLE_MATCH(page_type, __page_type); TABLE_MATCH(_refcount, _refcount); From patchwork Mon Aug 7 23:04:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345300 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 AA233C001B0 for ; Mon, 7 Aug 2023 23:05:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F1D16940015; Mon, 7 Aug 2023 19:05:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E7F57940008; Mon, 7 Aug 2023 19:05:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAAAB940015; Mon, 7 Aug 2023 19:05:53 -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 BCFE2940008 for ; Mon, 7 Aug 2023 19:05:53 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 9ABC2407A1 for ; Mon, 7 Aug 2023 23:05:53 +0000 (UTC) X-FDA: 81098842986.11.CAFF2F7 Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by imf21.hostedemail.com (Postfix) with ESMTP id 827401C001F for ; Mon, 7 Aug 2023 23:05:51 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="VY/s2U3l"; spf=pass (imf21.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449551; 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=s+cU8PdzuM1CmVUHy9wIWYCSgV7mxUC5a1bM4RmXCycQ7cPYGnuLIPvbB6T5JxqxYSBiaf OpqYXXSbiqTMvu2wn6O+37iIdBrRpu/4lUtMMfNKJoOZjNeDhSrZH22wjIep0c29xzS7eF vsBjN0tztyEncRbY4yJLXcjHj3TwPXc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449551; a=rsa-sha256; cv=none; b=3cXs8fBM0ZDbOT5S0ym6GqRPO7f6789s41YIj/Xaw2Bg4K2jHYeuuIKV1DRQSFdTJzGq0l ccvE0ngBsmFBHHREsNMTe/UI4qT2eqqiJhFVG8zWKn0JNdFA04YDJU3Wi8nIEwCB+hyRMh aAP25GMWJzHlksw5+AJ80v1j/vWWr54= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="VY/s2U3l"; spf=pass (imf21.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-583b3939521so58552887b3.0 for ; Mon, 07 Aug 2023 16:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449550; x=1692054350; 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=VY/s2U3lT3eb7t5IpiSg8gZgrV6zdEznmL00awlF+lYtU+Ed+18ZVDdsEO6HtU7Vpy dstrUN4SchMkl2fom9aAptCCOd47DbaRbKQrrssm7FlhTEAcsGfKdLEpxi/zNmVX8fbV m0BaPQ+7+Y3ljNnqxJV89KTzVnBKrAEa7+VtN/uK6yP5RttPNi+e44fLcNeyDJwviR59 fKsVvf58pKEDMlQLmejzlB0KwEwg/f+nuBnJ5WOjDekR3PGb3d8Uh4xNSu90knT7V2KQ ue+Oh5SumW1Q6VzG3Nvx4HCQCUch1OMetRhRQnyZsGJky+dnZgy775ZLVF7RMseL02QV h21w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449550; x=1692054350; 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=OTy+UQHsRG1S8eI8SrnBFpRw+8SowbjTFOYp9TL/wkNXtnTUjPXlTDc4IaFxt5kAmz 4af+hC72bPlOhtO1GLhyWodudsBHdC5TNxqsaM2HiTkQYWO2vZPU90RbyvP+2oVUm6Qf 9c/mUvkAaEhwu1X6fW1QT3AREVULBAS3MFTdTtguwzwlNO67QhP2A1IVOY1bdNfdp20E zNWzUHaXshuWpzptFnUaG3H0zZKGvXswNQa77BBylj4+z201qhjzXvkod+fEmA2tGZDN GpOGgvapE7uVOA/q4Pax7LBO8WjEqV4ocdqqPBqoR+IuKsxXhz2ccJm13Qc2SKV9+dJH 6pwg== X-Gm-Message-State: AOJu0Yy5fq4aEJtzPyHEWXjIeiuzzTiuU/UVqlhGqcJGc/qX4VKIn4uJ Wt4G9weUkyNiPLrU+Dg4DhA= X-Google-Smtp-Source: AGHT+IF/jyNrncOka/KAbgWZqRRy9OsJr4lD7fBxdAmIgyKSndALMkVGpelnzbmpBefUTJnYvKwx8g== X-Received: by 2002:a25:8001:0:b0:d0f:ea4b:1dff with SMTP id m1-20020a258001000000b00d0fea4b1dffmr9335352ybk.8.1691449550566; Mon, 07 Aug 2023 16:05:50 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:50 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" Subject: [PATCH mm-unstable v9 16/31] pgalloc: Convert various functions to use ptdescs Date: Mon, 7 Aug 2023 16:04:58 -0700 Message-Id: <20230807230513.102486-17-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 827401C001F X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 7c6kun7zoecx4u6z5yxkgqpkttecmbu5 X-HE-Tag: 1691449551-850857 X-HE-Meta: U2FsdGVkX19zlcJw04+UJ7LbClsEut2j+paXLRIlnho1WNphYpD+QLxBGN3zRl2L92/Wf+CNg5s3+GKKf+HGBXxcHID3ygs/BZ2k+Li3tlZi6PioLQC6xg2zM42zQR/4ZxiKkvCdFdF/GD0Klfo+d0PYqOV05pmGeab87tMYAiPfYc/me+c6xQHI1YSsHeVxHDKXyNEOemM85Np1QQ5ENg3CLa2XDE7/g/tiApMKMLG34vD3pNLPYLJT7VS2bKDQ3cPu65dKYMFL9/DmvwQcJMNqFXDo7piFGHp+Iv2ioJpD9+ogk9aHSf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FMIyHpc7bPS7K0Sm3MVkGPElYxMuYnOYhP2KOGdDDTkvJ7XUUVaRzTVYBhZclJT3UU/xOgNWH9Cj0FW/aX5YfC/dL0SiSw1uxt9lr91LTxOj5PfD59jfXgA55G3hEZ3D2MEwUF5PQvSJeGLg5cWFWAZe8nSLQlQCx0RvmLtVQ== 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 Mon Aug 7 23:04:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345301 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 26B63C04E69 for ; Mon, 7 Aug 2023 23:06:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B9C14940016; Mon, 7 Aug 2023 19:05:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B4A3E940008; Mon, 7 Aug 2023 19:05:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9EB02940016; Mon, 7 Aug 2023 19:05: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 90F3E940008 for ; Mon, 7 Aug 2023 19:05:55 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 68A171604C4 for ; Mon, 7 Aug 2023 23:05:55 +0000 (UTC) X-FDA: 81098843070.19.1F1F897 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf15.hostedemail.com (Postfix) with ESMTP id 886B8A0021 for ; Mon, 7 Aug 2023 23:05:53 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=mEF5uAs6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.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=1691449553; 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=mSWx8dFer3K04xJe2FS2V6S19uUh9FiSOjAjYMXRNjw=; b=fbrOM7ZfYlTPij4FL0ieY/KmlRg9I8okPfFAwXPbie1dfkVEG3X6jQyfbDNNlSn5ygW8J7 nccaQOKAmXZ017cN+xyp8Nj0mze/NaIL6Aci2oLjUjiXJ13kiZTR3KDQRHTM3/F5OWfb1x R4LBm9dUbyFTrpGlZLx2X76i9+H23FU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=mEF5uAs6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.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=1691449553; a=rsa-sha256; cv=none; b=q0ZMLKqRcD+FeQCVNZNvf2VBfNyTSehodazdPDadG33lY5Ask+sfstPbKo32rX9SxsFHYV mLf3p3DKrDzKrrZUsR3TShyjHuILyvs1ZpvSGSFxz2N9reATTld6XVkKmNKmTB8SqErZNN r0K5GpE/XMRIc1tfYtaazztdF44lHv0= Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-bc379e4c1cbso5465351276.2 for ; Mon, 07 Aug 2023 16:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449552; x=1692054352; 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=mSWx8dFer3K04xJe2FS2V6S19uUh9FiSOjAjYMXRNjw=; b=mEF5uAs6LPH63FkNSBplLFspkb60DHxm6zOnUwvAQJc3E/pOwbhAIiNFZBUYHiCsiM p2tbQp60CKHpnlFx92kmBMq0iICGLFKDwXQ0LyWNPB5CTFYLszQ4c8mEuzgfzEni9mwM Ttmf1qUiq6AjtyU7518jshwfi+pChbC60Sh5kSbXAB+lvEOcHSUd/ZfP7MFS2PgNjGFo r7Bvb+zEwdMz3ovaFVdL7n7AY1JJbQH54hsJVFdRCSvSwoDtl5zIXSCLg5x4eEWrxL65 mP+yB5DlcuhDlbUdEBdiXWCJptk41KogbXQLbDgKd5NU/tlto4itztjaP5et2Hvpw0rt 7VEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449552; x=1692054352; 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=mSWx8dFer3K04xJe2FS2V6S19uUh9FiSOjAjYMXRNjw=; b=hNhP3dPnE9vx/Wxucz8VWahibQm1UEPwy7mWMduGnJPxWq1GPZ3cR+LG+RY3VqMIaF 6T8EPgpmE9zdNAUe5m9FDkT1zJioOSTJZQFxvm7iTB8OxEfuFP/xz3c0qFxfhVSNfLdi kuw64fp8s8Fe4xZ9qjsqBtWZVSURxSEFNZUogY8/wXotGb+6j6RZp7KriRPOKntYXM4h vzCUOhJCYpXHNz8y46tz2IyrdnfS054U+4OeVovoXKVrj/47rFMeVVuprzKGK0sAVAu0 2WMFaqKXptwsLVyDmeJM7/BOETWhzd+D9Qb6KDRZ8G3t9Q6xFqhV0QsTM51NQ5C6qcTQ SItg== X-Gm-Message-State: AOJu0YwgXawTtKhitQVAN7lfm7qfRm1US47qGttf+jZkoBRk4v9rh/xC obLK1Cgyef1c67PaeP0sYu4= X-Google-Smtp-Source: AGHT+IFZB5AVL/MxN7IM/ds0EZn0mK90E4BWht9Xyb7zBcTjMbr/Qp8cCY+l+/2imbi83tiWiC1i0w== X-Received: by 2002:a25:4e05:0:b0:d12:3108:f90f with SMTP id c5-20020a254e05000000b00d123108f90fmr10423741ybb.24.1691449552662; Mon, 07 Aug 2023 16:05:52 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:52 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Catalin Marinas , Mike Rapoport Subject: [PATCH mm-unstable v9 17/31] arm: Convert various functions to use ptdescs Date: Mon, 7 Aug 2023 16:04:59 -0700 Message-Id: <20230807230513.102486-18-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: sx16mbxadkywnykhfixnfqosumtx3xhy X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 886B8A0021 X-HE-Tag: 1691449553-54854 X-HE-Meta: U2FsdGVkX1/QqzeM2ypYbJ9KVL9zKcJfQAch6jxRzt+GTeBS5S56Hgti1jQMp4YIp1JOCeuyCRlKKSx2/AQAG6bIpPtSTHcb3Akx6qtk87OfYpTrxesPcdi+siergtZixMGJOqIdx0GVZ4onT5pmR4A9eNwG5mDuXMERDKbhZNk72+ZvGdAzZ2bmI/7hKKtEqCAJIPIrenVrAZYHulxtid131GwkhQsODoJ6J+exNOljuMAfwL0Q0aJlec6HRJ7VjCKTUVfmGnWt1QNu+Xstoj72WGlrF19Kec28vTmdc8AQKPfZVdCEuUeHucMIsMxsXpG3OjUsJGAh3EuD9mwzFy0AffM+ILOabEv0CsInUokQRuxPD0vg7yyYXpAKi+qD348ZRSEgxX0R8q+IlR6k3NEG2CQEqczCYVGAyQY/CaWCQ3j9oLoP8KEn29cHe9K+MBJn3nF39d3Hks/0DyOlBV1oqHyJiN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46Lf4uY2Eai1g6r8ZKvPzxOmj7geywOBcIb2csjvFDw/8eHA== 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 c9981c23e8e9..674ed71573a8 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 Mon Aug 7 23:05:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345302 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 A4E1BC001DE for ; Mon, 7 Aug 2023 23:06:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B4C8A940017; Mon, 7 Aug 2023 19:05:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AFDA5940008; Mon, 7 Aug 2023 19:05:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9CEE7940017; Mon, 7 Aug 2023 19:05:57 -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 8ADA5940008 for ; Mon, 7 Aug 2023 19:05:57 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 590D31A0BFA for ; Mon, 7 Aug 2023 23:05:57 +0000 (UTC) X-FDA: 81098843154.29.D1F7755 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf25.hostedemail.com (Postfix) with ESMTP id 93F7EA0010 for ; Mon, 7 Aug 2023 23:05:55 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=p8G6Pt9Q; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.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=1691449555; 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=d6BZos7Ybf69Lr9ubs2a6Azcthgsxnr+LK2TqOKvMHI=; b=RyDtdb9whuKy99ptcaYxjroLrvwbAt0toAuPSJANZpD/eF+WTNyihWWvBZ+aya8X3mhJcB Vw2A2Esvbc/Ae8qSFsrza2qileEs8/LmNZ34EYmW9D21U43Venq+CYxZgsSzPnVlAMdPH5 jYCOzcvrXoaZ6Fw49LS8kNxP7KpzoH0= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=p8G6Pt9Q; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.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=1691449555; a=rsa-sha256; cv=none; b=qFQxaEl4hPb4A6lbRom0CJ3tXB5KIINaAt6nvMoOA2HP9fp9rTu02O6dIMxjIUjlMwfNCr cc7KQKQaPQQbmAmMPc3uGthBmn6aF+n5s1Xtg53qvCMrk6yqA2YwDFMulPyMVVhB03Z8IB AXBsaH4uWsjA9aDGylAv3WfIpAqBzQ4= Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-d4b74a4a6daso2620832276.2 for ; Mon, 07 Aug 2023 16:05:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449554; x=1692054354; 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=d6BZos7Ybf69Lr9ubs2a6Azcthgsxnr+LK2TqOKvMHI=; b=p8G6Pt9QZsVgDIw5B0YZsM1HO9y9fkrb/cw0HZOe9s94xOMFlEATGdftneo/KGkdaX TwSO+l67/znn0WvrOrRHHntMUuj9nNFXoTE85WKOjzGwb94eB3i84/XFPlTd02w2CLrJ DwESQ9jUYWS2DSwjhw7JNYWMJXOT94ZS609EVQWWoXQdRFNt0hhd7LN+kuo1QQmNKeS0 XHBIPjPF8dy/T4snUiw6ibSJ1ZirvD/sPtDvke5ir6zweBiFnq3ooQs72HZNE6w+OGww eTDTJaym+WVQphZfxFF+BeQU7jP4VlgJoz6RKQntFEtdMFIN0fhGKatr4Jikr9avLVk6 gEYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449554; x=1692054354; 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=d6BZos7Ybf69Lr9ubs2a6Azcthgsxnr+LK2TqOKvMHI=; b=cAAwjauDVbe6C5Dm5JU22W0C8L2+bi1WwXqEBG3/9X+jf68asbvNZlXXxCNHQn7Lap 0kdpJL/eZPg85G8SkTZ+27lbnSVC4Eobk65iJ+t8xNXL9HnzL05Dvjv6fDLAtkSkqAbM 6EyWn/5x2qs0zUo/YoAH8X6wSGZTiJwjmQLjYF1LVjd27c0V1cdq7ffjkwzK1S69Sigj MS5HfdjUOqkp6jrCw3VDXtpAPrMIu7+QRFg5BiTgZORgGg0dspiaQKssbkts1lfdhlWM 2DPH5yF/ZXP9JHMiDNZFE3zbQOgnJsjfbvCN1s+WV1oLggCGo5cR4HIb7VpE6K4oqHGI +nYQ== X-Gm-Message-State: AOJu0YwCqwPinDaxpxbDg5JopNOE/00PT1kKwzIrtwM5qZ8lNZcHV3ke tpxqEls5BYc0UbS2RHeuzzA= X-Google-Smtp-Source: AGHT+IHnEVFzuxaIlZevFxX1u5N6TSfYAnl0Ngd19zcPS1yyZn6+F2gzJTtnG1yf2qQFJp4HGPdIaw== X-Received: by 2002:a25:aea5:0:b0:d0b:fe82:8b99 with SMTP id b37-20020a25aea5000000b00d0bfe828b99mr10007354ybj.44.1691449554679; Mon, 07 Aug 2023 16:05:54 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:54 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport , Catalin Marinas Subject: [PATCH mm-unstable v9 18/31] arm64: Convert various functions to use ptdescs Date: Mon, 7 Aug 2023 16:05:00 -0700 Message-Id: <20230807230513.102486-19-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: bt9d5zq1j4esp1giefe5sdnhmedecbk4 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 93F7EA0010 X-HE-Tag: 1691449555-782409 X-HE-Meta: U2FsdGVkX19ehlnghBphAghyfS9uahfprumLF2Q47GHln9qHvu9GIITVYTsRIbVV/NKRUVzWPXCwCK9Hu6qz2NvrzL/dhml+ywdDcO28J0hzaFsVmSo/fHISBxCsQqWsKjqxoYUtFDsnlXl5THJ0RPVjwTL73wdQAxQgN5eV5B4rflpD9qEkWvUIi8DWDQGzWdcqa5eK5YzKKANJM5no8Pch56l5DUoUplN19hhovJCjZImCumEnQ/E1OD4jMhzn1gF5pOzDMoBZHu3IxGlSod5+Jv0ujeOkgwlYTvMbdNHoLm2J4FNLLtdCnFUN0YNldhEjCOMaMDm5O8jEhRy7LN2HCTmckm5TBMVbIq8LbELNIEWv4ISr2yDwuHPVLfPVe3Or2+0YlN3ESZaJlVpMr5X94u6uKHCg7M6NCziS2kG+e0HGJw6CPmBtCVYDX+iHLws+0pvuDZAlUuZN+R7P6nvfebTnZhzl8Jv39RfbzKT78EY9G0+gAfJ/4De3jhDUHiUMGgYl2ODTp0Jih/JxOSd7jYv7jC7XSIEHJrKLoF3aM/m48TCLZtQ+comhThUVqvAI8VDIDdPsGMMmcD7hWqCcfunnUd2u2P3HG0XINS9e0x6gLMfc62dZsjbkmlkls4tn5m0rxBitVYSHgTHdtFH71yHazceYRhvPIC8OGiE9gt8cRXqMqumrh/0lu3w+1IF3ZCpf8j7C3Mw7trJ5EaxWC4VSAUWm3hmcCxWiizpt02RnIMjt6D/ssj1FTDJA2WPRlabIj+gp4UT8uzfMD++AfAPptY9oK95d0/mdUivAKBy+KL1b+ovhEll+73Whcueq0/8RYVI5Ze9C27x0mkzuOKF0aZ+BywRsbuuG5AbxvL/9bbmjw1+NRDdRKa8CmMiwXIrhA1CSxt3KIAMzZ7yOJaWVr6fn9R+bSz4CojEsgI4vIWS1c4NaHVQj450AEfw1wPCnwipkrwKDN9Y XqrQ6GEo 4g24JHgO9Af5/SqrQWTqiGYjxZ8IdP2LiSQyMbZt6bTsuIXnMz0u1tT71biB8/qEc5hY8VBO5lES6qNQEymk82LVmqb7wIQIrUcrUvAdoxvk5cclnSxKMhSQC/o7KZMFFt5sw6LbnL88tnfP1VMJosLa3XgMvlM4AFn/2R4/3+aR/EE+1Fca/rsiaWjzWCIJHzwy5tygptbfNUbIopRFdhk9tZUiVR+/aKEVVacSI3frM4H8b2oW1VtKJ5BnG1I7QxGexiup1789jbtvO74IYvmqaTmBKiK54mcFiu5DbNRzKVnrNiZ7uzWpYhETk8T61LNL5WfuslaGQ7NhAMchDsHx9tbsw5Rwv6jeCe6ba/h3UcslpU35+dx3OgLN0EqfKosILbizUld7H4vW9tQ3zaVuNQFtoj4Nwqh2mNxa9vB8NvLv+qWbvAwYoSvM3LcN71cgfIAMPczRjFLHtryMpzIhoZVjYdRHNK45G3oS2qMJznylL/RQ2omciRw4/RU6ATxBNvVBxj79zq9tfC8Nmo8XwZpUmtXfUK8sp6VrDrIi0Kx5Nf2rIdFawwbrPQHbExTYCKb4payOoU72bAgiZfcMXOn86Z8bB4rzcYVb8rvecOjHEYTVMmqp6Be8+qlGuidmS5lulbUoU1Ia5WlXf94Z+fw== 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. Acked-by: Mike Rapoport (IBM) Acked-by: Catalin Marinas Signed-off-by: Vishal Moola (Oracle) --- 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 Mon Aug 7 23:05:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345303 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 52932C04A94 for ; Mon, 7 Aug 2023 23:06:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE47F940018; Mon, 7 Aug 2023 19:05:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D70DD940008; Mon, 7 Aug 2023 19:05:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE854940018; Mon, 7 Aug 2023 19:05:59 -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 B1EC4940008 for ; Mon, 7 Aug 2023 19:05:59 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 97FCB120582 for ; Mon, 7 Aug 2023 23:05:59 +0000 (UTC) X-FDA: 81098843238.04.DD20DDC Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) by imf12.hostedemail.com (Postfix) with ESMTP id C2A3140003 for ; Mon, 7 Aug 2023 23:05:57 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pCbA+Uxr; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449557; 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=H/qh+9u1BcCIl2V5thva5G2rletbRXaxfcBgzJGGgXU=; b=kLpZq1Yf/PS7JbKJ7NVGMgARGXwtBVWk4q9DAQ+SLhIXjcWkFcCY8NsAoGshY0LcjgY4pj KdvBxVcJjzFJMfRavu/9G8mo9EgH3StD7iHj4loL4iZ/Z9MSNliEiBZwoJOMk1ZWY4XMA2 u8iTp8twelEOCIJx6koEs5fNDKIKSbw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449557; a=rsa-sha256; cv=none; b=ZQilJV7xX2GISHp9wusAPNv5qog/vX+CwoL/l866FmUjaOqkd2qYiMCfXPHpqei61qyuj0 0vdVMOo7QDbqwiC+08Udc/7uN1oQoMrZt4CFbHwT7Gmds3IbBFYP1G2EIrFBUYsptYRsY8 JIlELrhe5uFLXh9APG9ghsMjQ7eF7qw= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pCbA+Uxr; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-d2b8437d825so5087652276.3 for ; Mon, 07 Aug 2023 16:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449557; x=1692054357; 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=H/qh+9u1BcCIl2V5thva5G2rletbRXaxfcBgzJGGgXU=; b=pCbA+UxrLZ96Iu/LappjpSZmLEozYOYmdO5RTxaM7BlCH20e3MEhp3Bn4lGiK7HrnF zI5vTymTyexPs2fEWKMf3YOixGPBtUiqT1+gX7fLWBa+Q9gs2M2cYtqmojJG+cqpxy8a yiuXYP2euWfRpeTnK/Ph7t69G3h70UOk68zLodvepBaU3Ub4ZFK2KFzJhB7TlCbjRGdX ie8hnx40ZzCuPRz3xDX8QGC9rAdvd3I0ubBMPCct9yJ64tgNkqrnZ4vxqqMZLVPIiaaP rYqmFrrQlxG0A3en5YH5Vcd7HyjhL8swCun/14090vxoeSz0eujRX7UW9eNuwqOQts53 n0Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449557; x=1692054357; 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=H/qh+9u1BcCIl2V5thva5G2rletbRXaxfcBgzJGGgXU=; b=GbtfG8OFhPH/x2ZsBk7jin18NpPrnoWPkMtRrDsXeSH4ebeuIZ3SVsh6KPn5czPIcy 1zPquKlGMoqk8zQNeKp3wr+fuIlY9a6C8e6lPumlkuMSL0Y0WpwXvTP+M9wIjw+ZkonQ mRxXn9K2A6AktDpzesZNgZCFMp2A7eU2DlQB19u1e5SCue7gVPrAB00gS+gF3ub+E0J6 hiYf/FGhD46kID+W9t3rwwFzAOQflVnictb8yu2GJgZWVNhE4EQb10XRJxTYi0GW1CkN vAKqmDiyEsNTt8+ftdLHg6q4LRuxC4vaNxD5C49nxvh/sjytzqNDqlr1r2qL5Ly+Huq9 9E3g== X-Gm-Message-State: AOJu0Yw11/uYwxr2R7YmlNJ4Ec/943NND3pbjuHZMFmRVgKnXe+cVCfk J7Tu59H3wtj1/GfWjEdA2bE= X-Google-Smtp-Source: AGHT+IGb7qTBQz9qcaNa56xxCbdxPZmnKDiha96eaUPQlL4XzY5YUB1UJSqCKxKHPrzOS/VVDboJfg== X-Received: by 2002:a05:6902:4c4:b0:d0f:65db:dc0e with SMTP id v4-20020a05690204c400b00d0f65dbdc0emr10052463ybs.39.1691449556886; Mon, 07 Aug 2023 16:05:56 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05: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)" , Guo Ren , Mike Rapoport Subject: [PATCH mm-unstable v9 19/31] csky: Convert __pte_free_tlb() to use ptdescs Date: Mon, 7 Aug 2023 16:05:01 -0700 Message-Id: <20230807230513.102486-20-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: 7nf6576eg96pnr13rswk9jipmunmf59j X-Rspamd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mrhB 9YWh29RPF454Y7qW8CCs/N9nVWCVvXjmJSyHHdfuzJgV8YbExv6Ti+CMv4+aNOiYbRH666e+NIspahDlmDoOjvYK57gXXHej1Nx34a/WUgzSVBfgp14XZjn4bb94JEB0xjAm77oUJUxiPvpK4fEgHvORl88pLcCPD66nmfUkiGBmWhApIVsnl1S1JF/Nx8m73L5JpB2ZZTfWzXhVAfgl4YG33L3MpdzLM+wUPq+vcyNIOPM6uY5HVJJHUJUiRVQji2zryXqVigwt+nkgk/iTgDCOK5Cyi7O1U8ZhNQjiYWU95Rs4kYx7aMz6UpjVvDxnPpS7xxPjgk6Ys40/yLcl6jePQOoq8bYeiSNRFIAM2H3HCc4QmiBhJxtzTyF+CcMvgQKP0lvdsy/OdqSXjDFBaVXUPutBpL+PT4pFfT3+DUik0wTEj/UFQRBakGdAw5LJ1PMwt27rv65N4ARq/4F3xS7s40g4zFPADOePb8R7H1Nc/lFeyGQsTK3c0j2VTTgfqjn7FVkzX3pQnswBoFwSsR9tCgkW0v3bC181208Z93BjBS1Ui0JxPkbIwjYItIoGJunAVc3UQdsHIO0tjyjIxqQEM/YNJENNm4p34kZl25Ik0fmifhpnt75WbCawvVdxqWVDVskFafAIfZE4= 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. Acked-by: Guo Ren Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 Mon Aug 7 23:05:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345304 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 D074BC001DE for ; Mon, 7 Aug 2023 23:06:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58233940019; Mon, 7 Aug 2023 19:06:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46D34940008; Mon, 7 Aug 2023 19:06:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2494D940019; Mon, 7 Aug 2023 19:06:02 -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 17F5B940008 for ; Mon, 7 Aug 2023 19:06:02 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id DE64B140597 for ; Mon, 7 Aug 2023 23:06:01 +0000 (UTC) X-FDA: 81098843322.14.13DE3B5 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by imf07.hostedemail.com (Postfix) with ESMTP id F08BE40013 for ; Mon, 7 Aug 2023 23:05:59 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=gXJTXcEv; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449560; 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=w5tIdqLMLMEIndKmulGbjbVGcWP2eiFuISuM6iDOZlQ=; b=Q8KgLjCdX+N9Yfz2dBMLurdx+ZbdNattSivImd4Mo5+ADDxzZJwkpRKmUnDG8asCQ3Gkm/ ij1B19Y8WApMp07tYbKyS3IZz90teNYXLgzh0fKkF9WLQfahsbFy3P4j8x+gPrb1LIsT3d /QiyEMa0kKNvhMNp6B6XpB3jJ3uhPQM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449560; a=rsa-sha256; cv=none; b=NcvvZ70UfsgkHExMOhPlNpbTppM8UAkZBnTYKaA70queq3xe9WiEW+i6Eh9PTpKTX+5MBY JPjgUxlYon/qfhIgh+Bca+kyS1Rwp5yWnGiuh+T1dC/wWZ1jSpDMBefQYPQfpp6pzDqQcF EFd/gNw+uO3R14sWeVB8gBImeOsa+Q4= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=gXJTXcEv; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-bc379e4c1cbso5465403276.2 for ; Mon, 07 Aug 2023 16:05:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449559; x=1692054359; 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=w5tIdqLMLMEIndKmulGbjbVGcWP2eiFuISuM6iDOZlQ=; b=gXJTXcEvyVT7IoetVDXBwB8IPw8UIwzytrLAqRYME0pNQ9C4uggCnI6RPeBYUmiABc NGa1RjP9x6Az35hUll5l4sYYgp98uBkULFey+10bJthE9R/J1BfMB4fjSuNmCpJ1YXG1 ARmLg59bINaXUvevzM80HySnkL9LRFKwNZ83rXMUa4P0U6g1vYwZDB00ToF81qaBEF1+ SCcl4G/9B02tlTVDHjLxfkMGL5hqppCgW9NlCKGjCO3XjVlW37imlXi2cPPjZHQnQLsK WyhHmorW6P7DI7CdyMJrfi88WQs4xcY1ld9fhabvXIyG+tqrpY5PfVFDlBq81eHbR+r8 HFBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449559; x=1692054359; 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=w5tIdqLMLMEIndKmulGbjbVGcWP2eiFuISuM6iDOZlQ=; b=MxRCnkDPDASsYFmDnDcAWBc5U0BnCvJmqsEGM5/qM6Vk5fc7z0vGPD7R1VtZdXRzpk YiOA+PAtwMgO9cpjvYOY/uhz4Nnhauy+KcA13gGtZxKEgSRqATyD/MFMZsO2rfttVWPe C8ipio9ysHOE+/oCh/ht2mKM1nedvMGgqkFrKbxen1OHCqxi3XegK6w+VtZc1/Z06det vYW5StykHrL5k2fSolcenF3JogitNcNUtj5jxlBSD5w249K6vB3nlRO9f/dHc9fBhMVD v8H9JREeN9ER/816RuCYdTdqpmpMlOVh/qSPC8JGuMNBglpXbrNO50s0MpNWZH6fRDQi qYZQ== X-Gm-Message-State: AOJu0YxvLniTrKLj1SHVu/OFrR71CqzpurI+U6kCTp2SLXhJF226ui47 33V597TE3NNLYQwAOBgMvuqd7aZD1V278Q== X-Google-Smtp-Source: AGHT+IHgbeu9fOmMS+FNlr/kvyOX24cSJUZ4nRlF6aWfNWe7W/NjYriU1Zmx+jVELg0QXXl18qiXKg== X-Received: by 2002:a25:4b81:0:b0:d4b:ec36:bb85 with SMTP id y123-20020a254b81000000b00d4bec36bb85mr7290071yba.50.1691449559015; Mon, 07 Aug 2023 16:05:59 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05: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)" , Mike Rapoport Subject: [PATCH mm-unstable v9 20/31] hexagon: Convert __pte_free_tlb() to use ptdescs Date: Mon, 7 Aug 2023 16:05:02 -0700 Message-Id: <20230807230513.102486-21-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: F08BE40013 X-Rspam-User: X-Stat-Signature: tidgb8cwif1q3tg3d39493q54a94myiy X-Rspamd-Server: rspam03 X-HE-Tag: 1691449559-397364 X-HE-Meta: U2FsdGVkX19sNI6sI4U9aq2AmRO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fzfhCtwVWVlufQfvjk5EafaBsOGK6+cb2Lw5vWdpjz7j/Nudtk2N2bd3yWV83xbRBFELdi+PYvfxVUaJlVJqBAEMXjSyMNoREMq9SJxLYES62yfFt3MrSuAJ3FsZ68LdTEJYKgEHiRJqnm6X+yQuj4kVEZTfZrgHzC6PestLx+ayE0XcGTwzM7YkfL+7sX242Yr32ffRb7VZ8kreSZ6R1sHMk5OqKjBR2ty2C9FfFJFOyPXGS9uolgnBoNOgyGQhXKrOQKNbVelG1lxzjKSBcluEtUEcT4rVCpY0LTJ+AkWifuuLt0ihh6Au310g8TPVvtNf6vJWkyWsoZATU0ypk+QWZ28Z3PAIvGCGx7dGPQ5dk5UiMrdCPeEhF896ZY5jCFDVFPAaPNGc5XIgXO0nIPb/7dC/0utCFoGpW1Wj5Xl5R6ys6GoG/q+m5GrnYN+P8+oM+oqiFulPO2piUl3h+ddiUw4JJzIDoMwneo5b/HXbib5KAorYYnXeL/DrVz7nhfGTy9n2KrEl1iZjii1hncuvZSay0= 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 Mon Aug 7 23:05:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345305 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 376B2C001B0 for ; Mon, 7 Aug 2023 23:06:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 384F394001A; Mon, 7 Aug 2023 19:06:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C273940008; Mon, 7 Aug 2023 19:06:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF5A694001A; Mon, 7 Aug 2023 19:06:04 -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 DCF3C940008 for ; Mon, 7 Aug 2023 19:06:04 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D8203C06F0 for ; Mon, 7 Aug 2023 23:06:03 +0000 (UTC) X-FDA: 81098843406.23.1BFD15C Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf24.hostedemail.com (Postfix) with ESMTP id 1267C180005 for ; Mon, 7 Aug 2023 23:06:01 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KaA5Xf0Z; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449562; 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=VD2saKmHCgP979K/4Ur2DZD5lv+pCsAy+26MDZ4lRXE=; b=qT2KpSaibNi/inRbyJWqQS7ensZOd+HWux6KZHZbjdKvrD74ji4xlr7ir3Kcpq+JI9b9at EuxDjuPmN2uaFPHSZYYv6W5GE62u6/++faHDaeNb//WZdmY+RoGPjTm821fcZ3UA+zXltb Z7vEm4J5AWsDoqOiscoXQTQRMAWEXGQ= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KaA5Xf0Z; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449562; a=rsa-sha256; cv=none; b=i6Jz+Y6Wo7cEvnnzZIz80nSFOg2pNAETnp6V8xKMKiWt7iAqjzURvSYQmBwARcSluFOHPG sCO/aQhPvpR99UUDsWbSnHf6aOYN7JsKHWAJRr9AL5QaY7ErB6GMnzmLbX3SZWk9LrXKwQ /qQ/y4juqXw3826ApgRjzlv4s/DdJhI= Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-bc379e4c1cbso5465423276.2 for ; Mon, 07 Aug 2023 16:06:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449561; x=1692054361; 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=VD2saKmHCgP979K/4Ur2DZD5lv+pCsAy+26MDZ4lRXE=; b=KaA5Xf0Zq7VankK3QOvVnhKCvDQA0idGZ5r/QtBaYpBUZhM7IUDDnipX0Mck9NuTr6 FMzfUiWHWV61utAYtiNJjvsmZyQrjEGqV1vWWuYtjGooZk9wKA6pHj8JXiEh77Vd66gm gq9wCdtohtsBXI+QiM0g5DM3RYb5yVm35tcAKNI7nQZaFVODWjyuyXisRnjCevekbcDp QweW3qBvEiOtjGdP8+KO+Ai79xaww40f8oFcpzIoZ31G0t7vkt4E3RfT7Asw6Y6mNUmW 4v5tgaFeOHT3yezqwQ6Pv7HkjczS8wtW/o3vWALkNkC7/L83lM6ERIvU0onlnalg95pZ XQOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449561; x=1692054361; 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=VD2saKmHCgP979K/4Ur2DZD5lv+pCsAy+26MDZ4lRXE=; b=V3VX+C+wZd9emYutdJJ0SXX3xVtbf7IJOsnlZQ0qZu6yH+BE0vx6KCa4I53yeqCPs9 8Plx6gw3gtvjJz9wV6fvN4DHlOIz7hnJm0owWpzVIBCIgwP1azWBnUuX6CURBIMJD0eF zUXDe/0YxG+JqlUSm6LwEeB0PqfIT8Ck7zxdHUCN9U3qKv3nQT3WBqZiE8RER5r8AnRZ hwH24RoQLDJu3Hr54OvgSCFGeImgik8ipDR42dF9eEkdRW5/t3IQtpWn1c4hyTQzZaiN IvFx5hJu/6RHjoZqkDZQlSoVEVOm5REvVHpqqSVmhAIrx+GiMsNuuNXeWjhF9WUAYob6 Ix4g== X-Gm-Message-State: AOJu0YxGm7OiHVHbwYU4oqE/v8SQfl1i1COL5nOyIzsxXSENYKlTOMDr W7sFrsZT1ifcvt0I+5vRoWU= X-Google-Smtp-Source: AGHT+IGT7jcZ858GNZbGv2ymKyHkNCq6k2xr+zx9+OdmxVuwoAhnOKduGJp0I6ObmWSEyVKiLNM8sw== X-Received: by 2002:a25:8210:0:b0:d39:fa2f:8b63 with SMTP id q16-20020a258210000000b00d39fa2f8b63mr13670853ybk.25.1691449561057; Mon, 07 Aug 2023 16:06:01 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:06: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)" , Huacai Chen , Mike Rapoport Subject: [PATCH mm-unstable v9 21/31] loongarch: Convert various functions to use ptdescs Date: Mon, 7 Aug 2023 16:05:03 -0700 Message-Id: <20230807230513.102486-22-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 1267C180005 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 3gr4p4yn977zabikmb1f6b9o9yhdpct6 X-HE-Tag: 1691449561-937266 X-HE-Meta: U2FsdGVkX1+X0PGiD7UsTFfsVsQj8fBKFNcGdEKd6Kqrz32t+0Rw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TuJTc9Pj4L3R5kEr8EGxk4rW15aP0YI9MYEONCFO9YMbyyouGqg7s2xrcanUSVW2gn5XLwr2z7DMlLtQhC16PPfzQFFnqIZ57/WKiK4bZ4Y0RRG431qXLF8q9PNzmGslg7Ak8+OOe29F0253a5dXeNwgoMcmQ8KabBZ1PpSMZuxyBm1EB4BhIP9yn0bhod8UF8G7vecKljPd2nLvwyS1Vul4B9EDvV9QBY8vrr2OpyzzDkTkRywAgFzJIQnAiNiZ3CsnIe7EWjSU0cBFXGXm35e7ji1+b+UsGBltowxfk6cLsSEYz4ipsHtOxzZGDCfav0W3S8O0xKjit0tmrWkS1UINNi1SDcKoNLt6WdN6sr8ypa4MBWwh+d8QKgbVN6obMluF0aB//zBZj/TbpaLLTQA8HXcBObcH68WoHBLi6VCCKJwa0EKz9OeFEH8mY/wzE0mA== 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 1260cf30e3ee..b14343e211b6 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 Mon Aug 7 23:05:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345306 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 C4A0EC04FE1 for ; Mon, 7 Aug 2023 23:06:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 581A694001B; Mon, 7 Aug 2023 19:06:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 49349940008; Mon, 7 Aug 2023 19:06:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2717F94001B; Mon, 7 Aug 2023 19:06:06 -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 11759940008 for ; Mon, 7 Aug 2023 19:06:06 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D4F47807F4 for ; Mon, 7 Aug 2023 23:06:05 +0000 (UTC) X-FDA: 81098843490.04.03A995B Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf05.hostedemail.com (Postfix) with ESMTP id 0B2AF10000B for ; Mon, 7 Aug 2023 23:06:03 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OTPDdNMz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449564; 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=b5UN203jFDiNo/YHJ5VSjgxwvcpHMPrLplz2RQSMCvk=; b=QcJ80fUIr/RSIUFu8On9BxvcQAVxE0cWJKoOWrgUMCgngiE/MvCXXbyhxxXLiy034FvxMw c2fnt82eCmsSE7FjIM98MtS+7Nc7HMcVipm6TtBk4cHhLTacIQWE9yS5n9E9d6437kLjs/ ghBIbRMb3RR1/5Tk5JXa/rd1yCqXbpY= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OTPDdNMz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449564; a=rsa-sha256; cv=none; b=V4DTX5xeopSWp9HSh66cyrKq6RsUHkQ+9BklFafGmOb8j8pPIiHCOqo1vahRoFqzahQg/W nWnSgP8In4Bd58L8Y6EQp2Ww+Vz0GoSch0U2XpArrhrzL5G4busxX+pFKnxo2W4R9KaC4v FICPDdFz8mycuAue0GRqK1d4mZEwMAs= Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-c5f98fc4237so4187767276.2 for ; Mon, 07 Aug 2023 16:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449563; x=1692054363; 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=b5UN203jFDiNo/YHJ5VSjgxwvcpHMPrLplz2RQSMCvk=; b=OTPDdNMzu7YNnKXhv+Q3ZqqlENNm5aYdj6D71YWlelfDeuCfloDRpvW/2blg63fLEM wp2lqLun+gv7jM76tgF3SL5EUSik6EQoGHQg/la3vssrqrbUd6clAJJZm9oTnkSFnW3p rrak3TkX2TlgthUOthGhnmNqe2u92uklZfoOWmy63Mi41aONrji7aHLiDQehYWfjAdaZ soPZkqDTfcWv3Jopxt6sr0srYUxYWkTWEBaSK7GkVRhdyRSTtqcke1kGItccZqtqhkia YtUOs+TmHqOaN+5n3hq45fmviaiyb+cOIccc/DlZdoNJ1+R3sKq7dO2/Ljgq8Rru35Tt Yo/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449563; x=1692054363; 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=b5UN203jFDiNo/YHJ5VSjgxwvcpHMPrLplz2RQSMCvk=; b=H8ZGLPf/CzMevfJ7AbCkWXVz76ksJjhDKKVTmF6OOBwUZo7ieqQiFgiipDqodbn7bX Q/IL4sSfn+W+VgnnE3f3RGUCvbMTHhY61EfZkt3acqKvYz/nfLoE4Yux/6fjdkHtToIx fhphezsPgdnVZ+bRkh02+GlFyOml0nKWZBXk+w8zwb6nJ+1MhXSXN9ElsZVWlrF/iUYe 3qkSe7QQVelpoF/IoT4+g6pRhHnFrUhTF8ZfeJnc0WtoOYYx1HtNcAa0EOCOn33FGPCt LeSMGT9GqCZRZklqBS9Wnur0gyWf6OU/GzZ+0N/30hEWe2woW+rhWfgI+TA0UnJ9tS7z 61tA== X-Gm-Message-State: AOJu0YyDbHACBHQz7+IeHR2EhdOCtUWaWOy+46qmg8wY84viQO3iKzaT koqdaYDK9hDD8+ixcjL23KQ= X-Google-Smtp-Source: AGHT+IGso2idiavqhjdtI0le+b51Epzt0Ore5+PmjI6n65mRaKN/pRbN2Fu2wELJlR9Tq3E7Uha1dg== X-Received: by 2002:a25:be08:0:b0:d0e:2e5c:2f80 with SMTP id h8-20020a25be08000000b00d0e2e5c2f80mr8938705ybk.64.1691449563064; Mon, 07 Aug 2023 16:06:03 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:06: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 , Geert Uytterhoeven Subject: [PATCH mm-unstable v9 22/31] m68k: Convert various functions to use ptdescs Date: Mon, 7 Aug 2023 16:05:04 -0700 Message-Id: <20230807230513.102486-23-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: k1hjbfrya689noxw5bbjj9jrjp56kbit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0B2AF10000B X-HE-Tag: 1691449563-679547 X-HE-Meta: U2FsdGVkX18JGpKWWxix81aMLr7+iwoEj8xcJN7ZmIytZmB9cIm9TMKcpoSknq4Kw/R1TPWHnpDNjkPPkpngc731T2TaLlqI4pxyXoXXU6okr50SMk156f7ODyRy1TRXYaXWhVIGBQZdeJuicB/xzPnQOkj4W5pSIqMhP8XjbxGOCAhQLRAU7eLkI16BfsIc6Vq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PgC4n+lflpM83F3Omp54bTssHGFI+xk/LEyYJzlNqUyU6ueRCmjrSDqSGgFt4duWI7PKUBgicaHC8LdGl2HwObNYJqHu9TiYO/zKhTXq5AhXojTlzaLgohE7vZo08+d6PxSq+4l++pwxjJ8wl6HguAYbTphUvOQNsXg/TX22CkZpzC/kOPBJxo4dJuo3HGNUMEy9Tl3u7PUo4x3Kt48vgvPkDNf4fFuwXitDMCcP6GkqTVTaSF0tZskLkHlTceZ0CMLNG++DOyty5Bfa1yDD8rqBi5F6wlUYLDvow6ANkcijMOcdASf2ciYhZkAi9qdy2gFMpcn6oTp80+Rnjp4rCh/hyjIQOa1aC4pU4FNKbwxnj2jbcz4846aRpIk05w== 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. Acked-by: Mike Rapoport (IBM) Acked-by: Geert Uytterhoeven Signed-off-by: Vishal Moola (Oracle) --- arch/m68k/include/asm/mcf_pgalloc.h | 47 ++++++++++++++-------------- arch/m68k/include/asm/sun3_pgalloc.h | 8 ++--- arch/m68k/mm/motorola.c | 4 +-- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h index 5c2c0a864524..302c5bf67179 100644 --- a/arch/m68k/include/asm/mcf_pgalloc.h +++ b/arch/m68k/include/asm/mcf_pgalloc.h @@ -5,22 +5,22 @@ #include #include -extern inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) +static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) { - free_page((unsigned long) pte); + pagetable_free(virt_to_ptdesc(pte)); } extern const char bad_pmd_string[]; -extern inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) +static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) { - unsigned long page = __get_free_page(GFP_DMA); + struct ptdesc *ptdesc = pagetable_alloc((GFP_DMA | __GFP_ZERO) & + ~__GFP_HIGHMEM, 0); - if (!page) + if (!ptdesc) return NULL; - memset((void *)page, 0, PAGE_SIZE); - return (pte_t *) (page); + return ptdesc_address(ptdesc); } extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) @@ -35,36 +35,34 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable, unsigned long address) { - struct page *page = virt_to_page(pgtable); + struct ptdesc *ptdesc = virt_to_ptdesc(pgtable); - pgtable_pte_page_dtor(page); - __free_page(page); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } static inline pgtable_t pte_alloc_one(struct mm_struct *mm) { - struct page *page = alloc_pages(GFP_DMA, 0); + struct ptdesc *ptdesc = pagetable_alloc(GFP_DMA | __GFP_ZERO, 0); pte_t *pte; - if (!page) + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - pte = page_address(page); - clear_page(pte); - + pte = ptdesc_address(ptdesc); return pte; } static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable) { - struct page *page = virt_to_page(pgtable); + struct ptdesc *ptdesc = virt_to_ptdesc(pgtable); - pgtable_pte_page_dtor(page); - __free_page(page); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } /* @@ -75,16 +73,19 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable) static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { - free_page((unsigned long) pgd); + pagetable_free(virt_to_ptdesc(pgd)); } static inline pgd_t *pgd_alloc(struct mm_struct *mm) { pgd_t *new_pgd; + struct ptdesc *ptdesc = pagetable_alloc((GFP_DMA | __GFP_NOWARN) & + ~__GFP_HIGHMEM, 0); - new_pgd = (pgd_t *)__get_free_page(GFP_DMA | __GFP_NOWARN); - if (!new_pgd) + if (!ptdesc) return NULL; + new_pgd = ptdesc_address(ptdesc); + memcpy(new_pgd, swapper_pg_dir, PTRS_PER_PGD * sizeof(pgd_t)); memset(new_pgd, 0, PAGE_OFFSET >> PGDIR_SHIFT); return new_pgd; diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h index 198036aff519..ff48573db2c0 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h @@ -17,10 +17,10 @@ extern const char bad_pmd_string[]; -#define __pte_free_tlb(tlb,pte,addr) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index 8bca46e51e94..c1761d309fc6 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 Mon Aug 7 23:05:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345307 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 8F9A7C07E8E for ; Mon, 7 Aug 2023 23:06:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C9C194001C; Mon, 7 Aug 2023 19:06:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 753DF940008; Mon, 7 Aug 2023 19:06:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 556CC94001C; Mon, 7 Aug 2023 19:06:08 -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 39BD7940008 for ; Mon, 7 Aug 2023 19:06:08 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 188381402D8 for ; Mon, 7 Aug 2023 23:06:08 +0000 (UTC) X-FDA: 81098843616.08.C48A7E0 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf02.hostedemail.com (Postfix) with ESMTP id 422BB8001D for ; Mon, 7 Aug 2023 23:06:06 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UEUmdRWy; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.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=1691449566; 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=SCvcoKWLGx6gAjym9VWVFszZElqPM/KxU0nQCUs9lhU=; b=ixmSkTYY2EMGjtE+I+VOcd6mTPCTzvQIqidQakUf7jnDVdMBhjpbkdAGg2x0c9wGQ11CDH noGIIAQzoyAQcuf7Cbz2qUii7l0RvuIzjowcL5mNcM26IwqRGhmTr7peIjk93LyckzQ8g8 7J1oVFiwIxVfJNX1ohdvu6qJyiRw+W8= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UEUmdRWy; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.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=1691449566; a=rsa-sha256; cv=none; b=G9z2Getcl//n+6/Fs+6TmCq4USMhXYNqK7L3fedNZ7LZUu9RQ3NeSrzuCaNB1QzL+2EMXl aufkfY2/BrRblyw7FyA4PAjsdVTa+AOr8ZVmwBfsT0VWBc/RMQBec2W3b3iyDax3R/dw+N xM9oyzU9+oGAnx/QHYf693dVpHe7+Ng= Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-d13e0bfbbcfso7271414276.0 for ; Mon, 07 Aug 2023 16:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449565; x=1692054365; 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=SCvcoKWLGx6gAjym9VWVFszZElqPM/KxU0nQCUs9lhU=; b=UEUmdRWyflXklFyhNX736vuEaqgiuaE747b2iDMdbsntaDVnz91uxqlH5BcdgyOH5x uvJaTvPkpQGN9akIqApZ8zKHvLZguej6njtjOnVMX/cM5jmsFezl/LYYVYVkbeho4b0z HHNTILzp+Xc4v6kzsuUo73oAPiN0CJazQDUAwcPLlet/lIEFQgMVrv8B24qA6Hz5wjkw b8w6Ifa5zhm6L11dsVrnJ9eA4XJTM6QxI5QWilhFcSjtgNKdoGywloLoSOAO6BZpBMSb 8CiRrKjceUBw/RGFjWiyE5TzR9GZJ5T3ThAn9ujnfgeZbAfe+0n8PqgNKPCIQtpGYCsJ QRzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449565; x=1692054365; 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=SCvcoKWLGx6gAjym9VWVFszZElqPM/KxU0nQCUs9lhU=; b=FCpY5gyispcCvhK0rSChFmaDUTvI6WhoY8G72R01xkM2ZoScmbzM/pt2W55U3VpZP/ omKm1fuIcdrvEKSXvoOnN0YENqidkGjIBle6jKzwmtcBcF9S370vcsheI2be6Ahw+BfW qz2w9W20CgLBBN3o6GR7GHe5F8DLeKFi+xSkSOabB5VMg7865YCGs+QvvcZJ8AXFfm6M eDb047XWAjFEnG9vMgZwwk2D8jLTi3916L/BpVZoXoB9NBX/PsxEh1AShog8OtfsDe38 nI9hBbN2iiX06aGVC2DJcV6WLiIA/ICyp1gWkwuPOCvCpB6gCpmPsCBiv/fc08xRDjRE do3w== X-Gm-Message-State: AOJu0YxUWRsRMiE8WrjREk03uxiJOYLiUPioQo3lvhuB7LtBsJafeqV5 zoADPqwhE/+cAQFk8KoWBH0= X-Google-Smtp-Source: AGHT+IEqzmUPQsWPkdBtUj3V9QXK122J73o4hp/g5UvHeQgKIN7qrVubtY48PFSpogl4MBW4UXPeVQ== X-Received: by 2002:a25:944:0:b0:cb4:6167:a69c with SMTP id u4-20020a250944000000b00cb46167a69cmr9868214ybm.8.1691449565251; Mon, 07 Aug 2023 16:06:05 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:06: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)" , Thomas Bogendoerfer , Mike Rapoport Subject: [PATCH mm-unstable v9 23/31] mips: Convert various functions to use ptdescs Date: Mon, 7 Aug 2023 16:05:05 -0700 Message-Id: <20230807230513.102486-24-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 15pco3rgzo834npnbfyz5bzhfni36dym X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 422BB8001D X-HE-Tag: 1691449566-378980 X-HE-Meta: U2FsdGVkX1/o7KDK7deg9y5p1L3tJD5S66/Ki6EIUbcy2f/bF/3yy2YtFIaHFEl50FuMAvJIWmmdmSCvFIQ39SVh7YOkgeMWzG9jMRLYyekpezUtr408hG2atrhGT2HvgtOvrqnGbjFjUmnLZHWnokffjvHN1oi19pDyFAbpTy0uz0A9QHg0b9L85byA5taOKtjJjIKCjw3IosU7qt78KzZG1PiTJk5i2Opj9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w435NWUKaHJCvCRb6ObbKk2ifN/ZI/Xj9ugHQ9naSCtreEuJO1QQ+94i9R65/+CsF8kM9Fs5j+HkV0gVczP7qw7LbO1nwGyYNQwLLwQyS28O8ZOpDKwCSIfrBa5EgK2npubzm2M8QHxwhtrCCsB7NTTScy5B8ujB8kArPuAc/JsM42qDMy/jr3+XAaH+dLBPOI6/0qeF3bNYfz9+lzkg/qSumWP/IykH8H+Hz4ScotlpAMM1ESX4BO3B33E6otZ0VPubOrjCZaOObXfmi0C36diLiIsD3DCw== 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 Mon Aug 7 23:05:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345308 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 6D392C001DE for ; Mon, 7 Aug 2023 23:06:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F01A94001D; Mon, 7 Aug 2023 19:06:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 779D1940008; Mon, 7 Aug 2023 19:06:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A59794001D; Mon, 7 Aug 2023 19:06:10 -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 3511D940008 for ; Mon, 7 Aug 2023 19:06:10 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 11209120A5D for ; Mon, 7 Aug 2023 23:06:10 +0000 (UTC) X-FDA: 81098843700.13.C739927 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf09.hostedemail.com (Postfix) with ESMTP id 36A68140025 for ; Mon, 7 Aug 2023 23:06:08 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=W+7e7ZXA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.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=1691449568; 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=Ke0Z6VjA86Q0iJYCAtHmQzMGt2iXqJZdkl8QiQF9dCo=; b=A+KhYiHA2+SFacZL2PZ14Aru2eHrsmSHLjQnljlgBkINhDVSJBEJmUbMeudKq2oWeIEki+ rCyZaAUbE1lvY/BbJ1WzhILTj4ewznXJa8nDBI6O0s6N4J0lmeMNPIC0/UcoU7WMz+f2A8 SIP8amQLkPNQJP2xc+kV0dxb0S38Nb8= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=W+7e7ZXA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.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=1691449568; a=rsa-sha256; cv=none; b=j7hTBbykeoRyna3JoKpCzY/3Qj4XZoa3KeupnWl3ljUaOfdrfSayAfzEsqlrZySoH0Ospt 8xVpRQ9rMb0gWqwNRLiykewaOy8m9g0I5LwB3u8hleFEPGSa41hvuwwwq1wb2hCC8jX9xm /x3hxzCiY35qmhXFCSkppQEtwhWiOjw= Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-d465b3d50efso2114230276.1 for ; Mon, 07 Aug 2023 16:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449567; x=1692054367; 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=Ke0Z6VjA86Q0iJYCAtHmQzMGt2iXqJZdkl8QiQF9dCo=; b=W+7e7ZXA6pq6bkOdiU4kqXMdaRoaFiJYq1YjNheTen2BEAKrJsHyDCwylC8TwIaELf OoOeKnKEm2Bup1E3lQkfzBFhNx4UEQeZdbP6gFS8EtHNx1s6wSSR8pJNy131BEuCYsID 5yHclRtlDqB0YUpxc8mp/j3duvqB/kcSwVKs7titgSAxTd3bahGpDvqB1s5BR/l1Q8b5 JJTz17F1sukT0v2fD4c6TeVfoKxL+4R8ZKOAgjggAvDHXskwAwGz/9+hK5mkw3BMis+2 8wcIPPvCrUvFi8Oxcy9SzYIpq7haNxXeYlICDRNRlufgVcr5TYo9K2btnO8SAcdlpPvp 77sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449567; x=1692054367; 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=Ke0Z6VjA86Q0iJYCAtHmQzMGt2iXqJZdkl8QiQF9dCo=; b=aN6XKk0iczS/uI3nVYUozbifjUZm6pW/zJu10ON9SJ44fPGzsAIG84CI1JcU8gATOA QJeYRbxqLdn7Gdry5vpB/xC5+TzJYcd3oDjDsGuStzeLzNyOsWiV5KPwYy5X+xvWSawa /jXIDMCyTr+Uzu1yMiceEk5ZMtS4+r0UNgvZOxOiQDjem70/D4om6hthaLNwsEfE3+8n 8vvm8uOw7afFfyIcv8kTiVk5hbLYpQl3tRXLgf0GjeZFokTia/8mnE20ekbEc4iu2oFk gWw7yyAjMKor+2uuz7abHXU9q2mU/zuE/x8/at94k76n81jKjvHvmH8f1zoBWpwwzMaJ FJjQ== X-Gm-Message-State: AOJu0YyZ/2yVSDInJHlyKyDpS09/JoMhb9hDyyZ7tj9o99KfvJU8tJpX cM7Llduz7XxuJq9Xx/wqB1k= X-Google-Smtp-Source: AGHT+IEFwZzf7hWzCaDcJ0rf5o011LKpXcZZ+QgyAwbXtivToV2K1Z3qkIAZZunAX4r/XJQivv3Vpw== X-Received: by 2002:a25:29c2:0:b0:d4c:f456:d562 with SMTP id p185-20020a2529c2000000b00d4cf456d562mr4842541ybp.1.1691449567341; Mon, 07 Aug 2023 16:06:07 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:06:07 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport , Dinh Nguyen Subject: [PATCH mm-unstable v9 24/31] nios2: Convert __pte_free_tlb() to use ptdescs Date: Mon, 7 Aug 2023 16:05:06 -0700 Message-Id: <20230807230513.102486-25-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 36A68140025 X-Stat-Signature: 88fswdej3as6wogp516e5dpkigtwcuow X-Rspam-User: X-HE-Tag: 1691449568-4511 X-HE-Meta: U2FsdGVkX199uQA5sRwvq4gsyN7G+kOtBDsQBb9mVR2yX7suWwXQN3b6E08XLOn4TDZu0UNo1XyrAtochVCVj/ts5PqhDtScioWJ/oQUJm3Sb6FxSWBFd2ZJh4qud2gbusHCVH+CJlzfLZOc3zusheBMF12kyf2RgOS2+a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ia1Gg+5T1+4h+Ahe16s/LqJFZyqCdhGwEvcGfbRhw1bE86MLmxfFCXf9uoqjtCXWSDXgleExsfWnMeUwkRn4vU3Mx6T5U99yMUezq7zsfjXr9Z8dvZonhvL2s+D3RkA24zLUl6PHq3yBGXj+1aQeV9vRzX3y09Ztc7wKi5aO/Dip45f564YqPFlAPPfL/biuCPTCNIkY0khlYwZ8kg77LuK5RtBYfeLRRUEDRycO1ctU46mY217x5AnQgO//m6lsns0qPF2uP8cLu/EkDE5RCUaPOi/U/hMicnCjYZ3DeHnVDHThsi4C9Y4W9OHSujcfA/lSleWhQpXZitLZUPaO9/MYXT55j4g154ihatBIMyqT9xHIxyMyCcg1m+OrwbluChqPHG7SNu0gY= 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. Acked-by: Mike Rapoport (IBM) Acked-by: Dinh Nguyen Signed-off-by: Vishal Moola (Oracle) --- 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 Mon Aug 7 23:05:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345309 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 6579BC04A94 for ; Mon, 7 Aug 2023 23:06:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF9E594001E; Mon, 7 Aug 2023 19:06:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C8228940008; Mon, 7 Aug 2023 19:06:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A607E94001E; Mon, 7 Aug 2023 19:06:12 -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 8A73F940008 for ; Mon, 7 Aug 2023 19:06:12 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 64795A02A3 for ; Mon, 7 Aug 2023 23:06:12 +0000 (UTC) X-FDA: 81098843784.18.DA59AC8 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) by imf13.hostedemail.com (Postfix) with ESMTP id 916DF2002D for ; Mon, 7 Aug 2023 23:06:10 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GmyaVraw; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449570; 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=8XaHpTf3P/utbT17OPG/H5MolPsiYyRMVXSdV5AvoHU=; b=EQpPTz8QeFvE111nUPrPsGW+zQOTjn1IB2/Nrg2+NJC/ZA+L2GjbYEeuE9LqHCr61+uMfD 77ciAiFLy0sJYGUYZy/SkjfGdg0+iK+N6Fyx0/f0eVhzIYbRxiCaGhR+G6hW2s8xsJ6nYw vIfeOQ4e9psWyT+GoP6A9tCA4/pLl90= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449570; a=rsa-sha256; cv=none; b=cs6aRcTkIzmHdUvP8Hibhw7mS8eI6YzUnuYPvyaFpHi3C7bDAlmbcz/PeCjwrJyv1UNqOv TuWRZmzqovzWLIFLLaWNJUj0NkigF0rgbM1ia/wM56zqU52qj+nrysa2U/oqOCfnHF6rW4 Bu3rqdWP15O+8thNPfMroMw5l8KO+MI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GmyaVraw; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3a6f3ef3155so3973632b6e.1 for ; Mon, 07 Aug 2023 16:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449570; x=1692054370; 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=8XaHpTf3P/utbT17OPG/H5MolPsiYyRMVXSdV5AvoHU=; b=GmyaVrawFabDS7oM/FJ2wsqOTnvNiSZkWHllyllBSGtBhNSpEmhqjU2xmr+48gvMwO LUXnCk58UhmfTImv2R4R9LNF0+WlzxXIVQ4Y7ZC5fEeHoGrn0o/ogRSADB0Y+NluFrtN MrrlZ4Lz/gi5878wRIWP06wgFFKVx+8i+ghKFpBHekPx9T0p+3sqj2xh34rznNB4nw+U O7FH+uzt41O2vvO9FAauF/idvM9r4rw7Q35Wwsa8GbYTT2MLxcQcKcfZ8291m/c55wrV URc64VPnBpaXKs/Bni+oDqsCjGnYy/ppZbjbVbnispVrc0PlqosfX2g85SuErvT0W1h1 o3sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449570; x=1692054370; 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=8XaHpTf3P/utbT17OPG/H5MolPsiYyRMVXSdV5AvoHU=; b=EWg4LQGzVBXRi0o3X2uThsWiXh1iFXf2ofXXV3hQGAweVdVl+eynxO7Q4ZV5gvwwhN zb4WFUXfmt6AW68iUS+rm3vmDeThU0AnWEN7ZBp4yFb9eYG3MTI8p0vflu7iP+rKEDAJ BY5KyQKJS0x5hKBucr06jFP895BFr/RkYRBElHmHdFo/bj2bzIZ0M3ESplpli5oOxjGU YsYlP42r8eUrYmYOcg2GdCvB+LKskwTBWwtANltpAtxQNZY726MLFCX2lnCk4COdlZmT FnKf+QWAIylzTDzFcCy6QL9czcivEZAQmM7lKNpf7pK6acnvnnZO4lVK8d6PrM/ZggNw 4z5A== X-Gm-Message-State: AOJu0YypDzOEkBK2orxWd9kR7l5ZLtBobhaJM5QHfG0XG9olh0cl7xXR xywc07Enya/JN3DMwxyppOU= X-Google-Smtp-Source: AGHT+IFfR71b5uGC/N7nUJvkV7EEf+q4ZrD/2jbgt4p5+XAZUesJuHroaMR2T6Qu+08oLKK4OIq5Tg== X-Received: by 2002:a05:6808:1997:b0:3a7:5314:e55e with SMTP id bj23-20020a056808199700b003a75314e55emr14747526oib.24.1691449569767; Mon, 07 Aug 2023 16:06:09 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.06.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:06:09 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Jonas Bonn , Mike Rapoport Subject: [PATCH mm-unstable v9 25/31] openrisc: Convert __pte_free_tlb() to use ptdescs Date: Mon, 7 Aug 2023 16:05:07 -0700 Message-Id: <20230807230513.102486-26-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 916DF2002D X-Rspam-User: X-Stat-Signature: 8q966pwmkkiqz5h7e7ung4pyi1trqs9z X-Rspamd-Server: rspam03 X-HE-Tag: 1691449570-449722 X-HE-Meta: U2FsdGVkX19vTazPcRfsZyNQMVIWYTMruYifj3yh/wdS1Jf4k5XbU2NdWqaNYzaz9lZGj9I5rpU4qG/KpbnhwuJUtZSio6/IwzjUJ/GRZfGpV6QMBuUyL75eQjOgMAggFkc9iIUVyDbGp5awdYXyMUVkamx3WR91/wXzrIMlCLfSSPSi2wkW/qMIRp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D9FT3MlhqiQKFBTGFTUKVJLrXVZkFKRkfb5dxCOYYHyAaYw8Kt7KUf44r6NyOvDd72LlPVG9H7i2mBlxtTLevl4qv4R/ogrBshqAlIQecP4kzYg38s2h0jTeg0p4k58R2r5EsY9HYjvPP3pTnqlu8QNYJ4srYuIkop0DVL8yIc9aH/uGXx2vgT2/Bi0Pyr08HeI8sUUkFctZLwO7RUg8wIKGxV1GFHiCn/DMLaOVhHXkaZvPHYcQtkQ6FszauCPL4qEdA11qJdVF+ZkIHO8sNy/QUyR5NaBmddRS+8/1E8CKdOUwHLcLXdzJhUDVMq8/Hj11hRd1qKdDVT0Nsf67UpwyYZJdASHwxIW10HgHwPMIdzEN2Txchbg= 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 Mon Aug 7 23:05:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345310 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 7A927C04FDF for ; Mon, 7 Aug 2023 23:06:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 200E794001F; Mon, 7 Aug 2023 19:06:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 113A6940008; Mon, 7 Aug 2023 19:06:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECCDD94001F; Mon, 7 Aug 2023 19:06:14 -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 CEB48940008 for ; Mon, 7 Aug 2023 19:06:14 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A55FF8025D for ; Mon, 7 Aug 2023 23:06:14 +0000 (UTC) X-FDA: 81098843868.19.AA01B7A Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf09.hostedemail.com (Postfix) with ESMTP id C1CAD140010 for ; Mon, 7 Aug 2023 23:06:12 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=nS5J1UYk; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.176 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=1691449572; a=rsa-sha256; cv=none; b=5tfE/ryK35dBzkW7a2tyYZS+fVJGFJDAPPZ6wAgdh1aSHU1wnXudxR2BiCds6x8v0Hg6nz 0wj123VwA37+mtdV1lwVmD9SRqdZOemTAP0mYHa/aL57/DOY7DBHjKInjjMN7smnYDJvYe /xc0Kmx1WGDSKPd8VQg1JK2AAdlWr5w= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=nS5J1UYk; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.176 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=1691449572; 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=NpbBCMkwg1WbsmcEnKHREFultw/IY4tG3Jsqz6w0a8E=; b=j80LKnGlpqzdQ4pdQ+jIjvlLRNaA5Dj/p2pozuCgvwaaxWeIK20tOPI1gimaiTNy1DPwWq 7sDm8TV7ub9S/FiULzQYmX6RZq6VmAyfHtCFBdaHz9LkQSl/p1h22a9A/ZKpS9cF2Vv4/1 jemQ/6i1tgt7pKXc/o+wLErkM+Y4HfY= Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-d35a9d7a5bdso5116873276.0 for ; Mon, 07 Aug 2023 16:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449572; x=1692054372; 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=NpbBCMkwg1WbsmcEnKHREFultw/IY4tG3Jsqz6w0a8E=; b=nS5J1UYk8f9msjmOJfcwkB8RnOSNZv60DefW2TDIHuOlvS9npGk8oT2LZd+SySl8sv g+gjV1veIOE2SNGvcFOMJ1pPimwLTZ7+pvFQ4bVBKr+eOsPpBFIPNto8klZeZdDlbFxo wkyNcA7u+kweH04q+BG4NvsUNaK7E9zibuZ01wwXmu5qj90Fw+mY1pf3xcSZWMeZa7wK aGRqh9CjWX7iCRUWp+ZrbhBol1e4MCC8JBlzqolLSWyg74wpF8elWEgkI2Vj4oenaGhD isx7MJZrX54CbrhbHsj99pEt0PqmBmGh9HnsD2DaWM5Gm6veS11IW5m9dzOKe44sU/M/ md6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449572; x=1692054372; 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=NpbBCMkwg1WbsmcEnKHREFultw/IY4tG3Jsqz6w0a8E=; b=hFBd+bBrtvofoWJEGyEsmFO4pbCGEnd1yuT19/3iD6tIFCm5h2Ipj94qMdcf28o7uu BerDm0iEpJvC747NwaLVhq35+DWgpNXC89hqaNQPmv2zXYHyc1x6r7rPkcJt3Tj3S7Yg eEc2xk6Q3Uel4LW2xiw9y3vEwKgQqpHaf5mnQ+bxa/LCU0CeedZhyFgP9z7uczPNym8J Mfpk5S00H1p5vM0bx7sJzw2iS3WwMN5v5Ym/hC0ef+7ne9BMi0oyQxuB7u5ez6pzCNbx mXapt93ldKpNWLAtsaCLjYPCmYpWk3qmeA66CPNultvjGQpjavdu+l8cWYV9MbOY5b/i AxKw== X-Gm-Message-State: AOJu0YzG4qOwSLk7JELFW9RV93iPYlCJJBE2hkepgUvCX12PS6TdVGRS t4T16Pi1zM1a1JRpUBHL4tKgHzx+je5dKQ== X-Google-Smtp-Source: AGHT+IHFLqgFAthROKM1yjg8aTn4QAXhjx425iARLy/TVdE1z6PZIG9RjSxWoTmqjhSqLQZr0gTMYg== X-Received: by 2002:a25:d24d:0:b0:d0a:127e:7478 with SMTP id j74-20020a25d24d000000b00d0a127e7478mr9478817ybg.44.1691449571835; Mon, 07 Aug 2023 16:06:11 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:06:11 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Paul Walmsley , Palmer Dabbelt , Mike Rapoport Subject: [PATCH mm-unstable v9 26/31] riscv: Convert alloc_{pmd, pte}_late() to use ptdescs Date: Mon, 7 Aug 2023 16:05:08 -0700 Message-Id: <20230807230513.102486-27-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: C1CAD140010 X-Stat-Signature: oi54m5wc44eaz7x93r5s6bf4wjzbtzuw X-Rspam-User: X-HE-Tag: 1691449572-746346 X-HE-Meta: U2FsdGVkX18GepwLeaIFSpRMAUTBCI3eNuwi11RavyPbFT1nzv5J3PY0izHTxeevgW2xteOJ6oa06jiQZCTGnG4qJwwIUriD0DUH7po626J89Wq5p2JaiBYEPu5pyt3++ukdRJutkmkawKgyFAFxDgZbucn9XLpXAfMkleYp3SETaTU+7QMxHQ0z4RwUXQn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XvCEuL3NKLIglRjuou+e+URZtn1QJNi4EFhxQptHcp+S9S1ep3U5AMApSED0k0foFa2fSUHvUFyr3L+nCGOCP3WVl8HpbOqLD71Q11slejczWX8+5uaPu01Sifazo1YqKh5SxZ2xhXZQTiIVsnRohUWLpFuaFCUQ8YfwWOTOKIcuPN5CcMCA5AcY8ikSM6iprf39mbTSyV803fkUsAyLrWd4GqRNh1uj14K56+4i4giF5e/XTcq7084k84aCMBBwa+aKg7U3bAiczP9M4gd0Kpvpy9cGD54TCQ8X/4Xmvaemmktjjavtzj4xZ4iLKF/9LkACldZyGnhpjQSyRR/md1/QFfTeg8rEH8sunooge/k42piC1Ay2OaJZkmcxnSIaE6XAwKbQyVBdaCI0HCu6fYda 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. Acked-by: Palmer Dabbelt Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- arch/riscv/include/asm/pgalloc.h | 8 ++++---- arch/riscv/mm/init.c | 16 ++++++---------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h index 59dc12b5b7e8..d169a4f41a2e 100644 --- a/arch/riscv/include/asm/pgalloc.h +++ b/arch/riscv/include/asm/pgalloc.h @@ -153,10 +153,10 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) #endif /* __PAGETABLE_PMD_FOLDED */ -#define __pte_free_tlb(tlb, pte, buf) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, buf) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte));\ } while (0) #endif /* CONFIG_MMU */ diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 9ce504737d18..430a3d05a841 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -353,12 +353,10 @@ static inline phys_addr_t __init alloc_pte_fixmap(uintptr_t va) static phys_addr_t __init alloc_pte_late(uintptr_t va) { - unsigned long vaddr; - - vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page((void *)vaddr))); + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !pagetable_pte_ctor(ptdesc)); + return __pa((pte_t *)ptdesc_address(ptdesc)); } static void __init create_pte_mapping(pte_t *ptep, @@ -436,12 +434,10 @@ static phys_addr_t __init alloc_pmd_fixmap(uintptr_t va) static phys_addr_t __init alloc_pmd_late(uintptr_t va) { - unsigned long vaddr; - - vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page((void *)vaddr))); + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !pagetable_pmd_ctor(ptdesc)); + return __pa((pmd_t *)ptdesc_address(ptdesc)); } static void __init create_pmd_mapping(pmd_t *pmdp, From patchwork Mon Aug 7 23:05:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345311 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 A9B82C10F19 for ; Mon, 7 Aug 2023 23:06:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B962940020; Mon, 7 Aug 2023 19:06:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C891940008; Mon, 7 Aug 2023 19:06:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 61A54940020; Mon, 7 Aug 2023 19:06:17 -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 48798940008 for ; Mon, 7 Aug 2023 19:06:17 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1404F1402D8 for ; Mon, 7 Aug 2023 23:06:17 +0000 (UTC) X-FDA: 81098843994.15.21C41FC Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) by imf25.hostedemail.com (Postfix) with ESMTP id 38271A0011 for ; Mon, 7 Aug 2023 23:06:14 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=sRCgndxF; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449575; 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=SuJFa6mAGFwbCAvFBsdWEeQAHJIQ94yaq1s2El5pO5M=; b=C3xyzMu7AKtDJTONiqKceQGqb2+kqWgsTIDIpwqKwgR6FnTZqYd3kTANKlME4obWhwMCwk 7kTze6Ngm2VEd5Sg0KUumFKgqdOYI640iScdocP1bvfUmg0fNCx4tTEcJ8/TSReVcUOSQt +tyCCZrnxc+ik8BDjKh/k2Qqx7vpn3w= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=sRCgndxF; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449575; a=rsa-sha256; cv=none; b=cd+D7+594zILqQ0sAqnd0LuZ7r7S+0uaClEfNLfAJP3iPKOvwmV0q+4eX9bsOkPkEpPYPC av1BMvX4WtdWWdh1JA1EiVwqvMJWNJCaic9iiI2Qejqx3fDAQIny0D4uQ/a2KOF1NNY17x Z4hpZhT/eZsVQGdQpfdGegvs2vWVxIc= Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-d35e565071aso5316993276.2 for ; Mon, 07 Aug 2023 16:06:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449574; x=1692054374; 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=SuJFa6mAGFwbCAvFBsdWEeQAHJIQ94yaq1s2El5pO5M=; b=sRCgndxFhKIflL3dRUOciVixuY3um2CsOH9mqCT4RfpcBNQLoC/2xIlVP2BC0LrRXg d0Mfnrp8G1Gq70+B6oCgBqzc+N7zHH9xY0+av47l7B8CO6Tt+n9pMVSoswf5Jzx8/yzy NzCNQAVK/Lkid61qiT1qq4e/dSW3T9N7fVh6BXy/whyNG/50NiRv4160ULtNDt7ZAJ8u ZEinV12wAdQdY0FHQSDiTfa7/P6pGvAR+Q1UWR0j31w4+0ktiAC1WT1q41QbYEtl/+hQ cKdjsvUfk2w2q52f0mVtR4dPNDq1UHAYwd2r0wZzmsP36I/aPnhCen/ej73PJ82E0WBs UQzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449574; x=1692054374; 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=SuJFa6mAGFwbCAvFBsdWEeQAHJIQ94yaq1s2El5pO5M=; b=aFCCFGfr/ZLU3YmVMdsomgkDlNi2d92fK2c+6OOhZurce3O4OA5EWCyAX189vBQWYl GffYnkrAsNEodeiQxdoxIAz+bJFKldcvGpsf9D05lNVuN69KIwVK9BaNobpifAKzeBoc Kvr4R64AkKPNOKE24I/c1VSgNr+BlMSNUpcoydr4JlTuCMkxhKnfPi6mcWbeX32O2MIu NrIWw3rvAeTzaI7VecB/ofcyCVWFhHDT1p352xOSf3+d7E0TMHBPejCXN3kimnqh+5nC CuVZ7PrzqlbEVycwkUeFI7PDSbT1FFbnlNHjXA5YcFLTb398ydnw5VOZPwzVReomo1ME 3VDw== X-Gm-Message-State: AOJu0Yz8kQgpmz2ApaxxM7WUkpvquaPnf422zuIEybYBaIReagWleoCs 1iuDCE6Syaj5DIYeN25O+x4= X-Google-Smtp-Source: AGHT+IHDPhUgl52q/fREvy7LWtCvyksQLzlkWI4tWrtb//A8NgqAG/s+XL1YOkSBACmJ6FF0msS3mA== X-Received: by 2002:a25:4081:0:b0:d4c:82ff:7bde with SMTP id n123-20020a254081000000b00d4c82ff7bdemr6684894yba.63.1691449574044; Mon, 07 Aug 2023 16:06:14 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:06:13 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Yoshinori Sato , Geert Uytterhoeven , John Paul Adrian Glaubitz , Mike Rapoport Subject: [PATCH mm-unstable v9 27/31] sh: Convert pte_free_tlb() to use ptdescs Date: Mon, 7 Aug 2023 16:05:09 -0700 Message-Id: <20230807230513.102486-28-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: ri1deiuts668x6y3g7hptjd7taxezero X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 38271A0011 X-HE-Tag: 1691449574-529108 X-HE-Meta: U2FsdGVkX18N0T8Wjdsl94fmG/T6a/DyT4YOJ1ibRJ06czlMAN3dbn2BDkT6Te1o3Tr6TFOlGRCHY4jaTzET17qdeyO7/Wzm0Cu5OBExP33Aaww4LQlpT8BrihN2iVQdsikqR+DgILQsCni1qbnbCTddTRwOpCGGTcfYmZKSO36jDaYgOPMiVAuqe7gPj7OcWkbQqoSE00/zSx+dck0gETI+vHsa5OOcejsxhkdAEJqQj5xUlm5U2FcpEfAnwApzEpkcoKOdt0RWOtUL/sfz8RFQn3Rb/fEseeLSKoiQFeKg1AJGGg2ATRmcmrtPPN7kOdJONuXUX62hkKxcJZXaL3QPdkF0SSyCIWUyE4quLcrlryuA5jiHG4H2dMA7jvSra2dAxqlJO0SAD1XiqqWNFeelZZjYpvLWzM8ktgw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yIDy5Cnk6NXaDWAjmZ10AQr93Tckdyhb6Am1yYZwEPhipW0fRGndeI8oXJJvhTx6wJjqbKGUN6khdCJeDYVSFbfs92IGIVUZPukLSfxZQ3kBW3yVliapfoxobVSYw17pj9/FOeavnNY5skUfI6rAk9sizmEeXMQ== 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. Reviewed-by: Geert Uytterhoeven Acked-by: John Paul Adrian Glaubitz Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 Mon Aug 7 23:05:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345312 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 ABAEEC25B73 for ; Mon, 7 Aug 2023 23:06:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A8888940021; Mon, 7 Aug 2023 19:06:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A1213940008; Mon, 7 Aug 2023 19:06:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 864EB940021; Mon, 7 Aug 2023 19:06:19 -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 6A1A3940008 for ; Mon, 7 Aug 2023 19:06:19 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4597516052C for ; Mon, 7 Aug 2023 23:06:19 +0000 (UTC) X-FDA: 81098844078.25.C63FF6B Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) by imf06.hostedemail.com (Postfix) with ESMTP id 5829218001A for ; Mon, 7 Aug 2023 23:06:17 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=cpy8Xcl1; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449577; a=rsa-sha256; cv=none; b=ETGvc4N+ejKf5485PYvSh4V9eelMjsgubtZQ3c2RA6D4N5xb0HiDJOrtBHkpWO7oMokdFn BEds+cv2r7ah1YBsGx0r931JRcfN3ULeffUrwLJ50JR0Oc8SMlOsCbsWcr6iqFjPo/bMu7 I6FhijTWry9olfPtwdcWA5Y2ZyGrEUI= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=cpy8Xcl1; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.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=1691449577; 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=9BaWlDiv5V7gFuBlQl83W1x9C2ZQPjYd5FMjDEEKLfk=; b=4tjth8kv2/xqliu1eGorwCVZYY4bUdcHgTJZ7EXZoms5ynVY/xCVyMfc3HqRWyjclSWJy5 xNlncWanqgmwBZ6sJnC5vJEEBZiYC7wm2kYbZA0I0TcPw6mk8jKkUs6DqvfezLRsc0/q2p /jCwVEpB3pQ857HliKo2fqd25uJ7208= Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-3a74d759be4so3751261b6e.2 for ; Mon, 07 Aug 2023 16:06:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449576; x=1692054376; 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=9BaWlDiv5V7gFuBlQl83W1x9C2ZQPjYd5FMjDEEKLfk=; b=cpy8Xcl19ScHIaEJohMfnXLz1DqejMUY8L9glfoRJKsJ7GTvGcuQsYlnxy1uVil+vX sKLd/jl5n7/nYQY+c94D1q52xLTeGbCjuaSsuOaGb/1E2rdiSHktCUTDo4f7HqbeV+dj TPAGwr0CoWyRhx6mzwQflnUob8s/y/rCKdVhSwURC5eFFFvRnN/tn2Qy2PbiuytULAR6 gF0MKwRWTHX4EnLLnTfGRqqibjjUEq59j99BhXKpF7aj2wSWqBVgMsp2RTnzW+/7J2fC DAIl8+bDSwnR/XjlkNOvluV6Us9KQMDrngkUDG9ywXNDgTmwYNXsy+sDpdm8duXtW4+4 Ov0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449576; x=1692054376; 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=9BaWlDiv5V7gFuBlQl83W1x9C2ZQPjYd5FMjDEEKLfk=; b=MUzoOc0LU+Ea14rqix6XjrOPl3FxLYx7uppgYwtHEamOrME8NHlFtsHxxCf99Amj2n /OiJXUn+T34FO+sY2ifwAVrL2pY9URf+Fbne6Wj3M3WLprHJlRBwqaIaKImmqWGhDceD 70SmNSOcDEP53P4KTwimsCPWYIgixazE3Ar6+NcRZWhmmXufp1iiz8JSELt1Xc7n7OxV JOApy+GAiXqWXRV+8vVLDboiyXl26tYMNf4xU076LJ4rMhvXhCC8Fy8smWRlsQuV8Kdt XFn9ZNNvikZ3sTS6dfszpQ+nMde9DUmgZno+W36mzn2P2YQOSERB6HvJdEkUex14iPal +apg== X-Gm-Message-State: AOJu0YxefuSCC9pvQ0qacbYt4lTaOpnf228WTK835OeosVMqWm1xwBLU bC89hTiExKW9uJUozY3jxiYjMd3EpsCoFw== X-Google-Smtp-Source: AGHT+IHyrg/p55954UWSWEFSK4VAgtzO3wGDAXzmBNoLynnb9Xv8FQKgcm7kods1XM481PofrT4NJA== X-Received: by 2002:a05:6808:23d3:b0:3a3:e6eb:9c53 with SMTP id bq19-20020a05680823d300b003a3e6eb9c53mr13630414oib.23.1691449576353; Mon, 07 Aug 2023 16:06:16 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:06:16 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v9 28/31] sparc64: Convert various functions to use ptdescs Date: Mon, 7 Aug 2023 16:05:10 -0700 Message-Id: <20230807230513.102486-29-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 5829218001A X-Stat-Signature: 3gyagiw88hxh17jqgs4wncfgjp9xgfgt X-Rspam-User: X-HE-Tag: 1691449577-279022 X-HE-Meta: U2FsdGVkX18YmvFVESWm3I7fyqZqIWcdrd9uwCxexNB0tLBMT6Zr38AJis8Tk71Bq4pr631Jil3aEwPh2YF/QzWe74R8eedHc6/pLbBxCltHi3QbCTNLEhGRMh8n1aa4XFczzce3maBGH4azB0WYQn+uGwNqgabtlRkpP8vPKzcf5NFckCyRZ5+qc+lVLjHUoA7ola3fooGRYXDV67ogniGM0nRi+GXBLqFg0udNRhYm+7eaYdRu7dC6frdDgWRjHl2gmEnfbo00vYTeAnsUhO1id6G7OfAuzSrYaOuYrjxeUQIyVtuH7GyH0Pg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AIRvEnWwLccqkNQ28EFzl+0reZNHacNjE+rp2xXkrerHiGU9PAq9WSNDyt9dBXn8UuPrEXpmh/MjgyjvdRErXm3IMaKVVVTA1RRJRnfaq4gmolENji3JCI5pUUrnfEHoKWTqgJAmlpZoZZGaUBJToIB6L0MTybrE7P22jxHTroZUaHyQJBTBfm3ei8O2m8K5A== 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 680ef206565c..f83017992eaa 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -2907,14 +2907,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) @@ -2924,10 +2925,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 Mon Aug 7 23:05:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345313 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 E4148C07E8B for ; Mon, 7 Aug 2023 23:06:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5D0F940022; Mon, 7 Aug 2023 19:06:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BBFC6940008; Mon, 7 Aug 2023 19:06:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A128D940022; Mon, 7 Aug 2023 19:06: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 8C918940008 for ; Mon, 7 Aug 2023 19:06:21 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6276A1403AF for ; Mon, 7 Aug 2023 23:06:21 +0000 (UTC) X-FDA: 81098844162.01.8F2E8A5 Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) by imf24.hostedemail.com (Postfix) with ESMTP id 912BD18000B for ; Mon, 7 Aug 2023 23:06:19 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=LURal4Kq; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.169 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=1691449579; a=rsa-sha256; cv=none; b=azHFP+g/stO++4ZMk6fI6DYyJk1Vmm7jfkrS8tSAyReR9PwySxaFQ+NFr1awGlJ/DiNVDA +cr4iXVaRENnXtkqNKD7bGtJzAuF1vKGQ1sq+TTKNSUKN3sPYoVwxZvUrb167ovU3LmjGM C3vqlW8bo/1g0INgZ4SXOABzwWvrsNc= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=LURal4Kq; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.169 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=1691449579; 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=Yb5+fiX/YSPgeVruPImZCslC+7XzLtSDmAZ+KnCCvCw=; b=s6tJGdaHKRejes36F2g++XomIDuOevpNfFkvrxDkzK9exxVVOIUqFg0iLe4xt1FKurC2Iu rLEPB0gNxYwwHsm3Ze9GtXWAgjgMykD0yqU0nMaWOuf25DwCao0fKnivKsUSSjmilV9yZN ZePBnk2zkFpZYmTAbz8yXnlaaQiSY00= Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-d075a831636so5456172276.3 for ; Mon, 07 Aug 2023 16:06:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449578; x=1692054378; 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=Yb5+fiX/YSPgeVruPImZCslC+7XzLtSDmAZ+KnCCvCw=; b=LURal4KqklmU9AiCOifU5Mxc6WM+IybZMw4f+H9b+ehsvWfF2rdEGUCUpHED/xgeP0 03+is7BherE6vDUPF9cInwhZZ6O6FVEP73Sri7+CBG0/7jN64G4bgtBq56ZrcLUBIxxT uSfx8fFqjmiqF0MtkULVgc1gjFJH4lOvkwRfZt9wzMVRnizjKRrxJwuFQ2mIfEo7cHgy UR2ZIO+mIWR9RWU4d+HJedZnPKiZaDv8i4STB2D6+pQaLcMt/pvWXKdhAwPxBTPHyGDc YUL8XwwyvOUHrQNxNKfZS8WVqZrgPXs80ZLFz3I7kRgWNiGS07HTyMzLuT9V1dLH0d1v g2Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449578; x=1692054378; 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=Yb5+fiX/YSPgeVruPImZCslC+7XzLtSDmAZ+KnCCvCw=; b=Vr/sIBFkxBO0ZiiZQtpUwpHaHYxfofF+0SVZrdRjtGhQz23UHVKjkZD4EnxSQ5LR27 RNkVCqm0Pd+QKs0Bpup0kQ0c0kpnwL3yNiw4lxKFEQrGdio9TzjzuVEffkP6VTJ+vEA5 iF2qESFG5Pm3QEtgWSNWbUhdLwQQ+23JfTAgVN+4xmWyGgcyEM6iPoYllCogELYb1Cdu oB6wDq7X9ZaLS/aH6h8ebsdEUNwoPBlmPI+oL5ltIEG/lGAI76qd7c/2J97xdGtWIWmY jHMa0S/FlP0lm6A6xvyNdO4jtyBM35bMtiaoXqN9coUn45M0CrYbnBeHeFDL2zFmnOQt Dk3w== X-Gm-Message-State: AOJu0YycXjlNzV82p1rSV5Dh5xPOCewkyVqLmTCKkEL5IbMByZtmW6Pu pRPkGFI4DIuLWlpmx+gZ82g= X-Google-Smtp-Source: AGHT+IHSK0JHQfLZYNqZB3BuP0bNBVURutz2ITpQB4n2EhlNMl4NfRND8wevRJ4hRdMY0+rsbG2z6w== X-Received: by 2002:a25:ac04:0:b0:d0a:8269:e5d9 with SMTP id w4-20020a25ac04000000b00d0a8269e5d9mr9659872ybi.60.1691449578542; Mon, 07 Aug 2023 16:06:18 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:06: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)" , "David S. Miller" , Mike Rapoport Subject: [PATCH mm-unstable v9 29/31] sparc: Convert pgtable_pte_page_{ctor, dtor}() to ptdesc equivalents Date: Mon, 7 Aug 2023 16:05:11 -0700 Message-Id: <20230807230513.102486-30-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 912BD18000B X-Stat-Signature: kz3mb5dhawssq6zdi1scwcwhn8x97yix X-Rspam-User: X-HE-Tag: 1691449579-484716 X-HE-Meta: U2FsdGVkX1/I9cYobaMRKXg5WUuYazjrUdfFJSDkpV57f2NcmURVXTzVFmc3udMuhNwFKnUf4+vCaTpXfJVxstce+x8piL7jpwQNkBJ34P4F1W0ufI3WN10DDyN6lW3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T5pr4rhmTshO6iFEtJhA5iMK5So9J4msAWGWHLPjd8JmJegfU2X+QzgTPM2zyteuCTl/8eY7VE+a2oeZbZE7JQwzU47kKTHXkSu3f3sWIebtjRzjsYL7oWXHIaNjXZYOtelTaB6CXbEB7hR+hcFEF13Yk6fWC7t/59tKj5dYWIclhJkWBhH2jAwQrfb24TqnBnDhxuJFq7w5WDSKJaWH9p6wy1rmqbN4aKs/sxU15mzwBoIQImm34/YKgYbo42QZu1VklOpv5n8nIqAzdFIm1stPgGW8qPnYZxrjVz4kA8uxiKFDh7RUuuq88Y/CTa5ZucvCcqd3zhe6Qu1OVBAFMXH6QM3zFBnXkiKLqbSrLkXv08fE7OrVzxD6xBP26IK4igEsGmPPGNlJScXEs/cOHdL1CwcKdKoeUdZO9NaNcpTS6c/aYfbFy2U= 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 Mon Aug 7 23:05:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345314 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 F164BC10F00 for ; Mon, 7 Aug 2023 23:06:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B2513940023; Mon, 7 Aug 2023 19:06:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AAFA4940008; Mon, 7 Aug 2023 19:06:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8DBD2940023; Mon, 7 Aug 2023 19:06:23 -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 7205B940008 for ; Mon, 7 Aug 2023 19:06:23 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 50A12140250 for ; Mon, 7 Aug 2023 23:06:23 +0000 (UTC) X-FDA: 81098844246.09.74E2C53 Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) by imf09.hostedemail.com (Postfix) with ESMTP id 82D00140024 for ; Mon, 7 Aug 2023 23:06:21 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ZmZBlK2B; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449581; 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=T9QlLO1dPeyZnWI5hHw1TuJlTK1nfQVgIvIYX0JocUU=; b=ea+mHP8YW9YXRmRnKvsvgA7+YBPmL+6q6xdn95uOK62+PBwwnpV91lHxe1sJfBuk1qE+Hu m7tXJAAF0lm4Lb2MTp/zFYUYOpFOb9Ob3QXAL2Di/k64KanOnMW3Zyl1qzJr/dIPR7j9zZ CAoMt9mxyKoEjiWaYh/7TsO6jONZj0k= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ZmZBlK2B; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449581; a=rsa-sha256; cv=none; b=epO2QnnCibBmFvpP/V4tpaGILy3VAsBONb8QjBJgqePS4zgVDUgr+FnOwXp8HWQgjcJRsw JUBl0I1muXDF7VO6tlnWY3gOf+XryYE460HouoqYDp9y0rp9PnPh95+qXkcBz7N8s37w+o fpquZO6pQf5Zz/UzRGMcuzl3FgANP3Q= Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-d44c2ca78ceso4742227276.0 for ; Mon, 07 Aug 2023 16:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449580; x=1692054380; 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=T9QlLO1dPeyZnWI5hHw1TuJlTK1nfQVgIvIYX0JocUU=; b=ZmZBlK2BE47dPXTqc8IQ1uTKCUobrHijjQnotS76WbJUUgCGVOPFVEmsLAOFQve7Mq 8k04A5/AuFSS607BBJG/Nd5XpAmnH5zPypJPEnlo7r978iqN52fpsMDyDxOev3Z41hLb CpvzpxqdWGHuM0xgZvYoYbOi2GTwb0pfPUe0oyJziB36Q6lozhNOIAq2JTvWjnhFdQ2U 4BFxzsH5/HG/XXl5/YPVavhDi3L4gvkLB1NxxGw9654yYac9diJlEe3+5Z8y0K4G8C7u mJwXJ96QObfNW/oMJd7PgnIP4//NNbVjGeiAj0SJF/1wFKYAbBETcCfRmwi4qkbVDTFa RY/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449580; x=1692054380; 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=T9QlLO1dPeyZnWI5hHw1TuJlTK1nfQVgIvIYX0JocUU=; b=hDCMdZPFRyRGhAU6htYk2TLHy5o+mtxPKLioTZlLzWdFTaMwXRBaaincYaiXTZRpZW W/etwGmGGiuoxPNrOIaPnq6z3GoTyoi74Ip+dO08zkZniyv1Sovb5xvRROtrnhd3HSxX QwCKEdnqzR8/WfwhCDfTM0ZRzggyZ3fI/nHQt8rd5ErIx3iluQeARrlccuTjHw/5erjP bBcCEtLDgg8LlC+jYwYgDW3MylAeBvHZUUO+mod8bp1EQFGqP+/lpGmxOnCF7e2+YakE 4yqgzJvmmMtjfz1vRcy6QGnr3CtpJIrX8WQMb0VjioWvQEmdSUWupswHShmcOZkBsaBE vJ6g== X-Gm-Message-State: AOJu0YxI5Q6p2UwGmg7v7uTbK5F1va2BFLDJAT+zvrrx1JYCBfIzjYAJ Jiq/u5KXB9nklIsIAI1wNf7nOSiSbl8Tgg== X-Google-Smtp-Source: AGHT+IFhMlpHJ+7onf6BYxf2ZEVLLZTaCynnVlAbd/4Vka+RTYiQ5OXzXPwOq0O9emhI9trC6wG3Sw== X-Received: by 2002:a5b:f8c:0:b0:d0b:7e30:6d17 with SMTP id q12-20020a5b0f8c000000b00d0b7e306d17mr8498276ybh.14.1691449580620; Mon, 07 Aug 2023 16:06:20 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:06: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)" , Richard Weinberger , Mike Rapoport Subject: [PATCH mm-unstable v9 30/31] um: Convert {pmd, pte}_free_tlb() to use ptdescs Date: Mon, 7 Aug 2023 16:05:12 -0700 Message-Id: <20230807230513.102486-31-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 82D00140024 X-Stat-Signature: zjup8q3mkgabpa18beozn39b3wkbkbf7 X-Rspam-User: X-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WzmXo6x+eaCtgs2EkyYsb3XrkX5y2DCAvZ02+QprkharoDByyEp7YQWE4ECrXIoeytfHnA6fhajKIJnXvuaLvbuOmT+lL189Gk3oMYyK8OtdjgdWI4WS/aLnxb2ODXKOn1nQCu80qPBiDLMNW+I4sMhN82zcSoxzMAO/UO9k2lW2NRtigpF8pIeFXe6jQVevG2QxYDeAIxPUslVVpKxOLgBhsJSdlbLCDF+zoaIKrQM8ngmtknDY2JCgKlKZv2PRukoqStqC51OYYPCNFA/iGGnZWwnBjlcron5eyD/y94lYtXasZ5Vp4TsFVmgZZfYS3SMmSJA2ui9ZBx5zhV4KuYjpfkYZOlkSemahvm4MJWxMvniyw2T2ykGig4zSsKchCgUukErTLYOg5UvdKLv2OTgQJtOyqt2ySL6sSljFpbno8OuMu7mXWAokoEohcDCd8LcvQ2u4JB9mn8ELhQ00UU3R9f3nnoSl7q2mUlpD0QqKjAd7goqkfUJzNGjH3SPoinsZbkT9OtIpoDioFw 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 Mon Aug 7 23:05:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345315 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 42891C04FE0 for ; Mon, 7 Aug 2023 23:06:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E80E78D0001; Mon, 7 Aug 2023 19:06:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E0A38940008; Mon, 7 Aug 2023 19:06:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE8748D0006; Mon, 7 Aug 2023 19:06:25 -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 AA1228D0001 for ; Mon, 7 Aug 2023 19:06:25 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8FB561C915B for ; Mon, 7 Aug 2023 23:06:25 +0000 (UTC) X-FDA: 81098844330.15.CD6C970 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf20.hostedemail.com (Postfix) with ESMTP id B8CE91C0018 for ; Mon, 7 Aug 2023 23:06:23 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="ny/PO9Rz"; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691449583; 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=gIX4EtUZRQHbbGVDBj/rJyP4ZKSCaTL9vvlgteJwLjg=; b=d1oQW4hdTwfaDieUB+sl1i5O1HtafOVmNufFYzrze/x92hvBPHf/SzI9i7hrA9us+Uk7kW zWhmJV7IQXVv2HUSurVhCVIk6h4o+F1+Oa3iUNqPp7rDKaULnRtZaVZyWUcuUfp+F0y4oU gTo+Kqp36Q5NOYFdmBA5GWThokL3VfM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449583; a=rsa-sha256; cv=none; b=CLSOQoW7j/jjcMygsMxd2PbKyvXBdZeD36zQVd9RTEMpVttEtSGudwlpN0q46yFoKqXC1/ auDd25Oi25pBaDQsKr10px6rLyFLLC5NKaA2Pps9UxdZ2vvvO/BhUDaWdX3+Pf6saeBfLw qJaxwuR4pzTNfLJTHmNraQkJqP1HoB4= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="ny/PO9Rz"; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-d4789fd9317so2925408276.1 for ; Mon, 07 Aug 2023 16:06:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449583; x=1692054383; 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=gIX4EtUZRQHbbGVDBj/rJyP4ZKSCaTL9vvlgteJwLjg=; b=ny/PO9Rzwz4wKD05c8Oj8x01t9rfWUwF+DPBSi6xhAQ1t3uiUBYZ7YUUbf8WtD6fas a2dGGpvFO2SYjUkztwf/JpnNv7QhJL+Goto2OWRpxKnsAjXenC9v6P3rISzqLv6y4LVV 4Qzw+SXgVTszZ9R94kkJTKmg5SvkJhFFe8ZHJiGz98l2xVrWZH/L4O6QNYM4Ix9oN6dK IfbxHi4LcKxjr+5M4cvO0MwysEIi/pmb6eegOI2VGQmX9xJr0pTMWjXflu5Ws+wnG+9V BkJIEDxKgjBTQlry6d49f1/eWCkgGXBEpt1ui7ZKc/08IVlfaQd/C3Y9s9851HPExZOi t/gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449583; x=1692054383; 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=gIX4EtUZRQHbbGVDBj/rJyP4ZKSCaTL9vvlgteJwLjg=; b=NIdtB0GUK802RzE2/KUhCukDYwbh2R6NGEicKFN5oNJjl9cWvedwystupDwZ3BESQJ K2Dk3g6W7zI5JFDV9LnudBVC3QJB/jkjsVdUYqbbmXiJqW9LBAylEH2m8Z2vcyKgAOhL GAvJnHgVe9LA3pkFlS7vkA1b7xn0JmaUTLNzc2bOBuJHOr/yZtO7rpvSlENUe++4eNHW L9iqmVnTo7LJ2lwyomHCJ2O/i+FO6D1nicyu0NVtu5DNFeWWKMX1cyZbg/yLkZjPB1wG Vkg9rPuHFLxjScDTMjcqnEglwpzsbJu+T5KI7WPTrgTiV2rms9R1FHDk7iyd2K4IalTm +S8w== X-Gm-Message-State: AOJu0Yx+qaft04fM+urYXC/k3MiRhYBEGxC6xVAvtc4bSwqzb/iaF4X8 N09ab6xMWzWPDTCQVLPH72c= X-Google-Smtp-Source: AGHT+IHSz7sLxFa/9tcB1BFEAx77xsw7IyoQHCgeHupxbvTa93/qmodby26m2eSPWXo4FijMYi73DQ== X-Received: by 2002:a25:e708:0:b0:d53:f88a:dc09 with SMTP id e8-20020a25e708000000b00d53f88adc09mr3953501ybh.2.1691449582662; Mon, 07 Aug 2023 16:06:22 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:06:22 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v9 31/31] mm: Remove pgtable_{pmd, pte}_page_{ctor, dtor}() wrappers Date: Mon, 7 Aug 2023 16:05:13 -0700 Message-Id: <20230807230513.102486-32-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B8CE91C0018 X-Rspam-User: X-Stat-Signature: nm5qigt4oqxcm7asmbsc4jgr1ibc6cyj X-Rspamd-Server: rspam03 X-HE-Tag: 1691449583-591562 X-HE-Meta: U2FsdGVkX1/WwIAypIgr5WwNI/co5gaV5W/SQml5g4vXwuqnfMLelMF9BEdLlA9iKqFfGkv1JNhBYM1546C4beYsAot7i5593sV7XeyMpRc7g6sn3yjJ9zFd5MDF0ix0/o/xTWKNMDf7weNAQ8pP6em/HcVNVA6dBtseWC6JvV+5oDO7ShB5ssIJPB2eyNmMn4cOFXcgruPZzyAN/6O6z6AO7hmLU/1vy3wf0p06kxLgMLD3YIkdNz0IZto/RFikEWwhEGmgtwGn5kp6SNi+JKB7dO4DJbTx0mLixPRAiuxTpm+mjluAttUKiY6BaQScEL+aBUmjufRetLpOUsOnlFVl7HWo7hLdUJMW4Zqn580x+BfA3Ko0AQwyFOsHKQVMMsUkpadfWfwh/HHiGB4wdvNxfkIZW9H9ajrg2/u6aIol8jP8dROWE4v3axk/yFqfFgTTlMYebQEe1OgsA5ZXsNtxfWRNELLIoWS1oSgFMwXhCYuWvkIexQAK+d0mg+BjSXXtXmzxza335F08KYszXSI0JQ36rfmGc09+BA5blpNvsDzR6SaA8Yg71PUPWXTHqNN7VdtGsyYPr/32epKKFLTKBfQ3NBbL7h0FcwRI8D+szHKP1C8A19J2a8lofj6vYhXXf3O8AIfN/7l7nIWa4l0RaoaYagLLVBpBOJw/k4G24XHMYvrEm5ZXz9csbR1qBkhopG4R3RuJBVU0hcpn6QnH3zZ7K6/dz9V+Yu96OiGKEnF+oRr7YsCl/SED+lMUorCTeLBfM3mBxwZSNs7LR/CxBPOG7JZbRyEaozA2L9/+fkZDzRE8XDq8mUZbAB5BEf+RER45/0FvZVj1QZKf9Kz4jQta3O+ZKYdzhgJnO4Li6Y8a/55XZaoHuzNs/7VaL2b/IFhjsDbyXEU7nbxrubboDLCx4BZ2ClGe5Mn/6cKkW2MnAO2Sx4mTP5ne/T2QC7UUXcR7X1YYmCAsu+U kA6WrZC3 AUYEz2IDG675rC+ysCSZrh6BjhlI77O/219Yj9JsrYpZWpc1/sDodrdaIAgAEUuybHU06OnRKnMSTMZP8/Ti3ViOi0rRYztfVmTw/Lmrecpj2UKN2HFoBAbmJlcQZngTJTO5bYwLmu84QajnosUJljWqH1eQ/8fhQOZSEoou/gAyd0gv24hvNtTSpD8j2kVpq3CQz2ExN0Nimq/YBrHtFr4mlj8PyjftIXywPq9OuoZPWJrA9rBoIdz2SUBnKBdZUDDS3dPYnXURK3vR7NwGcZaNm5vH1ZNSWfmR045FuGx1R/LxaLRi0RK7mNpqxqmtvKkTnA/RtWhKGkSPzqbhI80rY4F4mQ6aiYzJzgdjpL77UvemoPG9kk4MniwHc/Md9ICCYCPyEmq3v7TtcYezIb6GfAyyw4HU0b7zVNFioq247QmGagDGAHyZIiK7+Juj2HC7JolE5g29JdGEC/JWjXWCiJwttIX9QTJ9Slv4IA4qdCHLtkQxeUiffKGj77DbkygyP8mAp/fZoL9joPAAykPcfRcrHt880eydNSarnCjwNbMg00wNuyz1sIR4vQI753y3kyDypZCLUH7GJ8ssb1+Hi94yjCKaal8r2aHQQvY5wdWVLqrqKPLGsXadonsAXfyhcOytB5ATmhmCJR3XgjOO4AkayCN7OCtCMYjFPBimCjrV32rgTz98cPxrTtylLcW6iS/4q1Kn4C43CAxWNWoUelY2cimaOfqSq 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 6310e0c59efe..6a95dfed4957 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2932,11 +2932,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); @@ -2946,11 +2941,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) { @@ -3057,11 +3047,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); @@ -3071,11 +3056,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