From patchwork Mon May 1 19:27: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: 13227920 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 9224DC77B73 for ; Mon, 1 May 2023 19:28:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 19BEB900004; Mon, 1 May 2023 15:28:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12454900002; Mon, 1 May 2023 15:28:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDEBD900004; Mon, 1 May 2023 15:28:38 -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 E12EE900002 for ; Mon, 1 May 2023 15:28:38 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AAD08ADA3C for ; Mon, 1 May 2023 19:28:38 +0000 (UTC) X-FDA: 80742673116.01.619C547 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf04.hostedemail.com (Postfix) with ESMTP id C59E940009 for ; Mon, 1 May 2023 19:28:36 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pYnEspIg; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.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=1682969316; 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=9i6mX6BOTgb2TGO86QCloW3rCrq78sBOKu0dxXwRHVs=; b=OoAKdOCn0r8UmTwPwaQzEmhLm+GWTiGkZRRq3S3+a0nVE4pojBudPnr+rD7SBstyZrLVPN /fIy7beopKUFxUZ2Ybh3/GWcHrxC3ET/J9Qsh1Fjuus08gQtzJaWcBhO2XR0dmBXKslULU leVlH03EVTiZn2yHr8iN73MtTNCPyM0= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pYnEspIg; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.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=1682969316; a=rsa-sha256; cv=none; b=s9eMbgwr7uBQcR7U5NUye4IBe3ySqUq5dTK1QP2S1mB1uhlVUvWirNt6ggVugceLsOQvM1 LgVoxu4yKCi+f7eFtk7SL34Ij/fBqlkG8eADAPQIt9wQ+gXn8GoBELaii60SqWK1LQsCiS dGI4DUYcKa0nRS/JXNZbBRxXUqNxiKk= Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-517bb01bac9so1886471a12.0 for ; Mon, 01 May 2023 12:28:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969316; x=1685561316; 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=9i6mX6BOTgb2TGO86QCloW3rCrq78sBOKu0dxXwRHVs=; b=pYnEspIgQ/94L4B7QgE7HxUaLyMe6HQnu5gVv7XKe7wrHmtTwaLadWDte57s2SBwdQ 8bePLJ5Ai3/AmYhH4RiAfK8IjGb+8BxlohLn4+W6ycJ9Pg3WMvHLkkZOviW7YYTD/mmK GtZnk734H4mZvUq9Iut38ZejJnfrw2oYgWeCZ6PRbVlgoGyBpRA67FKhICj+7yH7j8HF a3LIP2IDGGOTftrbrsZRq8EQiQ5R1WymqweCw9yu0t92fclq88jf6kqwtf3FextynpJY IncHO/7Qw6ErlKR7f7HeTzuXXgCmLczBJBgXHLIbesev1rm2mkGmxXqiRqgTqpx3oce1 ZBnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969316; x=1685561316; 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=9i6mX6BOTgb2TGO86QCloW3rCrq78sBOKu0dxXwRHVs=; b=GOJh9W0qi7z1B4b3S0fw8d7XIdeJ+lEiXshFn7shzjF+Dn/LqH093by4lbAyu27B0D xq/Gw7OEqnAro7WjJH50kuOVoqGwfsbxUoy+0dq6jDYeCq2Tm6pEf59PQARtUQNGcN3K BZpId5NbQG62aUlJ3ufC6x8lkti7x99P3Yl1VNHB2RHyzSe1d6MNi5oAx9kHfbwB6nWM cQZJZIvu1tCQp6frKl4E6fDkZQN6WQzNY2anc2iVUxCdS7g9j3ePI0JiVfvdFiQY/N1I ETBBvVQgpJJYqNh9pex0hiPreVaXcB/IY1fP4hbkpX4Hqfj0mGc2n4EXz7bLc/lm3rJ5 Bv7Q== X-Gm-Message-State: AC+VfDx/PTjlULfwRG3F7i+WIEpolsYFGwNb5KCbos/F8dSkZMLYOTSz Xcx7xaT8HmeyIlPUA76Ylq4S6anYPoWz7MUk X-Google-Smtp-Source: ACHHUZ4H6i4St7ld1wD0WuHlGapRQhff/8tSAzzBd7XutE+/MiRiNA1zmkp/wHjGquMcgELZnMsxdQ== X-Received: by 2002:a17:903:1c3:b0:1a9:80a0:47dc with SMTP id e3-20020a17090301c300b001a980a047dcmr15039374plh.3.1682969315645; Mon, 01 May 2023 12:28:35 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:35 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 01/34] mm: Add PAGE_TYPE_OP folio functions Date: Mon, 1 May 2023 12:27:56 -0700 Message-Id: <20230501192829.17086-2-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: C59E940009 X-Stat-Signature: yf8rya9qt1isenpu4bs3q59bztrah5xm X-Rspam-User: X-HE-Tag: 1682969316-909381 X-HE-Meta: U2FsdGVkX19cceIInCH0Mv58hSRJztqz6taa3orrD76seT9ukiuoylPGCpjfM4QqPmQfGSB5ecHdAoz87kARzZCnLWcpqFf2iZStFfBeso/ZMVxoXTmHO58p+1MLhzdUmoU86MtNRT+4JuHL/E8b+5LyzS6i6W4vrEhMFQEGo9ZeWj8NKdnwe5PM5Pig0xq1HMOCuZfH89sL1nsSTRGMNUo4ECzpQLdjf1YpigT1JaagxuCX9GZ/9LrZXVqiMjU0MhP8LlYNxFLdQ+1OuesXKFWWQsK3Ax+NJAajTg7W1QBRZdr4yeJEuW5AKdgbCYu4Iqoypjpsoj3DMmftij/sRmfjp9DRIY8sbtoT07l3L8nFCKXy3dSLVSlfv+8druv/Hf3+B5QZGI4nhUiLV/UbOjlj1pYW1pk94meLvT1fRrO++91rxFSex1Of+3XVKf7lmncFIZsVMOenyGM308ydjCsk9c8R+CyYrrMmjvrGBGaNOdTlFSjADlDkECsIHQP2z0xPr1JlT9/8Fo/dwKtBmBmN8QI5gPAYUfZ9HXJ3j82C+EpD8c2rOORDCem+EWTIPo0fx/5azYkxs9WG8R+PEbdzWqBtMn4qRikBBEk87w5EHHEq/ZmONkZ2HikMvgi32jR67be1u/AF5jbNG9hTQUwVJN/gIqhT7K5FUb8Ify7RJsrCyIAI5Ce4XssmjabQslXiPxfcXx4VSHdVkC8F+a1eGEh/HSqT5nNxh/wOqVNzFV4U666pOd9gB21aPK05+/1hsOcQAYncesnwbUVMUPsl1GiVU5Xw9y/jh6sJ1DY9Gx2jkKPFDpQ57BVSmZryfdvUTjy26NfuoBce5S9IAToT6eNjw8BnR1Ry/oK1gPI8TF18C86uJovW4y9/JpjdfhqxZ+dOxgF/h3zcA5Qpz1/hqaanC4CD0rFucltS0Y0BlZ6m+BjDvD1S21Z+zTmwDiYnXVEWU4Kf4LS9kIS MkwlzIWc bMDpi0PMpFNGR3+x7d5Hr9rhEkMNDzYq17G0SaWbhp/apZtfdSj9bX03MTaTCKUg38Hu60GoeGlKmKq223c8A7WWCvcBMgjzxs/tZE/QUqy+H/rowqmVaNpTfhzddPHCsEFTfcGIuc0o8irF54q1IEfLJtHWLONFO8fUIuEnuhKxMDzb6eePUqCu0Z3CRIs53K1tZhozYsJOakmGA3xWpH03vVqnoHAlO66nLvhvOEHaMBFkoXi/jkfyoqHgW1tMWXKrkw9F0R1gvk/MBpTC36/fR8FT+BsshbsMBalqUdQzyPp4Pp2Dukm8++IdqdkgyA6b6h7Q5ilm37d0cTepE0REQzCwKlWXI4DEnoH3NdaTljBPSL3wmseZWSAFu5ArZkbN9GDP6TNi3+kFROhUDAZC/slUUfVFbD1S9W0bido3GDwF9J/Hd8iM3J5FARiA6rTgcKA4W80bElSmvzGeDWyRkoILvrDCshdzTVrKorHC9Uyc4gnIJ6F5m4FmTWjTC68hgUM0Jpgyabw1xQSpPmb3iNfR5pNG1RDqzsLzQgGOmYic+20gYlA0nFoWFzB59x4BSyguGMTkeu+g= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: No folio equivalents for page type operations have been defined, so define them for later folio conversions. Also changes the Page##uname macros to take in const struct page* since we only read the memory here. Signed-off-by: Vishal Moola (Oracle) --- include/linux/page-flags.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 1c68d67b832f..607b495d1b57 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -902,6 +902,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) { @@ -914,20 +916,34 @@ static inline int page_has_type(struct page *page) } #define PAGE_TYPE_OPS(uname, lname) \ -static __always_inline int Page##uname(struct page *page) \ +static __always_inline int Page##uname(const struct page *page) \ { \ return PageType(page, PG_##lname); \ } \ +static __always_inline int folio_test_##lname(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_##lname(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_##lname(struct folio *folio) \ +{ \ + VM_BUG_ON_FOLIO(!folio_test_##lname(folio), folio); \ + folio->page.page_type |= PG_##lname; \ +} \ /* * PageBuddy() indicates that the page is free and in the buddy system From patchwork Mon May 1 19:27: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: 13227921 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 639A2C7EE21 for ; Mon, 1 May 2023 19:28:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF735900002; Mon, 1 May 2023 15:28:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D7F7B280001; Mon, 1 May 2023 15:28:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF817900005; Mon, 1 May 2023 15:28:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AE1EC900002 for ; Mon, 1 May 2023 15:28:40 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 505D51A0580 for ; Mon, 1 May 2023 19:28:40 +0000 (UTC) X-FDA: 80742673200.17.239208C Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by imf07.hostedemail.com (Postfix) with ESMTP id 5D42B40015 for ; Mon, 1 May 2023 19:28:38 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=AY7R5i89; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969318; 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=M8hiVfs4v+/D1xXViLOX+gYSSXi/GMS2KWwieBJlAWc=; b=eXELGY08Jw5AFaovJQ3D0w72GDnTCRGioL7DENx/lRGSSYmEpfGzT92pAWVvC/f63HA97k udRnf5YB3Yvf31mH47VrAiGFEgB6nc1OfZwFMoDg6QFWn9lynBZMaLCX7ioRRSKQ3D/Ue9 l6XBac4jkl3ytKttY3JZrDCjJowvZgw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969318; a=rsa-sha256; cv=none; b=YT+H7dcuT0QxqpBIyhF3r9h8iXsxIVeUWT6QWTdjrOLrNo+cR52jDe0cJU/8mOMr/pegIZ gUSc4J9ctNAb5perfOntSKpkGMAedhw1Uou+9XEraXs/B+DxbUZWpSYHKZpIEhid7Rf/BS yREpWpUQ4uxw5sh8fE0dYb3CDDgmIAk= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=AY7R5i89; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-528cdc9576cso1784110a12.0 for ; Mon, 01 May 2023 12:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969317; x=1685561317; 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=M8hiVfs4v+/D1xXViLOX+gYSSXi/GMS2KWwieBJlAWc=; b=AY7R5i89uxro5jd56WDlKU8Fja36ryrUk0S6Q16X+U0ZmNOWNsYwM9UD5V7eDDQ7CL 2Tp8zG1LpWxUjW4nysKBNDYzREXSeT3FlM9ngsN5B+/pdzX19qHXjQsHi+3L0FpuArC6 DX51z91UL4SAH0JFTTT8iwQUyEwSGDC+CwqD9d2dvVW7YCy7XaJzjb77A+6boEThDAuR yo/RflA9LSDAu/9t9COb7jqY02Est+ouWn7H3Pdtze5JZEAvjpVjvI8vLLYbYiOL7/Bq zRTj3vIBIMrvJGHdN6ZHUGjTTTFWg+U9ypFlp6tV+iF0iJAPNZuT4obK8hP4ZcyyaPpG zH0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969317; x=1685561317; 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=M8hiVfs4v+/D1xXViLOX+gYSSXi/GMS2KWwieBJlAWc=; b=j7+GIKRh+tkl2ijqxnb2SWXd5LPlOfrizcM/IdvLp30X2Y5XQgcwGYxX/S0dDc+oyx gKLRGcUWrhG4cg22gae8TvD7Rxk4YlfuwD5pfXNWAaU5JM9NqmfUSCsW51Z1dVNS2NAe jU7w8mJpvM5nYq+ghF494uoPbjGG8BvgP4Kk8oErdSZnFcFEFUvk36k0138EfJTOHm5i ghh3sZpg+REQx83lgUNST4fm1PfevhkbWpWRKZ3sqqk4RPv2nSD9PAx6gjN8dcG4lHZE UHxumInfga4HxsGkosdtyDc16hT0t+tiT0PlLxo/gh/ezvUxdqRJriYWBK9oOljvYTAU dorw== X-Gm-Message-State: AC+VfDw9TIxV9EBvIKP+sO7mXTLE6YVg5MCsDkipF5FX+mVr15sHg3sQ FLrzKTAXEebfUjAEDkidwGQ= X-Google-Smtp-Source: ACHHUZ4Ql//l/srSqMxjTIGMvYKmafNUcwRHhPOehsj6F0oVzwyh2L3O7KuPKaj/60mvEgHluv+34Q== X-Received: by 2002:a17:902:9347:b0:1a6:e564:6046 with SMTP id g7-20020a170902934700b001a6e5646046mr15359610plp.46.1682969317238; Mon, 01 May 2023 12:28:37 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28: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, "Vishal Moola (Oracle)" , David Hildenbrand , Claudio Imbrenda Subject: [PATCH v2 02/34] s390: Use _pt_s390_gaddr for gmap address tracking Date: Mon, 1 May 2023 12:27:57 -0700 Message-Id: <20230501192829.17086-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 5D42B40015 X-Rspamd-Server: rspam09 X-Stat-Signature: gi15w9p4gy9xhiii8c8ktiwkdw1rcqxr X-HE-Tag: 1682969318-525871 X-HE-Meta: U2FsdGVkX18S5ZyLhitb4VuS+X6tiwhJDgFGbPlVPM7kiIo1y4oCLNM1mK9PitJ4IlwJtiQJ3ZjgVunnfJ+zBxfptI3aic/phcVxEhx3deLrjKxHMMKAA+OPALxVGtz2Nkk7JntQoBnhleDxczXIFJWLjlGkFJSTM7hUIcczD+KtjfDWTznabKc+RTEM6gG3M0W+AEhJX/T7xiUzmC9Rz7UcGfNSFrsN7NXvxWX8kJyr+t3LQpNu2tFMIx/KpXOZMudKPY32u801uC7Jzsc/QvAfZQOhPkwacwRjaWATU2Rur+KymUBY7+mQESnx8iIr6gc3+Vpgj8YYWnAzsFWsa3fcMqtltifR848ElZAcf6h2N/bB5XBE2fsBg2efWV01oQqPmSz38ZascUu2Yf6vB2fL1ZI5qQOjjwhaNy4QbKRMVdwclPhBov5nIlIk1dE+XCgwKGJf9WiFUm4WLUqmjD8qAF/9GvLZXZ71CS9HJ02rwosi5xxYUbx/uXQbhnpArTp+UDJzK7iIJ9NaJFeeFPnss8nMIo3yuMa65vP1rH1/RXyXATyfFi1oT4N6L4HXvox05XVk+vXphWMV7Bs4y3kA0nIPszopWKKe0t2kRAjaO7UjsMduZAhVeo5QbmP7QqU3s234YXCPJ7mwuzgdtjH8ypcTtI15PeizJiiBGTbS/UO8EmyGL+Adx/AieCNFwPEI78AafdFNAzVbbycjgNM1sYdcUpaUwj9CJJBJ+CX0mynigvbNeBu+P4s/qua+3xF+ktMbwM0d58oC7sx79bW8JfwXkSbG5nXRyb7lTjRBChbgby3SVnUue+YN4ZITiBNxvPxoxo4aBVjoHfH+cvjjQN0nWJO2EVKY0tIdrckmnQypS1fVBmJaIUhzbF/GvTytYhqooYqNLTW8T1cFLB5/tFc0yAkTNG5Z7ud5tGA2+GDlP7KDEjkCrzAU4lT38ktIJdPOph33UbavTWi 1uEYpuoI ksEEHlKjypzrEaG34jVsIB2Cud0XMFkexNbUnLhBKQUyacmc5OhbAzuO4qkzL0RBEki5K89xKO9ha6CNwpmgqlStWOmxPOCYK6CoUYRqu2mEiXHrZo12t0j2rKP6ouijFcsvYJEP5qS2rOaOhjOSA8AL+HD/giPxpefJQz2DsG7E944/6mC5NvZb+/4cWjtUnzdMLsPQIurhRfjCaAOmT/6OdJ15LhH8EZYvUSOOiEdqhUyjziVWDFFSQTsBH4T62pjUOEOLFb9Y/obAglk+mp+P3idaS+kKVexTgthK3ZZtxzhhzfZMqop+LLDjlr24pmcVbEnuEWRClcvpg890wJ8h9VfzBQZ7oapIS0Hbq1m2o6LSFn5I+qeLhgQsggYTB04ixWhaEp13NHf9lf/ZccYV5+gbFovmbBAVP727HSiZSZ0R4bHQ6pa5P6R9/RbqKJUyKkcWm82ShOxt2Je2+EF9AKdwMD0jpFjb/uDqiYuJ8+I+CTvuSowBJ6i/GxS7sSGZv4YwRlg3+0OHIUF/+/m1UBvdIdmxvOkc/93DtPJuxAe3LmI+5JIjGCZeBsrvIruL9KdjcB3Slx6Q= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: s390 uses page->index to keep track of page tables for the guest address space. In an attempt to consolidate the usage of page fields in s390, replace _pt_pad_2 with _pt_s390_gaddr to replace page->index in gmap. This will help with the splitting of struct ptdesc from struct page, as well as allow s390 to use _pt_frag_refcount for fragmented page table tracking. Since page->_pt_s390_gaddr aliases with mapping, ensure its set to NULL before freeing the pages as well. This also reverts commit 7e25de77bc5ea ("s390/mm: use pmd_pgtable_page() helper in __gmap_segment_gaddr()") which had s390 use pmd_pgtable_page() to get a gmap page table, as pmd_pgtable_page() should be used for more generic process page tables. Signed-off-by: Vishal Moola (Oracle) --- arch/s390/mm/gmap.c | 56 +++++++++++++++++++++++++++------------- include/linux/mm_types.h | 2 +- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index dfe905c7bd8e..a9e8b1805894 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -70,7 +70,7 @@ static struct gmap *gmap_alloc(unsigned long limit) page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) goto out_free; - page->index = 0; + page->_pt_s390_gaddr = 0; list_add(&page->lru, &gmap->crst_list); table = page_to_virt(page); crst_table_init(table, etype); @@ -187,16 +187,20 @@ static void gmap_free(struct gmap *gmap) if (!(gmap_is_shadow(gmap) && gmap->removed)) gmap_flush_tlb(gmap); /* Free all segment & region tables. */ - list_for_each_entry_safe(page, next, &gmap->crst_list, lru) + list_for_each_entry_safe(page, next, &gmap->crst_list, lru) { + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); + } gmap_radix_tree_free(&gmap->guest_to_host); gmap_radix_tree_free(&gmap->host_to_guest); /* Free additional data for a shadow gmap */ if (gmap_is_shadow(gmap)) { /* Free all page tables. */ - list_for_each_entry_safe(page, next, &gmap->pt_list, lru) + list_for_each_entry_safe(page, next, &gmap->pt_list, lru) { + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); + } gmap_rmap_radix_tree_free(&gmap->host_to_rmap); /* Release reference to the parent */ gmap_put(gmap->parent); @@ -318,12 +322,14 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, list_add(&page->lru, &gmap->crst_list); *table = __pa(new) | _REGION_ENTRY_LENGTH | (*table & _REGION_ENTRY_TYPE_MASK); - page->index = gaddr; + page->_pt_s390_gaddr = gaddr; page = NULL; } spin_unlock(&gmap->guest_table_lock); - if (page) + if (page) { + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); + } return 0; } @@ -336,12 +342,14 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, static unsigned long __gmap_segment_gaddr(unsigned long *entry) { struct page *page; - unsigned long offset; + unsigned long offset, mask; offset = (unsigned long) entry / sizeof(unsigned long); offset = (offset & (PTRS_PER_PMD - 1)) * PMD_SIZE; - page = pmd_pgtable_page((pmd_t *) entry); - return page->index + offset; + mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1); + page = virt_to_page((void *)((unsigned long) entry & mask)); + + return page->_pt_s390_gaddr + offset; } /** @@ -1351,6 +1359,7 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) /* Free page table */ page = phys_to_page(pgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); } @@ -1379,6 +1388,7 @@ static void __gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr, /* Free page table */ page = phys_to_page(pgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); } } @@ -1409,6 +1419,7 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) /* Free segment table */ page = phys_to_page(sgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } @@ -1437,6 +1448,7 @@ static void __gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr, /* Free segment table */ page = phys_to_page(sgt); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } } @@ -1467,6 +1479,7 @@ static void gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr) /* Free region 3 table */ page = phys_to_page(r3t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } @@ -1495,6 +1508,7 @@ static void __gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr, /* Free region 3 table */ page = phys_to_page(r3t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } } @@ -1525,6 +1539,7 @@ static void gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr) /* Free region 2 table */ page = phys_to_page(r2t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } @@ -1557,6 +1572,7 @@ static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, /* Free region 2 table */ page = phys_to_page(r2t); list_del(&page->lru); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); } } @@ -1762,9 +1778,9 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) return -ENOMEM; - page->index = r2t & _REGION_ENTRY_ORIGIN; + page->_pt_s390_gaddr = r2t & _REGION_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_r2t = page_to_phys(page); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); @@ -1814,6 +1830,7 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); return rc; } @@ -1846,9 +1863,9 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) return -ENOMEM; - page->index = r3t & _REGION_ENTRY_ORIGIN; + page->_pt_s390_gaddr = r3t & _REGION_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_r3t = page_to_phys(page); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); @@ -1898,6 +1915,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); return rc; } @@ -1930,9 +1948,9 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); if (!page) return -ENOMEM; - page->index = sgt & _REGION_ENTRY_ORIGIN; + page->_pt_s390_gaddr = sgt & _REGION_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_sgt = page_to_phys(page); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); @@ -1982,6 +2000,7 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; __free_pages(page, CRST_ALLOC_ORDER); return rc; } @@ -2014,9 +2033,9 @@ int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr, if (table && !(*table & _SEGMENT_ENTRY_INVALID)) { /* Shadow page tables are full pages (pte+pgste) */ page = pfn_to_page(*table >> PAGE_SHIFT); - *pgt = page->index & ~GMAP_SHADOW_FAKE_TABLE; + *pgt = page->_pt_s390_gaddr & ~GMAP_SHADOW_FAKE_TABLE; *dat_protection = !!(*table & _SEGMENT_ENTRY_PROTECT); - *fake = !!(page->index & GMAP_SHADOW_FAKE_TABLE); + *fake = !!(page->_pt_s390_gaddr & GMAP_SHADOW_FAKE_TABLE); rc = 0; } else { rc = -EAGAIN; @@ -2054,9 +2073,9 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, page = page_table_alloc_pgste(sg->mm); if (!page) return -ENOMEM; - page->index = pgt & _SEGMENT_ENTRY_ORIGIN; + page->_pt_s390_gaddr = pgt & _SEGMENT_ENTRY_ORIGIN; if (fake) - page->index |= GMAP_SHADOW_FAKE_TABLE; + page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; s_pgt = page_to_phys(page); /* Install shadow page table */ spin_lock(&sg->guest_table_lock); @@ -2101,6 +2120,7 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); + page->_pt_s390_gaddr = 0; page_table_free_pgste(page); return rc; diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 306a3d1a0fa6..6161fe1ae5b8 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -144,7 +144,7 @@ struct page { struct { /* Page table pages */ unsigned long _pt_pad_1; /* compound_head */ pgtable_t pmd_huge_pte; /* protected by page->ptl */ - unsigned long _pt_pad_2; /* mapping */ + unsigned long _pt_s390_gaddr; /* mapping */ union { struct mm_struct *pt_mm; /* x86 pgds only */ atomic_t pt_frag_refcount; /* powerpc */ From patchwork Mon May 1 19:27: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: 13227922 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 BDCC0C7EE26 for ; Mon, 1 May 2023 19:28:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 284C1280002; Mon, 1 May 2023 15:28:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 20EDD280001; Mon, 1 May 2023 15:28:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F2C5E280002; Mon, 1 May 2023 15:28:41 -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 E409C280001 for ; Mon, 1 May 2023 15:28:41 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B5DCEC0774 for ; Mon, 1 May 2023 19:28:41 +0000 (UTC) X-FDA: 80742673242.06.2904745 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by imf06.hostedemail.com (Postfix) with ESMTP id E3E0F180005 for ; Mon, 1 May 2023 19:28:39 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=B4azYqsU; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969320; 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=bmbsS8DkaHNij/v9bdafzBlktB7f+f7NAeK2Q02GvbI=; b=v3HK+ngStcnrvgTbUYa6jvAnPfRmYrXw/GL3ShYOjIyhCyowT+DBMCrMG7DEsnyZorn/b5 5Ns96M1MZ66WhjRQmX2kpAbnbofYzfFSFAIJtaLuGzVVG/KneTE+Whu01nRs+BXEeJzUVD 7YdcM6fwW2e2Vsy5Unb4JUxbpmCh4ds= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=B4azYqsU; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969320; a=rsa-sha256; cv=none; b=8HAnV3+nfeDNyBXJ02k1PQ+KFqsQLLkDDbst+ONg7PweGkTltp3kyp9047Cjkz211kzpZ2 xS9mQm4eHYhhiBHAX2MHY1OXB0bN8V1WXO/AUbEH8+edtFbujRlndfiL7lSRjLmbHk7KmO CKy/1gpvhDgNT+Wog1rFQZIRpZNY9X4= Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-51b33c72686so1828624a12.1 for ; Mon, 01 May 2023 12:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969319; x=1685561319; 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=bmbsS8DkaHNij/v9bdafzBlktB7f+f7NAeK2Q02GvbI=; b=B4azYqsU+PZdNT5sPYRuRynEP/yG+nnQZzCwWNiJuBYZMp7zK7WPiFNkyYATyiWLs9 KXu3O4UXjROzHmg5BH+SgHHBIK4HaE73RnqEPc9ZoVRSl4Uh4CCXlTE9MpnCo1Ir9cR5 1tT0IRumxWPV12suNOkG+VwHWOIH3Na7v0j8RESqGnAScgYPrOMUDDIHfUYdpmcQFIY7 vF1i0igsbLRBnZPi2HEPlzfFt+R0Rd+c2dVX9RoHx/GLiWbMDfrtbVlk0iN4TeEGJT4d 1bO8trvKRg+pq0Q4NgCg3JPagFS7MkJj/4qfBc8P2r4TUch12xgUcUg4F69rFfadNKuw 8vIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969319; x=1685561319; 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=bmbsS8DkaHNij/v9bdafzBlktB7f+f7NAeK2Q02GvbI=; b=aFhQsYZgcxp83M4OML5qODlE6J8kRXx8wuP6l/hLaXCOs+OrvcBuDYdJNF0uefbXeb GqnFlof9SNjQXGQ0ei/eJyIe0mK55xeFJIkY+3CIAUSkbp4xmuAhdxQ8+Mvw8j9DO824 oSOjVrERIXCd1TUjjKwiYOY8aCEf3KmYUNzes5iCL/ENQSePl1qEeeeSHKGmfzDn+LKj X3NnmYXcde5N2b6DvDTY2Mt63yfr1uCSyhmUxl1MsgOtBpdvdHBkj1ZjBgfjeyOlHDyF +WuToD+H4XLRmmueiXn2SO75xWQP8oG36+4yE6VLW4k2g5z0j0T8vqFEv8zX47wTH2zX dcug== X-Gm-Message-State: AC+VfDw5s6tvnpklC7em7LuwgFzkEQ0jg8M3Nvac5H61f8nHwc/L3bOv QtX2ffncNJnqjNrNkiMaaWU= X-Google-Smtp-Source: ACHHUZ4E/JVh2DFvUW/bEZgIHPiMJ+Zfpw7pvXWZYNeWA42FHZxnOhQrWiIO3kxV0xxzCmUatMgqYw== X-Received: by 2002:a17:902:8c91:b0:1a9:2b7f:a594 with SMTP id t17-20020a1709028c9100b001a92b7fa594mr13894676plo.29.1682969318714; Mon, 01 May 2023 12:28:38 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28: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, "Vishal Moola (Oracle)" , David Hildenbrand , Claudio Imbrenda Subject: [PATCH v2 03/34] s390: Use pt_frag_refcount for pagetables Date: Mon, 1 May 2023 12:27:58 -0700 Message-Id: <20230501192829.17086-4-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E3E0F180005 X-Rspam-User: X-Stat-Signature: hxffytdtu1y3hro6hy8oo7fczs3hpwto X-HE-Tag: 1682969319-701198 X-HE-Meta: U2FsdGVkX19F/o6Da+Mj1sBQYavizNSVIGmdT17sEobWjBjW7r3mxTDC2vrrzbk9wSCIi5e8n6XuvstdYI9AIMuqrHgJMNSCmJ0S7rQ+tuMvtGGly2ACvKJWC0kll3SNBH5RBDbkyFu9kbuYoOQfoVjb6Kl9AD8dgwKObKHt+8rPe+rozjpAx743JtuAZBvKt8z2E0pScUSI+M7hoDWeRP4c4mX+1nCHFjTuTF4KxdKAV35ZUV2JVFXjlBduI3ioa1HleTmHOlar0FEdBq2ZgJM1sSnRsOtzHJlIdCL4ZMoYjAHyBlrDpjk3UVXrjrcoYhKEiKVhrQo2Qd5q3PxGqWFApSy3O53y9dZOWaABsi7EMCL1iPDcc1w3/jgPk2G6tWFqwz6+CDBTPebuKp9sJ4eFeKXbbLPI6AuHq9jPa1RZqjUQfwEhV/VAzDWTkDIKDn3zgag121Taxmy6iDC6DoXkFusZyFEtP6sFlNMIJQjHUkLZr7DjmIjScWP/slMrDtnEWJSHkXjhXjUQcGUT5CGRJ6covH3vlBXCR+zpxx4pHHM9MHVniWM9LmN3qigjsUeRhIETjZ+UXq0N0uOE6QMuRPUxU/v34IvXpUujalpK2bprH6KL0S4FTXDASJNHcteOBS0JbNuXXEhuCPZBvBhNLUAr2hiBct561GGApI38hP4q8yR0T+ZHnXeiALW+isRfKlJXBTpc5fhWi9t0hviwjT8jE64alJM1DUBwkySHR+lT89rVcGuKatfEgDrXgNem3lXBq8HD47nT/lGjVlGpMZRwXari9gqE7D1JbzO+SfrGajAggB0k/VQjo8uYV6dUWNkIndSen3iAAd1xDckb67lgd91fxGri7FnYmyELZSRqRJGVbtsPE8qhqqbNLohiD0bZsWqPLnl2ZwH6SHDXIlzcmr0EdnK5XR7zkeQNitOG5ODIvm42V8OZFcE3sly+Wbgs+F97mz0k7+Q Vk6OIMbI oq+49eEdTwxeDApRjXjCOQvkMd58f6ALWSV5yDo+oECKYho9DVBDWqPEyMqnvu4MKaeovXVrMJ4ELQZjCHofGRZHdWNubXbEJWsOhgm9TGnknlYcRd2uxjVnPfNjwUGR+2FQ0rbz15eXEL4x20AE4aatK3HVZei9RWf8Nhalr1WoI2inzISlRAb2JX5cogwTCiHvVGMpAmmqvx+qBt/rx0JFgEztfBzWCMbPH3BIIe95yqtlYDnp4CbuRa3BP8P6to3/yifM0l6VjtyIImLTHpJ4+jt8XMA5GabhsFnTsakAkTdNTaaI+hUyU4VC+jIaHwICenhhVKs/N3CtiW0RtHZz07j0RoOPzzyC1z+Evek45lAoIPPxQ1dr8BJ9HaSHL7ZaXktsbNx6GBqSoyoD6rhflJJAw3qGQbPTfMy6TRXIMU5iHomw9oYUScf81YhrCPiGrjNMuoLhdqXPsofm55hAdNOOQ1Xhjemm1r2VkulFpAEhVAScCAtElL+oUsxE4FgwzG+JUaH0yG1HtXAB893pbQsOKOxoUmXaO3pR4+KRqo099Kg2rDbNf7QQE4f47yMe4WG2NFz3rySU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: s390 currently uses _refcount to identify fragmented page tables. The page table struct already has a member pt_frag_refcount used by powerpc, so have s390 use that instead of the _refcount field as well. This improves the safety for _refcount and the page table tracking. This also allows us to simplify the tracking since we can once again use the lower byte of pt_frag_refcount instead of the upper byte of _refcount. Signed-off-by: Vishal Moola (Oracle) --- arch/s390/mm/pgalloc.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index 66ab68db9842..6b99932abc66 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -182,20 +182,17 @@ void page_table_free_pgste(struct page *page) * As follows from the above, no unallocated or fully allocated parent * pages are contained in mm_context_t::pgtable_list. * - * The upper byte (bits 24-31) of the parent page _refcount is used + * The lower byte (bits 0-7) of the parent page pt_frag_refcount is used * for tracking contained 2KB-pgtables and has the following format: * * PP AA - * 01234567 upper byte (bits 24-31) of struct page::_refcount + * 01234567 upper byte (bits 0-7) of struct page::pt_frag_refcount * || || * || |+--- upper 2KB-pgtable is allocated * || +---- lower 2KB-pgtable is allocated * |+------- upper 2KB-pgtable is pending for removal * +-------- lower 2KB-pgtable is pending for removal * - * (See commit 620b4e903179 ("s390: use _refcount for pgtables") on why - * using _refcount is possible). - * * When 2KB-pgtable is allocated the corresponding AA bit is set to 1. * The parent page is either: * - added to mm_context_t::pgtable_list in case the second half of the @@ -243,11 +240,12 @@ unsigned long *page_table_alloc(struct mm_struct *mm) if (!list_empty(&mm->context.pgtable_list)) { page = list_first_entry(&mm->context.pgtable_list, struct page, lru); - mask = atomic_read(&page->_refcount) >> 24; + mask = atomic_read(&page->pt_frag_refcount); /* * The pending removal bits must also be checked. * Failure to do so might lead to an impossible - * value of (i.e 0x13 or 0x23) written to _refcount. + * value of (i.e 0x13 or 0x23) written to + * pt_frag_refcount. * Such values violate the assumption that pending and * allocation bits are mutually exclusive, and the rest * of the code unrails as result. That could lead to @@ -259,8 +257,8 @@ unsigned long *page_table_alloc(struct mm_struct *mm) bit = mask & 1; /* =1 -> second 2K */ if (bit) table += PTRS_PER_PTE; - atomic_xor_bits(&page->_refcount, - 0x01U << (bit + 24)); + atomic_xor_bits(&page->pt_frag_refcount, + 0x01U << bit); list_del(&page->lru); } } @@ -281,12 +279,12 @@ unsigned long *page_table_alloc(struct mm_struct *mm) table = (unsigned long *) page_to_virt(page); if (mm_alloc_pgste(mm)) { /* Return 4K page table with PGSTEs */ - atomic_xor_bits(&page->_refcount, 0x03U << 24); + atomic_xor_bits(&page->pt_frag_refcount, 0x03U); 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(&page->pt_frag_refcount, 0x01U); memset64((u64 *)table, _PAGE_INVALID, 2 * PTRS_PER_PTE); spin_lock_bh(&mm->context.lock); list_add(&page->lru, &mm->context.pgtable_list); @@ -323,22 +321,19 @@ 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 >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, 0x11U << bit); if (mask & 0x03U) list_add(&page->lru, &mm->context.pgtable_list); else list_del(&page->lru); spin_unlock_bh(&mm->context.lock); - mask = atomic_xor_bits(&page->_refcount, 0x10U << (bit + 24)); - mask >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, 0x10U << bit); if (mask != 0x00U) return; half = 0x01U << bit; } else { half = 0x03U; - mask = atomic_xor_bits(&page->_refcount, 0x03U << 24); - mask >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, 0x03U); } page_table_release_check(page, table, half, mask); @@ -368,8 +363,7 @@ 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 >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, 0x11U << bit); if (mask & 0x03U) list_add_tail(&page->lru, &mm->context.pgtable_list); else @@ -391,14 +385,12 @@ void __tlb_remove_table(void *_table) return; case 0x01U: /* lower 2K of a 4K page table */ case 0x02U: /* higher 2K of a 4K page table */ - mask = atomic_xor_bits(&page->_refcount, mask << (4 + 24)); - mask >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, mask << 4); if (mask != 0x00U) return; break; case 0x03U: /* 4K page table with pgstes */ - mask = atomic_xor_bits(&page->_refcount, 0x03U << 24); - mask >>= 24; + mask = atomic_xor_bits(&page->pt_frag_refcount, 0x03U); break; } From patchwork Mon May 1 19:27: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: 13227923 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 483C3C77B73 for ; Mon, 1 May 2023 19:28:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C236F280003; Mon, 1 May 2023 15:28:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA9B9280001; Mon, 1 May 2023 15:28:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A2400280003; Mon, 1 May 2023 15:28:43 -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 93A48280001 for ; Mon, 1 May 2023 15:28:43 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 48123160286 for ; Mon, 1 May 2023 19:28:43 +0000 (UTC) X-FDA: 80742673326.26.2D45307 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by imf20.hostedemail.com (Postfix) with ESMTP id 721DC1C0016 for ; Mon, 1 May 2023 19:28:41 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=BSfSX498; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.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=1682969321; 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=B0Od9Inc5y6h3dSbsHmdGR20xSLs7HxIKZ/fFcl7OHg=; b=ZRdDLJtRVEZR4M7v3NB8zAwJvf8QXMbtc3NSuos+OLsfeJhoM9IPScm7gfbhqOJTetcXMZ scC7zyw0VIpM6tUgKADB7GP+oje3itKbMISXqJrl8Sr/BJbQu9iTNDR01m3w+9gciE4qS2 HXJI8O+sm8HuAcJJ1qITN1xumcpiSPw= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=BSfSX498; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.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=1682969321; a=rsa-sha256; cv=none; b=RZFOY5kFz0ocBYZASCIKcgwGygVXAQe3vmSHWoHD5vrXj//3nMNRGh1FuG/bfIbumF19bI 2rQO/gO01ZcN9H1eLIjHtiRFDlWa71mg0Mh1GFx77tzh2wi4oRRe/nWOO5QMuD3a1/wSzx napNvsN4Dy3kEcz46lmmyoUqaHievuU= Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-63b5c4c76aaso2032684b3a.2 for ; Mon, 01 May 2023 12:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969320; x=1685561320; 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=B0Od9Inc5y6h3dSbsHmdGR20xSLs7HxIKZ/fFcl7OHg=; b=BSfSX498+nRsOwkOZCv/c3TfiIzHvFrBHqOPXzZnUzdOTpraA1SFYJQ7S9OlNSy+oo SgKJwDZ3qC6C//XEAcYljRcEjgHnyeaNoyhEAyOx7Ys6/3k09Ik8CgCQWIiXukHyuWI8 JqooqMgdLQ1gpcR/L/mcYK+KZEjEg+InGInQqZs8g+xQwi3fiMtnPj+o8uf54dHCG0nD x8PpX8tpE3nfYMsr6vBPGSrBk7IqcdW9rAQJxVfKMF33+mjDorfNig4J/P1XioZbWwxD uXByeI5tsaD8qrYP2W7mncKrp6aQydR1tjw1T6sz0jLjo8cvDXE3/58iahOtRXOU+sGT jXsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969320; x=1685561320; 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=B0Od9Inc5y6h3dSbsHmdGR20xSLs7HxIKZ/fFcl7OHg=; b=Bwny+Uf2U5EIL+k5k3XLbF2Xmca1jWU2FzbTm5i0F9Z8k5MHpdKP5ya702YHFQK+yo 9gTI9PgR9+WuV77aibs0MJT+yiC7IWLUHo4SZ8S4/nkKV4t4puIY4d/rPja0wyd9jOW/ 7b+VqIUryZTCfHy0tZcbn8Q3VDx1XTxUgfqQaHPmPA+AZ6PEk8xe+6nGL3oR5xQVYfYb KzsJyTZjZLTcWlCQVUmWfUIXctjVw4vgqzFryEWJTwhX+YEgwcKjpsJJTZhDF3lpZl+S vQ2b7yZq+xWDip3VhlTZZPMTTq1rJjE1U2DeGVvhaHTeMdJftgit3mnSBdvw+aUhQQ9v /tqA== X-Gm-Message-State: AC+VfDx8EqVXDonQnpIwtCzEoJG8IxtfK6CoHF9eeYpXo8fMQCwpEH7+ La6QVT5HN17kQSY9pT8XGXw= X-Google-Smtp-Source: ACHHUZ5c/2Ko6MMnlJILdIHFSiqsi7woH2pp9LXJUwyBETBH//ZWHg6e+tUlm1aX3nzTckKQE2QL/Q== X-Received: by 2002:a17:902:d2cf:b0:1aa:ffe1:de13 with SMTP id n15-20020a170902d2cf00b001aaffe1de13mr2810716plc.5.1682969320162; Mon, 01 May 2023 12:28:40 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:39 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 04/34] pgtable: Create struct ptdesc Date: Mon, 1 May 2023 12:27:59 -0700 Message-Id: <20230501192829.17086-5-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: kozxrf1zm9pawj374eqny88pjg1qpmqy X-Rspam-User: X-Rspamd-Queue-Id: 721DC1C0016 X-Rspamd-Server: rspam06 X-HE-Tag: 1682969321-959432 X-HE-Meta: U2FsdGVkX18dGaFwbofyve2sXED3LB80jjQnqgIU1qCMtSjsnpJCS/1p1J/BUKv0ahXdx5ZUqY5+GSTcUV5MQXTYIssIndj7xo2EoTgktsWLNQiJocGM0ZzEgxKJ1Lg4/SnonZbU6QHres69X1FZTaamm4XSOW8zvpjZaFZ+tQEphj++UQcKptVrDMlc5rRbebbqcJ3tbr8TxvnkE3h30qHMc6gEL99RvVqyEJ2+60pVfef3cav+52lsgwJkeNqsjE3mXvxrHzqfbP2M3ajQzwJu/8ckrQUM7B16efhtb7BJqaQpPGFfMgleE7FbI35e63tIVBFITagY4+015ziasgCf+4BBymderzbm3a43vjJejfT/fY9/rXxgsfQ2jERPvagHpcVTSLzMremSWgtzpNsIdKDnlpYFBcZBkQfCoJMmHiJkwI9zUd+7gOPND9JOm4AAWHXBArdaaUvB/j68UfMZ43wOZFkbToilR2YuUsljkPBbY2J5Y6cepVaiWAGHQHAFbgDSQULy1p6sU/48xrpcmpzO1w9L8oZcXUEdq+dZjAFBrqe+c8FyvBCkGNNmAbp72/TyOBL7IHFtHn7H3TAIjMwQ2D3YmYjQVo32rvTHv8PZdaKcbC9dS/GARtUWwS1XfxggixH0rnqQ1rupih0ZJNLQ6Rt3VOvKWnJUUaPq3ApYpWk8/TGoWmP2mjuDnXkgNqc9gaxeIzev5PHd2L9DPgKqoPM+06ViPEJBhfUOtUf7ExceaBeW7EUrpKNHEq0z4dYSIjutpK3ZWMoMFQhsazUdtK+2HEDeIq3tnSrW/z4ADyozIQ1u5tr4CIySQehIizMyfDay5uwsJ64fbhWAGQojg0tIXRa1Riy5bRAp1jsIgbHNCOK8KmtJMjh2AP/CMKD4Oj7ku0zeKt+TkwdoTTaB50QeVDFU3A6sGLA+Pje4/LTPvLXi47BrOMeej+m6crUyTyn83ee2cPF Fu3jntdN OjlebuP+OpCffT/uZWZhxSkd51R/lmI/kzziqTEKIsJ56ps3K3AtfogaE4Gv+HkQgwXQYnHC6qRx8Otf8aDZyS2dBuYrIk9Xk2xiQ0k6x8048xUfXF2CyoRVZobq1QQ+pYOn0hlzXO7HNaDLqHN9c5dt7X176iibp3V0S5mTcVPSqd9UoGVo4nX88BTYcrYA6wdhJmuust+/inhPahXNwABuXXvJs2DPSjlAguLe9Yme47TvT3rREV8lQVkrj/h9hmpJKQnetYKFvZciqVlv+Tki9FN5CCL/nKc0NpweNDjRrQOJY/EcgkFzY0/CWyOIGB0Q16+H/frgIQwR24YMe4vA61Cx3QghalkOyEKD/677imIlsGQNlfY/zqmxqST1gdUCyeu5XpAslwOGZvGFRjc36V/WKf6VudQSp26Loo64XwtELDePPwydFanNbIFs+x7OzUby4oo7aFjWOAmS1E06JbKzhWQsXUsdsmtmXmdMnVFr5AkMg+1mZvsi8Yblm6UvJicsOOkpacikn81yDvp1/WQ== 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) --- include/linux/pgtable.h | 52 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 023918666dd4..5e0f51308724 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -989,6 +989,58 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma, #endif /* __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION */ #endif /* CONFIG_MMU */ + +/** + * struct ptdesc - Memory descriptor for page tables. + * @__page_flags: Same as page flags. Unused for page tables. + * @pt_list: List of used page tables. Used for s390 and x86. + * @_pt_pad_1: Padding that aliases with page's compound head. + * @pmd_huge_pte: Protected by ptdesc->ptl, used for THPs. + * @_pt_s390_gaddr: Aliases with page's mapping. Used for s390 gmap only. + * @pt_mm: Used for x86 pgds. + * @pt_frag_refcount: For fragmented page table tracking. Powerpc and s390 only. + * @ptl: Lock for the page table. + * + * 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 list_head pt_list; + struct { + unsigned long _pt_pad_1; + pgtable_t pmd_huge_pte; + }; + }; + unsigned long _pt_s390_gaddr; + + union { + struct mm_struct *pt_mm; + atomic_t pt_frag_refcount; + unsigned long index; + }; + +#if ALLOC_SPLIT_PTLOCKS + spinlock_t *ptl; +#else + spinlock_t ptl; +#endif +}; + +#define TABLE_MATCH(pg, pt) \ + static_assert(offsetof(struct page, pg) == offsetof(struct ptdesc, pt)) +TABLE_MATCH(flags, __page_flags); +TABLE_MATCH(compound_head, pt_list); +TABLE_MATCH(compound_head, _pt_pad_1); +TABLE_MATCH(pmd_huge_pte, pmd_huge_pte); +TABLE_MATCH(mapping, _pt_s390_gaddr); +TABLE_MATCH(pt_mm, pt_mm); +TABLE_MATCH(ptl, ptl); +#undef TABLE_MATCH +static_assert(sizeof(struct ptdesc) <= sizeof(struct page)); + /* * No-op macros that just return the current protection value. Defined here * because these macros can be used even if CONFIG_MMU is not defined. From patchwork Mon May 1 19:28: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: 13227924 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 0290AC77B7C for ; Mon, 1 May 2023 19:28:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E1C83280004; Mon, 1 May 2023 15:28:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DCE4A280001; Mon, 1 May 2023 15:28:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD130280004; Mon, 1 May 2023 15:28:44 -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 AEA1C280001 for ; Mon, 1 May 2023 15:28:44 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8B0751C69D6 for ; Mon, 1 May 2023 19:28:44 +0000 (UTC) X-FDA: 80742673368.14.042535B Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf13.hostedemail.com (Postfix) with ESMTP id B01282000C for ; Mon, 1 May 2023 19:28:42 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=LLYF3e7E; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969322; 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=AVVNU1/Z0e3e15xLpxnmg1YI8sj9yavBZMAv1HCyq4s=; b=ZHGr8jM+KeRjWyDmYcnxUFbU4v2kFxZRUFHmNOtfDDxkrigWhFpkAaQoxhC/Z60lOcmpUk Ha/Ko6ossXkQUbsA4maY3Xp1geBDfv7x53AA43pDNH+d0NSnDP2xiQg3u7xpSVUIB97Wsz eR2q2OSnrDMMHlGbbWWBwoocDeF1WgY= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=LLYF3e7E; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969322; a=rsa-sha256; cv=none; b=K6h+81sLDEIZ+2klQM9+H+vJnh5v3o1LaaJoErOqPTpkIvkNtl1HT+LyN2WzYoA+sqRsiq hdR1WYdAKvei62IB43ZJMGkFOVESrdkk+hPyNpv4Z3s9bUIn7hIikZCkxjrYsQ8GOd3zCZ j95Aago46S5F2PmNq4dJP4VqrqWAXrY= Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1aad55244b7so19085815ad.2 for ; Mon, 01 May 2023 12:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969321; x=1685561321; 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=AVVNU1/Z0e3e15xLpxnmg1YI8sj9yavBZMAv1HCyq4s=; b=LLYF3e7E/amT0QC9X83jr8STEh2LEyhiKwXOflj4vOGUUQ80STkux/B3tsBPRR+iZs Z8PEklKtnrf1ANY0yS+7B3mEyOHWcYHngOK95uUUv6xkoIQMHojULkOYhoKI4Ni0FrP2 S5NHFGXLQHvwvsG30gws5NVKvTRiKsyEh3YkA8qvjSZ3/KlMdDYEuevU5tP8u4iNYhu8 1xlMd7KFd1vYjOGrW/3tOSP+nbu4BvTDU3KzWxrFnBRpLAae4H3q3HG2nt2iYhftpMs0 U6/yXrewj3zrB5xufQ+HtnH4MYxc4pcXaT4tSeTPWcq6jVXUA+PWNym9caGo+Q16VqPL FcqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969321; x=1685561321; 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=AVVNU1/Z0e3e15xLpxnmg1YI8sj9yavBZMAv1HCyq4s=; b=Ho2ZdHBgHOpUHhcgokdGmdZ/fX1KrAhvJXsCf5q5lcJorDYcIktmak0n59PT6eDrA9 nXN10tpnu+sNmEAsLWwSD2eK3v5FCUDec4cPBL2G4J0SAbX3NN9W7CYNTC7x2Hz9FBIb kU492VIwcWsjhogMgC+wR3EAr8VYexKh2xenHXAOgSn+C8Qh2R/MJiFdq96TnwNcqvx1 wW6Lb2Z7Se5mttssMW1kStiBKn2VzmYUZ7tw5ZMtQsukBPKX1aDXwVJIFmCWxH4NgvmO WGDx2GLaAOPj58Q4KHkBv7DHZiFjs1LmKgdQR/EdMmIBJUWMWOli8zGFJekLT5VovHKw eUpA== X-Gm-Message-State: AC+VfDzCYIO8s+OYvB+A+wpceqKFb4IwAYNDXt3pJTqr+nvdGtvu6ovW xJxN3FhDrtseykxDeMZ73DoHZKJunxuz6aca X-Google-Smtp-Source: ACHHUZ5YKwOgPLgh0+tsSaYrcdi28QhyEeU0Z2KklUkfZ7L+H63PFxAPQAkXwR8Vmhp1bd6sZvpxeg== X-Received: by 2002:a17:902:f814:b0:1a0:50bd:31a8 with SMTP id ix20-20020a170902f81400b001a050bd31a8mr14734719plb.26.1682969321461; Mon, 01 May 2023 12:28:41 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:41 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 05/34] mm: add utility functions for ptdesc Date: Mon, 1 May 2023 12:28:00 -0700 Message-Id: <20230501192829.17086-6-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B01282000C X-Stat-Signature: 8uzna4nc5dmwefh6dqrzaisohnarqcr7 X-HE-Tag: 1682969322-349557 X-HE-Meta: U2FsdGVkX1/wg49Oq9Kss1wWtx5leSFc7lQR4uM23I7Vdqb3BhTogoxMpF5TwYJXegL/L1EPUlTDditmGwm/92/56qOnSOdWUEM0HJ61A4mt9UYxWQEJZQP+Y5AGIZiFThW7Te2okSXKU3ieJuaJnIWRuo2L+ZR8j0A5jM5sC2c4GOOVOfkfzgf5XXeo8TRKqi5C0J7CJCkQdpCPBfy5Atx8YPFZ5RwlpVRATgmHVjDM49x+bm0K9tbGyhcn5Jxal/kzhMsAsVC/NLI3k3g1Tb90/tbL2SfNS4yg1xj5PrjbwWxqSucPZVNUORbE3V5olWTQmICdlrx3HS6FDOUvaJysuwl8bmxjZtsyAL/6GHnPs9y+DrCRDdn+ffpt1DzoIhRyuKlEWaoXNIyYUA4aRN4V6KjOCX3Tti0MdvOq+osbx8zjdPBlkJMthDSMsmkqltM1+zv2IxAavVtVUBxD0QzXmWFHZRAkrdFaM7uytjLPk/+uWGJJ/aIYLT+06RyXv4PaMFL9FQoemrC/ZNZtmWG2dMV1urmR/hD73rFWq3sWG0VJlCoAFltsspKhwHsPrZ/OTkSSveaRzgtw5y5YmwSyL9dr8vjvm+Hu7x88zIy/yzjhAXYMoDI1+gu/O7WMJxYTsrgPxas7cQjJKrocVOtni/BgyzpzSm4rYl0Orh0Mov8erDc6FGRdkk1VUsXM4hHlluooBT7St1D2E/vUCD3d3jvhM6cRR8osu80OBYpf8Ev7lamRpOH9oDgFH4abvVAQTtd5QTDwTLh0zXEh/gdOBCKs9QW5Xz/G/1zK8EWldMH6AVKhiJFF8jvMF+uyNB+zLmnUYdj0qMlptaI8GgOSyYkNSiTXI1+60BfmZwpR+F5zU6ZFR7UDvS/WAIr462KdSw/gU2V2C6gsGvmVAukilpWAu4RXRkbBdTEx9fE1nC3zCRXFcBx9pTjLmSGHO1jp8Fsmmu7MQNRibA9 IHD07Xtv iURxF+KFL9QIVLScBpipEuq99z1JoPlLzrKSUSk3woH6d6r/a4zZFKwnz/1AO80FQQeNPEvtwAnwmBCZ7F1LGehkmGtxWEqguyXaoUaeeENakjKvNY6TcK/hFx116FaqSSyEmB7hdPNQ77YWIaEZcaQLjkOIIsRAVxhzI5pZc9qgJTa+JQJIFSR3mQFrhuKOJTWc2AGnfTg3n1HkNI4HQR99onKuyHEncktqRp2HzrJ49Dy0RPkgOxe80lYlqFEhjJkYyWfDrVn4YPBT3hiKgYePu7NxVD+JEgf8fklFdUR+ShJ6nae8EVQoPXNXXJClc4TrS6HDtpGUDD4/zYPVcNPWLcwEJcAWfIkJ2wxIap+NmN9hqk/65XuxFD9je7ntICxoOZQonGxcbf0CyZgMhdLKE7GtFGJoY9NHz7KtviHNkE4GVy81jOyH5a5k7mk1eMzamc0mMMICPmL8ClR5k4fY1Madh7kMhjem+HuQaGQhAN+TsMl30RzSh7jOEMT/qvZuFTu1fdpjAgHPQ0h4iCSauqQ== 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. ptdesc_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 | 44 +++++++++++++++++++++++++++++++++++++++ include/linux/pgtable.h | 12 +++++++++++ 3 files changed, 67 insertions(+) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index b46617207c93..6bade9e0e799 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -481,6 +481,17 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) return tlb_remove_page_size(tlb, page, PAGE_SIZE); } +static inline void tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt) +{ + tlb_remove_table(tlb, pt); +} + +/* Like tlb_remove_ptdesc, but for page-like page directories. */ +static inline void tlb_remove_page_ptdesc(struct mmu_gather *tlb, struct ptdesc *pt) +{ + tlb_remove_page(tlb, ptdesc_page(pt)); +} + static inline void tlb_change_page_size(struct mmu_gather *tlb, unsigned int page_size) { diff --git a/include/linux/mm.h b/include/linux/mm.h index b18848ae7e22..258f3b730359 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2744,6 +2744,45 @@ 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_head_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 ptdesc_is_reserved(struct ptdesc *pt) +{ + return folio_test_reserved(ptdesc_folio(pt)); +} + +static inline struct ptdesc *ptdesc_alloc(gfp_t gfp, unsigned int order) +{ + struct page *page = alloc_pages(gfp | __GFP_COMP, order); + + return page_ptdesc(page); +} + +static inline void ptdesc_free(struct ptdesc *pt) +{ + struct page *page = ptdesc_page(pt); + + __free_pages(page, compound_order(page)); +} + +static inline void ptdesc_clear(void *x) +{ + clear_page(x); +} + #if USE_SPLIT_PTE_PTLOCKS #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); @@ -2970,6 +3009,11 @@ static inline void mark_page_reserved(struct page *page) adjust_managed_page_count(page, -1); } +static inline void free_reserved_ptdesc(struct ptdesc *pt) +{ + free_reserved_page(ptdesc_page(pt)); +} + /* * Default method to free all the __init memory into the buddy system. * The freed pages will be poisoned with pattern "poison" if it's within diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 5e0f51308724..b067ac10f3dd 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1041,6 +1041,18 @@ TABLE_MATCH(ptl, ptl); #undef TABLE_MATCH static_assert(sizeof(struct ptdesc) <= sizeof(struct page)); +#define ptdesc_page(pt) (_Generic((pt), \ + const struct ptdesc *: (const struct page *)(pt), \ + struct ptdesc *: (struct page *)(pt))) + +#define ptdesc_folio(pt) (_Generic((pt), \ + const struct ptdesc *: (const struct folio *)(pt), \ + struct ptdesc *: (struct folio *)(pt))) + +#define page_ptdesc(p) (_Generic((p), \ + const struct page *: (const struct ptdesc *)(p), \ + struct page *: (struct ptdesc *)(p))) + /* * No-op macros that just return the current protection value. Defined here * because these macros can be used even if CONFIG_MMU is not defined. From patchwork Mon May 1 19:28: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: 13227925 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 6EE9EC7EE21 for ; Mon, 1 May 2023 19:28:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 654B2280005; Mon, 1 May 2023 15:28:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 60802280001; Mon, 1 May 2023 15:28:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4578E280005; Mon, 1 May 2023 15:28:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3351D280001 for ; Mon, 1 May 2023 15:28:46 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D648A8085F for ; Mon, 1 May 2023 19:28:45 +0000 (UTC) X-FDA: 80742673410.02.2271CF6 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf11.hostedemail.com (Postfix) with ESMTP id 079E040004 for ; Mon, 1 May 2023 19:28:43 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=lFLswDg0; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969324; 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=0Ii9PvRdhTMRqBop+JFdKAWa6G/XpZkmB9p8iHmrwUc=; b=Ply6+Ow1EH/19RzMBd8KT09G8oU9Psz+lwOprimv1YIi89BKCpwOP3rO752PhnYKQDDF4s 7K6FutjuXZWXGoEq5EMixN5CNIGliSVVchhI+jpA3CKPPtl6QsJDMT3avCvgiAxU7t0Hd7 md0bcxaqdWyVfPU9yRTASOTpUOz+nC0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=lFLswDg0; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969324; a=rsa-sha256; cv=none; b=s40Q3eGEfzlcGSBIYtG0oDXMiDoF5DeZ8C8STOS0QnmO9APUD/LLNgGRrFd6pgFkGCyxIp IcHNgaoPp8t+poTuim1xFDRWT0uWGRok08MBJmoIicl5rn2OksqwFf+B1TUF1XOwLdgLU3 o/x2qZOr7tKwNYHBen23vsiD1rM9308= Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1aaf91ae451so11829945ad.1 for ; Mon, 01 May 2023 12:28:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969323; x=1685561323; 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=0Ii9PvRdhTMRqBop+JFdKAWa6G/XpZkmB9p8iHmrwUc=; b=lFLswDg0HvrPkF+dtbJhg/asaCBgi3e00w4opfv2mri4GHWG5ahGHxm9sLAnqC4qbq cQ+9MPTjwHhlk51h4w8lOE5zFHDICMVPmNnmwWW2l0krumAZ2PDeWC1WEjJOX3LShLcV g0uvqMJBbig8RslrcZc6EAJCiGxazADIIfKt9bAt8yGDMo+5nIH4mdhXs+LaHQV1OVik U1EjmbMLOLA/7Pwt5TKTUK+w95+W73jVDYdL+HuxsLXipLy8KET4HB50FeUWTlZzXbc3 qFSctTNSvV8Q7v0NapgoBkUZ/cCAkZoFPz8ver9uL6iYj4+bfmoOnnABcA11qHjnQcrq /yHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969323; x=1685561323; 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=0Ii9PvRdhTMRqBop+JFdKAWa6G/XpZkmB9p8iHmrwUc=; b=cQkSZ7NbZBuHvn5ezFgbvsTRtwicu4XdyeZLN8XjI4v2iPv4bXdgBgwFCSzUW8Hqd/ CaPD2pKGQz7tzlaPgL4STjEbneIYEjxK3uQKVzj3mrDYi6OLuMyi/eF97Ja/DTdB02XO piYCgbOEL6EILEqyd6PYKQNL2AvrkdmAMiMjQ7/ITRrFCHHtaOVxRXFC88XW2MpdMLQN e+OlYNZg9AJI5E6b87tG5lPV2PZVIPWlmqG++/4vFXg9irrV6HuQTymqgL8s5t7zjj3e TxOpF05v9rr30R8xSqKFEzIzRAZ7dY154i5dXffck0vYJFqjTs1PkHmqodYV2CPnrl8j 2YQg== X-Gm-Message-State: AC+VfDznt0dcirK9tpyYiL7eb7xTVrCmx0U3UlZHh3Gyvzhwvfr60cDp ElqPTAy/am9IStEjVNR3HKU= X-Google-Smtp-Source: ACHHUZ4gWlsAH/48zhDdvicQeallszzZORdrHEFL4BiABQ6zj3x4/LHvqIQGrX0uRjqorCk+ulIxBg== X-Received: by 2002:a17:902:e805:b0:1aa:f6c3:ba24 with SMTP id u5-20020a170902e80500b001aaf6c3ba24mr5259994plg.4.1682969322807; Mon, 01 May 2023 12:28:42 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28: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, "Vishal Moola (Oracle)" Subject: [PATCH v2 06/34] mm: Convert pmd_pgtable_page() to pmd_ptdesc() Date: Mon, 1 May 2023 12:28:01 -0700 Message-Id: <20230501192829.17086-7-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 079E040004 X-Stat-Signature: x3tds6zrrwrg9xnzf6oosae83wmom6ae X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1682969323-197998 X-HE-Meta: U2FsdGVkX1+rAdnmpog66T+pSdGBO2RJsipi/JycncZ1R+AKzMKW8kuJ4ofGUh/BFuc1jRrtASthPtcWwSnW5qQgprrOEgReTdESuFLSpijVV5fUtSC2zD1D08v4mWjQKmRtH03ybLnsZVuICNpRwmtpBX/FqmHJASkicfzKSN1yTJPAu93Rms3vjyeLDgg+va08m8+mSiTxENbAeuF2vpF67xA8TUceFwDL+G5L7bHY2tGFvuqQVy9K+jEWgtJa387NKBzEIYDmFmnSk2j0Q+FpXTMaQuXLVyR/wMu0jy7ET5J/RsGC0RFdSvcunnbFcWCeCb52tYquZxCH6MTgebLLjBbXcDWQ6RS9cePORiluMNGUPrguzM30T61S746nCqaGKcKLd17vA0KiFe9fprIvodMvIh+dmpaUBVXSLIJG4S8Eaxqd4oltQwwVJtz4w8lgpzzdrNqg6kgR0AUToMkN/Xh11GSprXJ8QJY25mvaql123nWVLE2YbY2Qktrsz61H6egIP7FHpKs5mi1RQD8EegRogKUdf3NetjU//JXQwOODXINydWzQwEmh/YuOOo6uM+N5Mr7X52ksunekBFaRMC5QdB7f7c40R8A0b+Ge9K7vWGIXJ8W1+kHHfGDS1ekH0LZ3rl35Nlrz7bxkIPjGsbki9idjjtpO0tEpXfXfenjUGzKFDxvzJwp+wgwZziEkNkVxDL3jywlMO+9ZSGXl5+zQYeoUbHGfnZ0Vy+ucLgLwVvmXH/DOs2LaRBzRXuviLbEdlCVs6yepOb76LyhXp9a5r3hYEOODXO6H1PflFWiAWkFkwxVxWBNrOTky2aEFa3O8BCV86qjnuu9/v6hYDFYpyP782bp4iWIDTxgrjqAXT92XND+C8wExQtTj5YhyvcLY+mNQ9nWVChxGWvYbWtZlcaDh8xcnBkrF3+GkTr4Hqtk7kUstfdGv+mh3VfuftCR6wNELns1fkmg WrKpu+ns wODXJ4xoAwIWbwascenng7XQGbGDKQnDREifwcuOp23IDCSo6iqloFqm7NoQteX8PezMRYM1V/mYng9ugjaS30hQROHXDtMfx3jLj1/EGUfWPratwpEQvuBuwPdP7PYsj6g30O2vxwaG7ubxqWg0V4tJhC8a4vYP3smiXX3cqjmWijc+5axYRgqpMCW+lit2bGg8KiWHf4s6WXpAbf5UKB/9LHKcY1XNMTCPQCm2Z2RATTyMcF9HP/qYvDWKioxyYuBx48/9BT0F8KqrjXTfwlnFBiAO6VjXklcUhJcjc6wNllJCl+3BLNHiilJWoZaQq4LDG7UhIf+gCiLugbW9au6vjApcraTW0mwa0Eh22R5Lu7zYo71u/lNXf85lcw5cZjAYFB3cijD75Kk1bbq5NgtnTeTnV7DPRwFijnhsUmOtHcQYsIPhfGon+0izRH8jHyljsZ1nWGWk+6AJVVwQR+V+gruZqcAzRqIiMMQVHTyrzyGNSBeMGInLqgqyKrv1lmrKkU8c1SY+gtDvQTSXm1la6tg7LuLyIk7cYx1ZgszaMsXCKoaNmGXXozhL6yLtoSgobFmjPp2ywAH0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Converts pmd_pgtable_page() to pmd_ptdesc() and all its callers. This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 258f3b730359..62c1635a9d44 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2892,15 +2892,15 @@ static inline void pgtable_pte_page_dtor(struct page *page) #if USE_SPLIT_PMD_PTLOCKS -static inline struct page *pmd_pgtable_page(pmd_t *pmd) +static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) { unsigned long mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1); - return virt_to_page((void *)((unsigned long) pmd & mask)); + return virt_to_ptdesc((void *)((unsigned long) pmd & mask)); } static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(pmd_pgtable_page(pmd)); + return ptlock_ptr(ptdesc_page(pmd_ptdesc(pmd))); } static inline bool pmd_ptlock_init(struct page *page) @@ -2919,7 +2919,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 May 1 19:28: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: 13227926 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 CEFAAC7EE24 for ; Mon, 1 May 2023 19:28:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD483280006; Mon, 1 May 2023 15:28:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B602F280001; Mon, 1 May 2023 15:28:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EB52280006; Mon, 1 May 2023 15:28:47 -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 81B20280001 for ; Mon, 1 May 2023 15:28:47 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 397E6AD258 for ; Mon, 1 May 2023 19:28:47 +0000 (UTC) X-FDA: 80742673494.23.AF036EE Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by imf06.hostedemail.com (Postfix) with ESMTP id 5F9CE180005 for ; Mon, 1 May 2023 19:28:45 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=roKi10VJ; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969325; 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=+5AaOHEPf+h0pPpRdylr/G5bcmt7vW9RVYKqYfsRH1I=; b=WtAD1SVjM74cs+t8NfihTLH+OduL+KW5PqMGBO8Z8R4sV5D/lBuDC/TEbV1w3fxZKMZu7O DdoryMJ654I+LMSOH9w460ujDkUkNpDUTz3OzV8TxF/VmrBTJgLBmiJe90+5XopMkLvE6G aszytrx4K4FfVGB6jFeVfLB4tIM3yzM= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=roKi10VJ; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.180 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=1682969325; a=rsa-sha256; cv=none; b=CsdrEJkR2yy+GcV6FQEAZMmB/neDQvozKVQ2anbiKbVqy2QWvXspjRU8WMr1K6mNpt9yv5 9dFDbcmLJyv8YOEh5P5MsvYr+DxoEYPkoxlHqL08ARo50q6490uELvusTmukKVx0qO3Pen hdo402DxmQlzy3uJ6B6mnnylouTYBWg= Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-63b51fd2972so1993220b3a.3 for ; Mon, 01 May 2023 12:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969324; x=1685561324; 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=+5AaOHEPf+h0pPpRdylr/G5bcmt7vW9RVYKqYfsRH1I=; b=roKi10VJs9dRiilqVeW0uT+zBJLQBRTUlVbgvCysCoLkLcBaFtSDJFWEbNs2bywIGo H3vsreWJ1ZpYCtBmz7ULTfsdWW+yedXBXQs/IwteaEsgFryEWzy4p352hRLq6aefxJE1 6kRZZ9T8eU7cXFjWBj8Pc1GfIk6+0XR5y+mT0ED8uGwr4lyimQw2Z0aiiwvL0/TUCnLz 1YAzhf+9hpLKk/t8M1Z7w1Ox1h7cTnYF1yo9NW5nVgHqgkVIivMOhZpN29c9g57SmIug sEztd2i0kQBJZgz4HOMkQSUf4qdi6lxWXkVGt+hsJgx7i60d4BQr0JdQ/AyxEv6LKtIb /zeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969324; x=1685561324; 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=+5AaOHEPf+h0pPpRdylr/G5bcmt7vW9RVYKqYfsRH1I=; b=EQksqvCsavTMYyjrSoYGVJmMxnIC9fTox9YTKuGEOj6m9MI63AwReNNizY8+DNQAvk s1UUWu8jiCW+ny5K2FalfdRuoLVDmFPYug329a5xS6vNX+dB1s2P5Hp4JjukeibGsr1a yOnjJl8u8axzqf04mcPJzurqqwwShPDDkz8H0F6+fnC7JMhFBIjx8aJsHrhkOXxwlyu8 Z7cX58vuh6z7R18G9Pp6DCGyY18+J3ST0i71CrqHKlq2U5QzXmfKf7lFe9/gWsICFmwJ QJtcsAfScEWA4LiIjRzDlpO3WtCdTmIWGndBT2Eu9qp9yDcMncGKhGdskCzufDMJa+Kw tHAQ== X-Gm-Message-State: AC+VfDwviTfXtBQa1dTj58J8dqcJy8iT+Avczj1DH/eEUL551bUHnQcZ ytqM28/ZAQV0evX5XGwrIlM= X-Google-Smtp-Source: ACHHUZ4PPvDcr1ZSfGKsFuoX96n8X09PGID8nEMj55TFVd8R4rz9suoKbv6A+ENi8FZ5wQLN727S7w== X-Received: by 2002:a17:902:ca0d:b0:1a6:5274:c1b0 with SMTP id w13-20020a170902ca0d00b001a65274c1b0mr12751445pld.60.1682969324101; Mon, 01 May 2023 12:28:44 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:43 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 07/34] mm: Convert ptlock_alloc() to use ptdescs Date: Mon, 1 May 2023 12:28:02 -0700 Message-Id: <20230501192829.17086-8-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: ytzyoihqgk6fzxjpdhzmygyjbtx6ob56 X-Rspamd-Queue-Id: 5F9CE180005 X-HE-Tag: 1682969325-796200 X-HE-Meta: U2FsdGVkX1+3xXPr3kyEjEFqDT1VETaNE5XJZZ3KA/9Ybw0H86esArw6J6EZaTZrGMPnnnUqL7Ll/1SO5sRBOhYPdxijrvWugPPHuPzV0NG/Xs+RElsQpOlV2Rq07P/0HMUIFEy2itK33dR1zKGDgkNvc+e7x0D2nf52ESwERPCcse4v08GXMs5WHmSexD0JWCfBkG/3pYqJbk7VJgqUI7LZrc93gaUecjrR3LligDmMUqTStSy+kh9CamP+WMhLn00MZf54hEBWg9Iwu65FXpPxp31IGebOkxY4pdFs6a4LFQKmnMED1gOp96rfL9FYUxh3j5dfBP/J9TtJOYOkZ4eiz658SS5d7gL6amDbchTC0w/fHj4pjWCK0ogGp9oqLXdrALxXcgVhGs7hEH98n1l7fhdh4KNQmIdTnzHaANMVcOwgVlttsG68D7ag9nBduGVNLuiqSACrrUWL+zy5DIY6RGk8nKC8IsntVek3ltnGugz2CFw5b+412vR+EJneikgq321vgIKNzEX3OUzURs3gTzr5digB5BGhdUONRzrFbJhZu9i9bz6c6LV+KNKKhUuUfZwLEt/Gju4ZMKgDD/DqeMFO0ftFJEVtbyUzR5G0cRy2TsA9TyUhaaYw8NTgjxVh7I/hVgip+/CuQuGjESuoZpzb6T0xECoeiUp//RJOlPzTkXbpx8jMubO0PnaI/PHaDSTGPKfcB5a6pnx66QBWrfOPFev9qXyO5iP/b/+Q0c3kJkeKJG/qIJpZoWtnUGS4OsDES+o7hOjW3pnUJbym/y5u+cHjiPReU0682EU6Kha6V5Kw+BJwjEzjQ025ONawnek42x3Gf7SuTF9VsCQjf2FVk+ehdRRMiZnXNsUK7AodcZIwZgW0337mEuYrU8RmrpVwBvjoB9QULK7EKokQtrvZ49bQFGMSmtxYFmn31hEbqxRXqF+VgOqczdH8lm5GaFosmggXO4ffKPf rTIEQV8e noGEBIbwaWXZpPu+Ui1VYmrLuRrG8vXIrrPKI+qRqC8zvwkyrtXB3QPorI0FgsiXZ4JL3W6mICUF2f3RUlcq0lrjnWoWBBAUGLEE6KhjTmVWsAe/7rckRyYLsCIEAaV0QmWHkWcHOy8id8mG/6Sgv61KAj5X2tnE2NBe7t0VkPflr+g4m6KKYZNYDEDWa7RScLmV32oF2s0tirS7NyLDszYTBeVi/6xUrHE/MbGNgduLbHLhuHlxDY6qm2rSKQH/TrvN+MOajQGfc0Iw99QmklTPMzOs9zlFJXYSOaUws/a+B0tPm9R9MH7CVp5Q7+UhnTH+nmReZaQrRLJfGoV+b8IJd7bpjmU/ze3GD3rT/YQ/l5CAbJDAm0a7AHYHAMPDDMer9qpLB5Y/HnePGVoybmxQ/W6baOque29DX/pngSJt40+6AtNk5qPQF0LWPFhEMqaUJ2+gOlb4D0PDsAej4J6GLRvLXQ7xDzsAHrDG2mswrK9BDUdJ8VRaJuOcocNKCnRW4mjjfblQrBX+CLsbAy/OIIoP+gpl0hkct/3PQ7yeeg/R3kjUdZ6rDFUWLRPC4/oIXYgtCOwbREp8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- 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 62c1635a9d44..565da5f39376 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2786,7 +2786,7 @@ static inline void ptdesc_clear(void *x) #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) @@ -2798,7 +2798,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; } @@ -2828,7 +2828,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 5e2c6b1fc00e..ba0dd1b2d616 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5939,14 +5939,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 May 1 19:28: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: 13227927 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 4A47BC77B73 for ; Mon, 1 May 2023 19:28:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 018BD280007; Mon, 1 May 2023 15:28:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F0882280001; Mon, 1 May 2023 15:28:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D09D1280007; Mon, 1 May 2023 15:28:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C1CEA280001 for ; Mon, 1 May 2023 15:28:48 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 77AD6160824 for ; Mon, 1 May 2023 19:28:48 +0000 (UTC) X-FDA: 80742673536.15.4F36F9E Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by imf23.hostedemail.com (Postfix) with ESMTP id A14FF140016 for ; Mon, 1 May 2023 19:28:46 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ORzYAt4f; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.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=1682969326; 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=dsNph+IH8G9kAdlfpPDvdsVRvR3y4GWwc24n4bCHoNE=; b=Mu9kQZA/il0Q9J23DIaNRZcsZG1xghKxGnAVTF45ame07fHpw0r8atkfE9yPE5wL4S6svp GgZsJGSN+rdjKW9M6uTX/UMNtonqRJqC0Meps4xm8cGq8ub8ztFksR19+M/wgwMUNDEQ9V TnNjrBCDGFGLx7c6OT0xoOdlizdKezc= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ORzYAt4f; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.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=1682969326; a=rsa-sha256; cv=none; b=BlJ1vQ6qWTlwep3VMC1MVcljU4SwP8o8MDQ8MRqvs8itVOtlD6tbFcAgO1WBEVdMfUyz/E OOrYS4qVN+ZRL7MgpwMGdT/YxgHM20hIsl05RjrlQP+kl6u8JsOEZcT9be/P5PEOiW/EFP Pcn0k4ZQkumbM324O7bPBqPcNoepMRs= Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-63b67a26069so3354686b3a.0 for ; Mon, 01 May 2023 12:28:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969325; x=1685561325; 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=dsNph+IH8G9kAdlfpPDvdsVRvR3y4GWwc24n4bCHoNE=; b=ORzYAt4fgaepA0jj/nxqG5QCQUnwh7Hd86B8NHpvgQ9XS5bxCw6FjAddYAhSWVBGhs RguloM+rsX2sX5k8L8jQmcK3uoCnItaXGukxO2sNFKQkHNbJapaDcmG0iMAuRZwI8f8t xe4tIz8OOyBZAi/AlwagFAtmsldgUDQdHIa2vdidJh9lpo3fAW1D+2jPZJhQXOxhvdZs c4hk+WfixJsxNAANDMRcuNKXIxHiA6rEY6QaL0IGeoKtL1JoS6dBJBARbulTJ6NVKxdj 8lac9J2KQ3hHBoBfb7fQ//alN+wtsMCP7K7b5tVdh9EZXnnMD2pBGWAPXyEldDpkm7ax zAvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969325; x=1685561325; 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=dsNph+IH8G9kAdlfpPDvdsVRvR3y4GWwc24n4bCHoNE=; b=bFDbbp1fFWsNoos16nulH2YsZzzkL/d2qhMc3r/FYoVJgYIeB7QblfmAi5yJRh38kS zcOvPn3X40hTwi6QVEM0hZzoGk2bAX3DLjl7QTYdbCoJZYE/6AJObIHNvQnIaddXPFO+ DugjNFiOWLb7wQ9pXIjHmcS+fzq/j44hZ7CpFFao3yOplJJAIcGlFPs7uMz4L42aTB9O Z9e5kVHz0GBvpTHeGq39dTUsEFC3r7s6my5bNiuNsapRw+32SqyJLGgJEaIhJNlmprBy ydq67ZfoyV3rrVK1zz4cUyZ650gj3HmXFy2wx5iBw3DnYm/rKc6y5IrVlQyrr4t41ZDT TQGA== X-Gm-Message-State: AC+VfDwGnesxRkuRHXnWIZZxKsRp9utMcN9UOeBAAs2JyUsvYK3qtdXI Un3Q7+znfIqw6jMC+vhKfV8= X-Google-Smtp-Source: ACHHUZ6Hyp/uTZNVOfbVle27YVii8Y9q7eyatfM6y5VDboeAGhZWSkyjhlYeOczpnOUzLbM+Y5y88w== X-Received: by 2002:a17:902:da90:b0:1a9:b902:84b9 with SMTP id j16-20020a170902da9000b001a9b90284b9mr18090785plx.24.1682969325399; Mon, 01 May 2023 12:28:45 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:45 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" , Dave Hansen Subject: [PATCH v2 08/34] mm: Convert ptlock_ptr() to use ptdescs Date: Mon, 1 May 2023 12:28:03 -0700 Message-Id: <20230501192829.17086-9-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A14FF140016 X-Stat-Signature: 4sypip9nmrj9eim1nbi67h9j4yxguheq X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1682969326-104220 X-HE-Meta: U2FsdGVkX1+3lxobw3Mx/Rwv6FoGjhchgldBp4zVNvpC7glkFaO+eCp+aLPnPOU32hxwJ9eOdkd5HG5CF9omIpDgw4Y8JxbjB8i1ZLVt+jipi2t0O9h2IdGu7DfFGwkTO7Op61SviM/mKG0et+lX5xQH1nGV1n/IxMw7cx9XCg/Oh04kvCzBnjsWcW84EhuqzQBwjDd3SDhRa4GppVFZwkCdD4o4ZJhhNM0XuzjIx8lcNJw5p4Yhk1TiWmzvRv7ZBdSX5y393fsVzAQsbGjQsiSyaQmZpQKGTsQNFyIjeqMCaZhJXfH8HQOv6j/pAV7Vdrbj+UtjY0OIUv3ksSyj7k0LOn8E4bzJvu0pPfAj/Ez5FxX1vU0JfsQuteKjA3UVPsNvYKg83290NW5IwYWm1NYsGHSAwcM7CxxBlcfL3CDNIuYsXwEopW4wvVetG4QXNKYVtOUCKYUUhD66g0Oa1bT16Xdu6dr1Y2uV9lXVBWD4HWsOr1gWSY0mSrOH/is3WrIjdoLZsdf8Ywmpa7IK6cObGPYvprpFgXLKQSb7vFVXXH5RhmfnPOSQSQzufeaR2f1mPhdxaY9E8Z0r5PYVBSRajN55dBZ10Ioh9vKY9eEibkxk1nST0BdH8Co1Sc5+3prk8rgkk6lmpcqMR8HXMH39glWDfielw+sMumOVVln9tedAyNilUUZ6fqBDFvw4SOblas/qc7HnmnD0J6i7G//wt6sFVEaEFZVQHqXEPCi1GIZ/12ksznVbHS3/qXirGZF+qJ3Pi2ncM1HARrQK04ZHC/yLNITRcGenh9a3nPbrfm+GLAgxJA9Xe9XJFG0gC+yXCffBKTgfcR8XMnKVpUpBrXsVKQiQXYfbXjLWq9yhsO9nWPExUbbWyoSzvG1FCduc4yfvTbikDk0jqC5Mm0hg1DGeOYb7TAlcIgZzysBkhz6wMbbv/WT181MnS0sKwVfWVfVVA7tuwzvLlk4 XwvQeTXC jCvQ1TkiffZ73fD7zZ7+Sw0rokafAVFRi0wpbL5UKIePxwdw33NYCD/TbzQlQFsB8/7W3GFRyQHZvYDzU1wAd3cX48LDT1zI0KCEeCM7UMoO+L4KFa+uzS9/w5pY3GGa1jAAiZJkPOSnt8/y3NISjmdkgftecbB+qYwap/PoSGKogAb1azLq/9KLTtVt7pO8WO1n2xoA2L7oQxJRrwR1mQ54cLuv1GBg21qVaVtirjVHwGGrQmQ2yOb0j4wceYTrOY1uv93qgzdbJe4L38d3ywBxa7pCSHHQ3/ZXAJBTT8SoaQsZJu6DLh+kCjAf+K9ray/CgvM6N5Kb8A+e0uTI9e4a9zI4B7RlOZf6orTVR/L8FElHouFQhDhU0+vgpYVdiud3HZ7djq7hDrkZT1nl6dcbW30C7TWILIr8FwGFKz40sIXUf1BUX0CmEX8DBWPjoxjWMaECI7ctRKWR3Hpuc+stO2WthJ1D74JM1apuARW2rL4sLQ12wwf8msysMriQqwPX5lXoNBGaHc0XTI0w30pzh0/ry3w23n6VikxS1gbrB0WsmZWSipBL/9E/Afe3D+rqyncCoTMjOBYI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- 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 fdc91deece7e..a1c9f8dcbb5a 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -651,7 +651,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 565da5f39376..49fdc1199bd4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2789,9 +2789,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) @@ -2807,15 +2807,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) @@ -2830,7 +2830,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; } @@ -2900,7 +2900,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 May 1 19:28: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: 13227928 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 DBE19C7EE21 for ; Mon, 1 May 2023 19:28:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3BE30280008; Mon, 1 May 2023 15:28:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 31FE4280001; Mon, 1 May 2023 15:28:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F0602280008; Mon, 1 May 2023 15:28:49 -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 DD89C280001 for ; Mon, 1 May 2023 15:28:49 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A92DC1A0580 for ; Mon, 1 May 2023 19:28:49 +0000 (UTC) X-FDA: 80742673578.02.20E13B7 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf19.hostedemail.com (Postfix) with ESMTP id D2D6E1A001A for ; Mon, 1 May 2023 19:28:47 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UIGt4Rxs; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969327; a=rsa-sha256; cv=none; b=rki/y/XRDiRNYmTA0wpSzaCPpwnjmtohxB/IJKQmwzZY7xfwxdcoJaYN2z27t/jXCdSKx6 G5AgAdj7NfPeE/L6+SJA82qjlQx9TDe2Elqg79w0zfkGkKPiJEIMvMIeLjXx9AMU9MU7Fo 3O7EOjCMuRvqvy+p04VTxXRSaVoGBgE= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UIGt4Rxs; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969327; 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=Qr6GrFg3nf2tpOD8Orpodgx1J1bZoReYY/j4MOttH8M=; b=GX8CdIKoUuBMsyK94ab2GPGvpUDPSoJUAbC49ixv2aOM5FGDwGWRfWksztRi5Jd2QLnnLA GbNVfBVwlpM41V0xSey3R3K+XfEWZdxFGbrZdYNeKEVNNGERdPJ6z5TNTDvrk5OowTwEvX Cm9XKOAEnA3t4RWONDyAqGiH7ssOUO8= Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1aaf70676b6so9588565ad.3 for ; Mon, 01 May 2023 12:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969327; x=1685561327; 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=Qr6GrFg3nf2tpOD8Orpodgx1J1bZoReYY/j4MOttH8M=; b=UIGt4Rxs2HkrsHutpAYaiWsjpykN6YUUd9E7lUyM0xl9pxC5slr+PivAMCf0kJWRtN +uixoPZwp4Vkl4YHEUToQjjzNjvIathQteky2ye14eE7NbHDFgUdPJKRNVXQAhEugOmA SnKo0+DWLOVbHHUZvAiFOaLnHaj2/1PYZhJmFGNiABpmjR+0nby25eJKrDAKj84VfLsp mCPKXur9uRrX02YRe2GBv91KFh4j6FQNTVZMtFBm8+b26dYihW/DQX+FZ7CAta9Gp4QP rZEIiymi83HRxeSWeuBi69l3Fo9OQWMSSxYcww0ZzqBAzl9SsUUSi153JEf/pt3dBwk3 OFrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969327; x=1685561327; 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=Qr6GrFg3nf2tpOD8Orpodgx1J1bZoReYY/j4MOttH8M=; b=eFcErLOtJmzFtcA+DCI5n+KXtnZVI5hi3uDGkVQ6ZJY3fcVB0DRkQVP0HpHxwxOCU4 G+YWM4pmMP1sIXgrwCRS8uzGBRGl3h1y7iYV1b1/ABu6xI8gLi9ua45P3NHZ0tnpQYGx 4QsweLYDbDl17qo7qEsWcoJztzj+8RCNb0XOPgn2ARESb/+Svslt1pCrvUYOWD+xmzi5 h+4WHI02hjGgrkTSzSZMbhhs8hhJxjT0gjDKeBUijFE2LqErJ0pEqO5vIENke1HuousX SVa1WRq4TtoWKmVHvMjyfjdn7J/fvZ13ojk9xMnkwYQ/BKZ6l3XDs3MDo9r50r/Y9qbK ci5Q== X-Gm-Message-State: AC+VfDwCX5dx6VT6r7D2+vT2Fy1FuI8nVgtbDveOllKXPeyBMA/PrKPp wv10+TJJAEvxPzS8Nenipco= X-Google-Smtp-Source: ACHHUZ7U6exPykPvKxCgekHmX9KTHTAx49eIcN0vG+aTw+3qX+uTyRXMYpekTZ9RZqGTjPxZ9ZewtA== X-Received: by 2002:a17:902:ecca:b0:1a6:4127:857 with SMTP id a10-20020a170902ecca00b001a641270857mr17426348plh.5.1682969326811; Mon, 01 May 2023 12:28:46 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28: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, "Vishal Moola (Oracle)" Subject: [PATCH v2 09/34] mm: Convert pmd_ptlock_init() to use ptdescs Date: Mon, 1 May 2023 12:28:04 -0700 Message-Id: <20230501192829.17086-10-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: D2D6E1A001A X-Rspamd-Server: rspam01 X-Stat-Signature: qde3wzzwf56ii7tk74su7owib7hn1hmw X-HE-Tag: 1682969327-230637 X-HE-Meta: U2FsdGVkX19Tkehvdxh7s0s4zQuUTg+LcE+LP6RfVElMUfkOLIJwY0xYqQeShAsUhFCm5un/sO83djbcAEuGTnUVuqxvV3aujw+rwyFfsaS/anxE+OqBwW2/dL9KnrqtHNgIa1xHapgpqERWwOjrC2lHeUoEl51gTzkRlrjz1JfYcMdnoyrYb8MxrDwmrlPfvj92qwpHBgxoOnSuCZncwBKvpU1QHBUS4Bv8RmgQidKti8GFCLHLg7HC4sL10z4a4Bs3CtKSrOhIx9Cclixpszlj2Dpb9hcYH+l5xSHVXPq3dq59ggKRDAdW4jRXnDhwORkq/9iZx+QWybGkPupTIa8OYScqtxb13ROeqXtj2GVKVNd25oespGXYTkc4F+xxUxNBuwc8C9dQZQEM7N2RaTEXDUVSc1w59kDhKnPE0hffuoBoDtokOy4KmgKk2ECmsLQYWfs3ZfTfNYnIa0xmfoemkZMYKgMAMfCD22cSfBlKHnRsLYc+C4uTY+J6zYbEDsOyA8Q/HzrlbsVxIUnWNZWx1fIwdlm27I21VbAj7OzlGqEWlXbq2afltoZsQrxXYgXE/4m24U1KOlxKK8d6FmndNJvK1f86oyWQuwi/6BEtUIiOPRc1F2P5TludZg/DjIzO5MGQCFZ+Z1VG+nsRM6RiLNoyaugSTHncOW6wF16hUm3fi9edzPSRSmUbnhWrZfpb/q+u8Ni8oxJdlhtX8nBmdzrzZRoizM4LzFQpA5QY+URGeMLrHliLYTNqekZATusPbqweHSrfUqUNBXh8xPJtczpp81GBw4cAXR/bnjMTpjepc/1NeIHy/nmY3b2XWG7Zqf73BGHxe+gIi8cSvqLpsvNNKK5noxsyqQNSNFK7BVbrliSsKjc6aKINp+jD+ORT7FZA6unqQNUS38h1Qi5XzmhywGGFlvdAbfyV6Q+MaxwCr3If/zqZpjp2c36S55ma2Jx5B0lZXNHrFly CxG40j1s obDVdAtRQ14OKDsnjLIrVNVtpC0MpvcjejFZbauLbrultIE1aMYB/MzOYcJusgkwne2FKABCLFd8GB/uAbTUmrAB68CS7p5CXvlnmUVoSwkl4ywv+mripj9amt/ar5v3mUwMQw2uYdHpGUwuFVeiC8MSYrL1Mf91/zo+mV9JzDSGIJB4KUqsECu8uLqVqFAcijY0qxJBCnAsr+dQ6Ae47zsEOxhQY4FKL6OoJZwi+UO9IoKnMmJ+s9r4Jz0b50kixIifgkkueZ9b4WnqUOpNhSEONw7B0lDxJi0AtO/V/2xez9iXcTe6XXEoH9LwvU2c4mPvqu6wjbn61nTglefSPVGp0TmGeJB5N2lKQscAITn5dOXqiIf/qF9FOf21l/csH/J8JC4xgWvlqNa9FW9khpBmPDq28vhAFchw2tgScUSBViUjhPsLU+dvhhwkWXMhlgN8sU9lDJgTUZsyNcMxnfYkxn6CZDpe+049gKhSNttL+RhXxlAF+gHahurXaYr7lsMsGNss2FyEGf/ugtNYNbYJBu4C77ikRCu4CkIbFrbiVjVeuCvsQZdUPkyoebDGZ6BIJPIlVfmHlQnk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- 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 49fdc1199bd4..044c9f874b47 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2903,12 +2903,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) @@ -2928,7 +2928,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) @@ -2944,7 +2944,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 May 1 19:28: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: 13227929 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 60E3DC7EE24 for ; Mon, 1 May 2023 19:28:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 718D2280009; Mon, 1 May 2023 15:28:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C99C280001; Mon, 1 May 2023 15:28:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 51A73280009; Mon, 1 May 2023 15:28:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 459E7280001 for ; Mon, 1 May 2023 15:28:51 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1EB971A07FF for ; Mon, 1 May 2023 19:28:51 +0000 (UTC) X-FDA: 80742673662.21.3BFD4B6 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf13.hostedemail.com (Postfix) with ESMTP id 44B982001D for ; Mon, 1 May 2023 19:28:49 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=PY19zV8e; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969329; 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=wHprEtJ9ence/xzqPBz4IJf2z5UW2zl5tMMosQGe/i0=; b=ifJSKbUYLZrurUc0r2BXkg4CCN00TBdGVoDNbo6ILqCx5JEo5Us5WY2Z9yNFty9Ur7eesd 6YEPFpMPXeDFe3Jkz/taxJ9ldIZDg3Lwo09/xDSvhPQ0KwtSorzQkobiC5EkGf/VKqPj8I ya6YNZCxt6Q9g4PJfw8qx9xgQFmYr7w= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969329; a=rsa-sha256; cv=none; b=68e7ztmBU7M8gze90daFWxcalwKEZLxhgLsTOHwWAvW7MnuRl/9ffv1IS6JFxCRL1o+Q/D Vus/FpnO6Q6j2WqlIQQcaiBfZ4ckKo8TYWiLJ9hM1yhcj+KBWYpYmRHADENfCw6hxGBbWl TZpRpxLh86IrqX7tRw+ANa9jVz9KY58= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=PY19zV8e; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1aaff9c93a5so6141005ad.2 for ; Mon, 01 May 2023 12:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969328; x=1685561328; 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=wHprEtJ9ence/xzqPBz4IJf2z5UW2zl5tMMosQGe/i0=; b=PY19zV8eUjDo/XMGG1Fc34r7BzCEZH74vj9MdJuOaMu+i1F5EHabpfUbH5/UkV5r7u xDPodd9s+AIKUKlEgX8AIGrVTqPfTCCV19VkI5iB53+1hWJANYdEVCUSRnMghYWfpO7M cjlz4mTJKg6lVp3kGic5xzqQRsLBSUE+d02rlXiSiKdYRR/2g0lktCdvpXk87E+WP0bW PyWsq2WmVkZLx+/D9I3aZnTNSq5u2Ks8EcfSEB3bP53mV0saqVpK3cKwl8Vm7ptPZTKs sMCaD1Y/vK3rtRXkw0c64x6M8sUBtgZ+i4WFX1gLvu6Qtr7y6/c6crVIx9ttRb0VBr94 CwWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969328; x=1685561328; 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=wHprEtJ9ence/xzqPBz4IJf2z5UW2zl5tMMosQGe/i0=; b=RCGdfCR31QTo0Sa/TClYrHORNGsdZV5/vcZSCyRm23I+XlJx0EsQ7e8hbiD6fAgIoO etaVlIC0OmaSmhOXIOJjVKZ9yRyN2jws3DTfp2uyDgdQ5ICQ8oGvgdNya7inZ02PELU2 90iZaHB35rSOSihGDlIVJMfMpglsDekgaHSd9HY0bEFFmtAWW+rs/lhigGpLLMZNh/t4 Z4HNSibjXctaglcYaXR/veBIy+9g62Fa8//gE7j0Ye+E8LfINVd3wWwfIgnIeRDBh0BI pYmQ8UeZpgqJkZA0A0PyNZxOUZitehHvJWkoPCZ6YhC1WtvMexbYGGAL5K9PnCAF9TJI O8tQ== X-Gm-Message-State: AC+VfDzpLM0ay467h6PEwDKM/IXkyQKpfMf3naerQJpSYbsg6wbYcwrG VIX2BlXQdEVj9hVzGmOltqk= X-Google-Smtp-Source: ACHHUZ7Z//gnFWu5Wh7IVebCi2ECb1TkUFb7V74C+bMLVwpZ6jGbtiv1kPkjLZLQcQGCrs+Dltn26Q== X-Received: by 2002:a17:902:c745:b0:1a6:6fe3:df91 with SMTP id q5-20020a170902c74500b001a66fe3df91mr11845223plq.50.1682969328214; Mon, 01 May 2023 12:28:48 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:47 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 10/34] mm: Convert ptlock_init() to use ptdescs Date: Mon, 1 May 2023 12:28:05 -0700 Message-Id: <20230501192829.17086-11-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 44B982001D X-Rspamd-Server: rspam09 X-Stat-Signature: iwmkubp1iuo9wrwx91w5w4zqjydkzci5 X-HE-Tag: 1682969329-380423 X-HE-Meta: U2FsdGVkX18V1nNIs98zZgX/wJ6BQzkzwspdhuRgAnzl0MUjHOL30J6dEj+xc5tbFw2PqYKj09EeGLC5kKoZJISv4w50AN3gHZ0h/UFspkHvbpxcxJcP8OSEVc0as2iWOKqf1An/wdkL5FeN4XcizhaBOHRPpnGxxBI/+Ch2wnjfhPmOFCLtbV4XsCo3IVz8XcTFko0Ybrt1GcmPpVeQ/9Is5grdHZZEZ5kvUJo8/dgzVmx1lp0gTNzGra5tr65yNNms1Q0QHWjW9vpdlYTggCYYEfnvgPo8+eqZAnF0WtU7m4oGfGtauei2MhcW9bXnOdC/jmtQ087fT7A4xxPGjL+YZ/CgmHdtzwQ7DC5BYKGA2ixskA6qxd5o0KXb4+f7RrjcEY9oiFh7mQwyDScHCrU1QRKW9dwmt4XAsYqlkSSZNYkszDipMcXO6fH6zTyeLnM8+czQYWpyVotWLpeuo0yGp7JR1RMQPlJ3i68pvE/q6vjg01PgxniWYxaTT2/P/O+QjzxfaAYMOt4sFtU4lEKQeC95QWtG9oWb+Z092WS9+wpi0TX1N9eAEbfowp1q1bvOJZvnHr8undGzun+ZZHt3oamnaHup6cdSTLVWFVK0xnbOeChCFm2V4TQQ0HjdupgsIlhuQ3sH8aUyM6A0GMxIG6xhAgdgQlZGkt5gt5OVY1Fert3mj7o7/uryt+Vd5UI8/zCWUsRt43aNQMp/6NzQpj/mxAEOdQhhaPJy2Bbe7ww3Dfo7z0ZSs6y++gl1LqnabIBjT12S4Frg0x/ggAoMXY++tG1DqBavOV/qDFvKQCPOeCIxiIsMPWfbM7dNr5v7w5mQw04ykxANxADYuDLrCFULq5/2HgH/vzwpJeU6fbvAOKDxhhlyPW6nrpiySkYQbksJdzpibd5O6Q2aKbq0C9Ia1CHoDi4Yn6nB4mM0WtinNB92Asf/l1pTVfUOXLu6t/uhciAtYcnNUi7 bInB0m6p BFBpDYtnA6mdnqyDp+uQ+ctwRPr7+QHTiXPxxm0nhpLqz5EPNfuWxJdSyztLh9iYu0yYtrGXlQKRzSw9AXj+1KninxxkcG1TBGA42KopYAqblm9wTR5vkhjU7kh4l5oqNJiBh5rdoEcrl9aby1+9A0CxWm8XE7ZcHjJ6nhjW+F5oMXG9HhpXHu0ikB7UVHHhvg0SIhRfgNZSAX1jx7SfC3zj+P1Fc1PprjlgZfb7mOAf/Q67r+snQcQzbgLYHvPC99WK3+uIvCrIEWEzO5daZ6mTYRoR52rBZ7JRLT7QehjhIZR1hGQpk5HVl1inG4FjcMCrLE8dFni2TpsCA0zI2f1LCmR60wwLSfS3n/0XHUgbqH2OpvaSzj80Q5NnXVTi8t3LvwGCJhAmpMmWfbJo3tEs+98m7GfcxXRvOzAYp9tNm+zjhIYFQePBjMPXAbiPDKW8x7hHKmh95HxYBiwYWURQ+K08AGnmREeGKK/Atc3WLyjs5JBS7rIAd3jnMoCZNKf1xfslNogbunXh8ng7GbGTj9SN/MxxT9xmSJG+vyFkwyi8u92qoc3ajn9eSn+35BK9f/XkX/M+28H8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- 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 044c9f874b47..bbd44f43e375 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2818,7 +2818,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) @@ -2827,10 +2827,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; } @@ -2843,13 +2843,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); @@ -2908,7 +2908,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 May 1 19:28: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: 13227930 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 93193C77B7C for ; Mon, 1 May 2023 19:28:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D809528000A; Mon, 1 May 2023 15:28:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D3207280001; Mon, 1 May 2023 15:28:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF82F28000A; Mon, 1 May 2023 15:28:52 -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 AF0B1280001 for ; Mon, 1 May 2023 15:28:52 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7DE6B406CA for ; Mon, 1 May 2023 19:28:52 +0000 (UTC) X-FDA: 80742673704.10.5E55585 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by imf09.hostedemail.com (Postfix) with ESMTP id A2441140003 for ; Mon, 1 May 2023 19:28:50 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=lB3Z6fcb; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969330; 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=qTcYn70jypAxoGiZWNhXW/f3wJ7PRfT+UBBqvcdtR7Y=; b=7tOY8iphY7kxwuEbhwgbuXPR/eyzemItZLVoa8Lvww5DAQatjs7KG6UI3l+xqGTuS9jzU5 gTjyfrDldzNXjKUZH+KN5Jed9pkg8Sd1ht/pnnQBqDlJDS239wLNEfIZe6qPgNmGSTaNVA qcXPbytoY0coJOwCbjxir1hay65yyUQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969330; a=rsa-sha256; cv=none; b=ydtDZbf0IX99XpBtbEJGEmNIi8bP8g/uk3Ki17GrpF8yURKnKsIlToAjOjPp4uca2b/rTO pkdfpiE6lIs3FD3GzwGNZuAJQvhqTN3k0M5uvMeEoYKJlUI2AG8HPtJJvfLfov2iXxavI5 5G7UcUiKDDg6dP8C2veLOapx61cJut0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=lB3Z6fcb; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-517bdc9e81dso1430177a12.1 for ; Mon, 01 May 2023 12:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969329; x=1685561329; 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=qTcYn70jypAxoGiZWNhXW/f3wJ7PRfT+UBBqvcdtR7Y=; b=lB3Z6fcbmN3PCDkgSSAUdLyGGv/N+aWg88Xq/3YBAOLHjjeKvsEOyPJ7qOvQJsTwm/ r41UWIzlQ/5Ax+ha7xRNy8kdIkTNxjA3q1QX8n9bXAh3z/8wB6GEn84UnvlT4jKe1qmu sQyc9OGXZjTePH+r4Y6e6ozh0UMlJ+VYjsnu2YRncxwQaVJ+Cf7Nqth6cXAsabwTRyMX v6eeeBBdHDjqYX6OiT4X4zQkg5l42dCb/DNQDsMWC1atimcSE8JSmejQfjKp+N8Ip6uu zd2ZsR9jcfUX1/JB5xCLWPO6fdSMIACYocvg6A/MPAxkpU5nLiRN3WCB2A8Uz52//cN+ kz+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969329; x=1685561329; 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=qTcYn70jypAxoGiZWNhXW/f3wJ7PRfT+UBBqvcdtR7Y=; b=lpa1KSyR4UZ15hgaY3zfsXXoL0pNOeOjncRgo7yMAEk4f+41Sk8b+/bf+8othBlCfi qruuZAW3g2g17Oxt4YyOLy92sr6WAJA6lcj2DZ6RBjdS9x/Pf0wRcjTHS75ziote/FjX vwN2YJdSA2pq+EB19D0DloApok2qPfuwgxsfJd9OwYprB1NL/Z3vGV9L0GpnzuwiY6bO Ag0SIbtzNd4pQY1QKN/2iDr1wDDL8q+Fh+IFdN8tXPl7D58Hf8f4CF1ovH2LqvEeS2Q1 k8ymdwB6PVNPT11zh99sQgusAaFl80/bxv6AkWdm2GHUyBJ4QxdhUr8n7vJ0tFG0RKgD 0YvQ== X-Gm-Message-State: AC+VfDyQqEdWEf8vcgx4ZfLK8pJdWmmSgLHBvtlV0DCE199sK1z0q/H8 wQlVHNV32SwV8asx1IsDVUQ= X-Google-Smtp-Source: ACHHUZ6RkKtjORSVVTbvqSb/nEXqQaQ9JTIasvSEW6m9mcivHjmudekwdvS8zsaYUeAaqoCEzf8v6w== X-Received: by 2002:a17:903:24c:b0:1a6:4a64:4d27 with SMTP id j12-20020a170903024c00b001a64a644d27mr17386318plh.40.1682969329458; Mon, 01 May 2023 12:28:49 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:49 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 11/34] mm: Convert pmd_ptlock_free() to use ptdescs Date: Mon, 1 May 2023 12:28:06 -0700 Message-Id: <20230501192829.17086-12-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: A2441140003 X-Rspamd-Server: rspam09 X-Stat-Signature: abeh49gqubz7iny4d6asyjxagbdf3uzr X-HE-Tag: 1682969330-562524 X-HE-Meta: U2FsdGVkX1+B32bW+0zY2uWsfMEdYk8C13bOiCtM166P+Y1/ufpyQcjvHkWxxg9eCItbJAmS8+vvuXbKzSjTK+UhqDVtsdSvCzyktsQR/x1GJT7CtgUauTPG2/nCbSgu9PKjhsj/ezLVE68VlU3U3owwxG0vhLramslvcUS3InMhd4X8/KtAfxn4cN1c2estT/WaZoyO0YYR2xadBV5P/Mo4Nl9zPfzx8+lB7rsopQV1cGd/RBSP2H9IvCUf7lfylu00+e/pb4IT7WKw2inaEX8gyaJZxcowo/HNgIhlpuzUvQr832i9TpXM6ydH6oTHrsqZr34oiiBokaT4Ov9DOl1mkLSPYkzOfSp4iFlcgu35YE3EGLWYq28N0sL2g6uPAuz0nKO/ONEMgJezNpRwh2FYEuUQcvBTr3eprWD5iQ7dgmJ6zfHfSJiy0RnJEqNzgBxor2bshzaF4dZJeZqO8OliAjmm0YFM0dcYoTeQCcRRu53FSzrltr+aRKMuxM1hNB2bbpSOKyAbGOaqS/oIosRDD60PmLHZ8eyxDdmcjmcwnzhzpLpjR1nk5egnA+2LiX3ytlMsqG4aiUA/Uzcb2tcV0o7Rr7vUqL9LGXcQ3KPTSP0AtlvF6qiCq0VG0o2FaTjY+G4jHiLkCZ6RDjpiV8cTmL6d0LvCKk8M6meJJJv1ns3vehPAnoI3Jx39FmyS4rwgYx12FtcBl2adv6lzziXgpukjcrdoo0TeHBUD0BvIUsDK+lT1Zw+LIK9C1Rzl4V3/G6PzTJ7VnR5ukEVy3b0bj45GkrNri0/tyBN291MDsggNLOjDI0y4VFAERSwQMwQEtSz0iu6fSWtAkijwuFEmlCbDWEZjS859UIFGvvakFV7p7/r9UYWoxkMFnZGvu2csWv+qsR9XeCW5mcbEqvs4kOtRhSoyQByBPOS46c2UyaUYw1tMjV8Kmp7E+miav6ob562UrRSQgEa/gms LEr2f1nz f7Sho0KIHLB5XObIg40G8RivLOVQ8R9siaZlDBPn9YrkALkme0Fc107lxj3FJYM7d4A6cO+v+9YLmm9xxAxqckYwQ/fAfilvOnGzl75XNGP6b2ydBwyOAAA4LV7y7PEGaNdypDos9CEKoWwz+cVQn366KyJrFoautJE3hOEQss+/VDDaJRmJ19Dfu2wPDJNW+fX9sbwSXuLBj8YtF7E5ShBMrGp7/P61w2rarQqMLo8AFCs2+ipPvL0cs4SHMlnnJEzDbpd5E4Ht8H4UbG3ROv7Ha710RyoPmEL8fdIyIQxdI+txztdXVQ399VF37QNNuWMwALLp34YAqFOEQJdWi9CNXV20pQd5+CZT9RtvqbMlQ14e7w2PNd19hb+o+xoroCq6W8X09q7AdgOz3tluc4CG1EYPeriJVwqWejD+tPTglQC30Mm6D9AIeM7AMCsSok2xZDVTwGd80xV7JQi+AutA4MGMFS10UHM6KbBb9oXadMi+cVj8mV4v4RdSh74sImnkKnaBgclRR1S3iRWF2XmVKs0GRX0HsueZJ7/6IGWNhVpMlJrl6tWFRMCRFn5uZsNwBC9fZM9O2GVA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- 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 bbd44f43e375..a2a1bca84ada 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2911,12 +2911,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) @@ -2929,7 +2929,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) @@ -2953,7 +2953,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 May 1 19:28: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: 13227931 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 61FE0C7EE24 for ; Mon, 1 May 2023 19:28:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A67228000B; Mon, 1 May 2023 15:28:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 456EF280001; Mon, 1 May 2023 15:28:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F7D028000B; Mon, 1 May 2023 15:28: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 20523280001 for ; Mon, 1 May 2023 15:28:55 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EF6738085F for ; Mon, 1 May 2023 19:28:54 +0000 (UTC) X-FDA: 80742673788.15.D2C50A3 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf05.hostedemail.com (Postfix) with ESMTP id 09D0510000E for ; Mon, 1 May 2023 19:28:51 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bRmqBPTZ; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969332; a=rsa-sha256; cv=none; b=O43ecMdFS8uz1G4Gh97XGlVtxXjPoWRU5Oqr0yL3ovn4cD6QSkXgFFbpXFNw2UPedKyb2T PG5h6wOQnD6uBnKrdSGTo46NbAm/fMF7eKVzjjlKMZbH3flMDjZZ6q5ITaHkXFNae9uZFZ 6PYmai4hRyP6+8IwgLdhT5znf7pCGZk= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bRmqBPTZ; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.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=1682969332; 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=Mt3HE6L47sPJBYnAKPMz0/DxNRKvA6oRz72+XbjGX9E=; b=TOqBAmiJsWqg8iqIb9mRrjahyfyTx/B+RU0AmZwaIumzqLvKJEbPQGF3nu/HcHxeT42LBU HNFJBmIjHDJocfjsAMlp6LBWjdDQQEuAaqAzWjgIabXPHEyKUN4xuU7p66T3vuk+DtMLSc mt5T4IctjbpaMJr57//W3r8RHoPtrxI= Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-64115eef620so29037908b3a.1 for ; Mon, 01 May 2023 12:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969331; x=1685561331; 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=Mt3HE6L47sPJBYnAKPMz0/DxNRKvA6oRz72+XbjGX9E=; b=bRmqBPTZgCa5IrhecvrTPyLDuab4M/2pWmm67Ij9kB88cqyNYvHpKZf2c822tlLINs V7g4wokwjyA5yoaxqgkTwqtzjgfghwoIfl0NbPXtXdg2Gw3C4PIS2FYz/KLko7etiChc s5Y++dzV39ZBew8o5WYNHoWZR+E9Lx1p8UATOni2Z3kTd3MdcR3ji+KJhcCE5jLMM79j 4rcgjvbB4U2t2rwTpoiUyWgvBTuTWbg65E+Konk9GYsk7NMgNhoUvQ9jMEmXFDz/6lzW 5y5R3ETL6C6d8IdLyMxau5jgOeNqS9ewzuT1HexEBx4VHGUimuQrmfTb2llKzaIBnzUu BV2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969331; x=1685561331; 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=Mt3HE6L47sPJBYnAKPMz0/DxNRKvA6oRz72+XbjGX9E=; b=g2bcTJoxwXzNbT1EZDRQRo4DnNzPEoLmm1fNkyLXgG9D9LyhMesfDZ+En5iyQt63or tOP0gTPLSfvD0yeZPUOwHzkkH/upg5kbE9IVYLIHU/MbHg6UYY0nLjO91z1D+m00WRLS 6sqqrWg2Z4FT0tv8csXgX6AQ/lfbuH5J72FQN4Zw07LFXL+dS6n1jOC+ic2G9Yglr6xe xoWHtw2Mdn/fa9dJB8i1y8G/ByqRaJWXW7DiTHX2XN06FHdoy7BsEDPZu3GwFAM0CvnF 0M+fwMccVUkMQ+ZCqfNY7aOf8SezMzHKnwqPBUmIOCaG6sJpe6wLlOlMs96iF+n7RyJz pfpQ== X-Gm-Message-State: AC+VfDxQVtp/BVoEz67EJl2ZwksyoUBn/Z7aBKgtm8/8zqb/mteykLNh lILckA6fU4XvI4mdfKdjBaE= X-Google-Smtp-Source: ACHHUZ6xNyoMsdtkeuJYwr4JFA16W7bSDCfft0wt/spwymptVQy+yHqySIROmads3b5d2VYC5oAliA== X-Received: by 2002:a17:902:ced1:b0:1a9:3c1d:66de with SMTP id d17-20020a170902ced100b001a93c1d66demr18699403plg.15.1682969330907; Mon, 01 May 2023 12:28:50 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28: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, "Vishal Moola (Oracle)" Subject: [PATCH v2 12/34] mm: Convert ptlock_free() to use ptdescs Date: Mon, 1 May 2023 12:28:07 -0700 Message-Id: <20230501192829.17086-13-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 09D0510000E X-Rspamd-Server: rspam01 X-Stat-Signature: z4g5fndt9mn46xynsk8sp5kwkt46rdtt X-HE-Tag: 1682969331-561079 X-HE-Meta: U2FsdGVkX19eZB5Iiab80qSBccBsVhfS3hupQGmvFMAgqFgKot97iqCy6tUsGG0yn5OHUyJdH3hDdfiUxDrQM0npY5Aa81G5+Us0RRuiFDXBkQIvBmg3OdRDzCCm2R/JrYZugCIZX4KjP28gQ6kLIgmmBK5AZLId7nLNNEPJgWxf2TcWRpRLtqhKjQwWRTLS2R1Zxk450lyQRH1cQ9IHWkHTOAjdeZTxzWLqBmjONcpeiFvTcfwkCB8UTrS1zbH0KPiqcGqWxDakvO8chYlO+xBRpk6EQaBGhX3uKXGoj1j8cAE+GLmKofsrW+xkOqxiNqibpcWr0kF37Kc83TVQCmxi0qhib7SAqfm6Yg0AaZaVYUKPtHnqe+ZtZskKvINrux6yk/pi4+n5FyMUPeUDnNm2FvglyM0BFGdk1MhIV9D6B5gygMXowBx2l8GSrLEQPclKaeID58Euk02fC2V4lXtD6yE4VyiRNWhxWMQl5Agx0+UJ7HXulx10JhvEROISI37haMcnTGQo/tbfh8nYVpWNFX71zS7apf7DYQ8mS/ZSZlyzrtP31gkxYUZ6ArF50SahIEe4OudgHiEMlmsXqr7lUAfIfltLWgedQjDZDG6u1zjST7UAz/6u/VZWHESRGCOrkOdzdIURuQuNpaWUmcjzK34wo5XYVu3FedVqN4qMJpERvreA1MBnzO4N5HeG9HiKHYbMedmReRlm+10dnx9WGsdZLuAUn7oM4jQ2rJFxv4ewan6OkU0uxzf3KvJAzEUkAC2Vh3BkKHj6miYqCP7uMix4wOqZCmNIixLQBHDiCkiNOylnx+eTRLo3BDOfO0RT7Cjx38FhycZYZp6Tf/X8n6Ufv0xn7oGb0wj6ON94wK7WGv/quwC2VZ2/6v0xeqh9KHpa218JwrAuaDtNtNxAYgi4aB6tSImv+jpgKKX2iabnpkl8NVhKqK+Q6/Qg3aPsYdRZXyUNDEkYHgk TyoSHEmq iEDSY+t955DqCth04LUsHsFKhPZ0wvk42PytiAJIY4/fIsKxEpcd8FD/kLqgmzSOHu/+U3fhd0xgpiJVHWjHbz6tfQBUAUj0eAxR15AT9osQap5KXWWNDMg+Bsuas1ishOx64HH3/4lUmI6vFVDqh78BjaCNkv2HifEwJ5AYR+3WeFVDycc64J3U4Y5Q2dZg5vjtIrdZXUd4jItK6LNG7OOQ5wSE1dyv42nC/d12Cp/jrNtcXqX8hb9M1X/eX40gRfqoDbHebOMFzUGyvLFnB7k26Srdpe9AAnAXMZ/M/K29PmH6zpKFdnun/J0N/PNuNcC63CBqLw31tkAgPQDLVj5tjX4g9+2q1UPgNJodROlTlj4KOWY6qb53qdxQyxHAAdHIkopLfucWA5JCmn5kLImar1LMAKdaQlW0ktc6mYM32lPkXWyNAC7bl3KXxFVq6XSNOpn7mwkuRZ4IdH6ZZMDv7HB9afN/tWDTPw62vHfi5ZJeGEuqqepNqos1U/WHmA9M+sAgEUvi9dYRXM5DASu/QlmkN1B2Lei+LeObLsaanuje19BN3nTZ1yIH7rlzbthEBln2a8SBeLMw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- 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 a2a1bca84ada..58c911341a33 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2787,7 +2787,7 @@ static inline void ptdesc_clear(void *x) #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) { @@ -2803,7 +2803,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) { } @@ -2844,7 +2844,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) @@ -2858,7 +2858,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); } @@ -2916,7 +2916,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 ba0dd1b2d616..7a0b36560e28 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5950,8 +5950,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 May 1 19:28: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: 13227932 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 1A1FEC7EE21 for ; Mon, 1 May 2023 19:28:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8F334280001; Mon, 1 May 2023 15:28:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 877F128000C; Mon, 1 May 2023 15:28:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7161F280001; Mon, 1 May 2023 15:28:55 -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 5C25428000C for ; Mon, 1 May 2023 15:28:55 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 362E6AD4EE for ; Mon, 1 May 2023 19:28:55 +0000 (UTC) X-FDA: 80742673830.12.1BA3C30 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf08.hostedemail.com (Postfix) with ESMTP id 5427516001A for ; Mon, 1 May 2023 19:28:53 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YU74FvpH; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.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=1682969333; 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=L/HbzXYZlFs8Glr3mCgcQ6yZjaq6zFAfxmTJm9brDXY=; b=YAmpGRkAz1Sobz2CEJSdMXdbF6eMPKQ+I72yFyorzTKz4wvlqxtUclLgaB/WsBBJ2Bjuew p4gDILyxCrd5C5b21vO9miAISSozCg70kOhuIQpu9AM1F8YnvYBVJ5P+V/PalTV9SDS4WE n96/XVZ3m1bhYP+iD9w4xrghlmO/APM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YU74FvpH; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969333; a=rsa-sha256; cv=none; b=vIJ9iV9ohxfikiEihHCVBTFSjAv7y433foXDwun+alBZiImIg3VQvb+N7M0b+lMLvtXkWe 2sZq4nZfs4tH1fZQvB0zNUxo7tAEIwGpAmM1hqdphSyIaQlY3Y1KApcFfvyhyJQIMQ1zS3 UNKlTz7Ht5DvvOks+Aq8fWUIg1+Ymx0= Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-64115eef620so29038013b3a.1 for ; Mon, 01 May 2023 12:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969332; x=1685561332; 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=L/HbzXYZlFs8Glr3mCgcQ6yZjaq6zFAfxmTJm9brDXY=; b=YU74FvpHQCK1VqAuVX8r2BjduNpUerOh1yATlR8mKQ/tJLpS2WI1LKB7NUnPZev+ku rfgntGzBluAMKuHfK/jms2NgctRzUuZHcxtFDuNiPPeXkbQ7Z48v/aLnoLGhmcKi5okk NTHNilz0HthKY/XHg97rKwZvMnLAYPI7U1eBqYo3DUIS7zYhW0tg5v9W5kNg2nZAJHx+ 0W0xkqlDIUsVkMuesra65fGttpYRxCYfqsHDDsc8zlGh06W2A2UnpmXTtrAlRE/I54n/ 9b61gxsFscmWDNDgpJxss4pOhFtz/pn5R4Qs2mfASivX3bx3H5gbzbMc69UUOvWi91zv pr8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969332; x=1685561332; 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=L/HbzXYZlFs8Glr3mCgcQ6yZjaq6zFAfxmTJm9brDXY=; b=Dk+sOfzXMbrCfupOviAFTeXCPn0Js5tzNiThXHQMlGxSRLqSA4uBx8nuhZBE73F4f9 HIyvptf7exhQb2EldRND0oQealARg3+R7Gkoz5+LlqSO0dIw4zi+41bG8c2aPixuz8Yn In4lKlEO/GVVblmrzAthThFmkO3DGg/CqesJbZ+7LXYYZPZj9ZzpT/t6Rk987NPP3TRl i8q8P3kR2xb9QUGdA/QpMgE1Hsm7pfzK1UUNO4hSnnVPID0QTzdcbzbcM6cZAymgBVje 2UN/Xtvzh/8FTDDqp1zINLSLYdW2zSdhpnQ9llrgdyu7b0OkXWr2utbNealBBmcoqfkv /bzQ== X-Gm-Message-State: AC+VfDybodSv9sftVfnBvWWeL1iQ8tSUV6mSC+xzmZfaPj2Rh5EQNOoY nkicL4VdA0kzEm9z1fnKfMI= X-Google-Smtp-Source: ACHHUZ5tlVMWyUaJdG9fqFVZnpLPEvgTINU205p9ECnUgFr/jtV6hdVvJcRfvr33OgCYwfP6dTnMLg== X-Received: by 2002:a17:902:c94f:b0:19a:727e:d4f3 with SMTP id i15-20020a170902c94f00b0019a727ed4f3mr22987004pla.5.1682969332204; Mon, 01 May 2023 12:28:52 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:51 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 13/34] mm: Create ptdesc equivalents for pgtable_{pte,pmd}_page_{ctor,dtor} Date: Mon, 1 May 2023 12:28:08 -0700 Message-Id: <20230501192829.17086-14-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: 8fi7xm9s4q5kc13oedc3aba6x47iakct X-Rspam-User: X-Rspamd-Queue-Id: 5427516001A X-Rspamd-Server: rspam06 X-HE-Tag: 1682969333-608462 X-HE-Meta: U2FsdGVkX1/g8aAPptgaO5DbFwO3/7btMoVSaMJwdvsVA9uASfgwWabNHsp3ZzEukygk3KFIs6FCwXEIZMqOL2Hmv+pTxoocmVk8K+/q6YNtR5ri60J2IikPEWP1pMtAGBoKXM0VyiZGq24WhDGXIP1jiKs1cqffexOe374wk0KDl89u6OgWGcDIQqTxrf8I+f2+tkpo9REJscfHy0bULdLwximfNYl26Kvu1UoXaS7G5vVGW7jzBgsLHq0C13R6z4yE/qhmTmKObDkYTApWfSk+AOu364Ng67wM65COtuFyEKYlT72QNkFt5nsiq1C9XSerswr9/rjPdI6Bw7lgoBZrylW4pamK06H/i+Irv3mVQPgq0DDCupXonS4IDZHF/YSuLUqEOZXnFVLmCh5EfBEDLtjECxA3izOfPVVFoHIOPo3mFWOPm6oYpzve2c4op2qhCoLctVirW4pOVfSeXbjMdQdyqkST3JAqV6vh9+q3/UnWV87lkWsr+nevP3Pr/thqMVyUt8B9/TC7vhg7u+vldL0Sn1in/JuJZSlzMm3DtsOiv5zH6xIRGZOOIOcvC1E6pAhS//FJWJ9sX7QcfNhJwBjftobu8VP79J7kHcFK/WxVED9AaCrl4shXT8qqYv1/q8YAfU1ITNM/lvv48+zPMRcxTm0ZpEYTqAKoKo2erlD+Bciuf5jrNplwvCI/9zp4APE6ItmMEYOJ6C010IK5YCHiYNCSUnewEBfZ/xBF8h7I4NrWC+d+xXI5qH3jmC03Kqa/qVLCLf8xoSJpA8/4L9b087RMwFnZ/wfzwH2oM8luX1ADMA2BCO+N3VmeqGgpSn6Bfm5FvN/07YCiCupamne9RfUeq8NxPuxxY1TLy7+bvaixcopsAHTha2XlwZheWDS4wyeCj1womXImejxM76IvjtqzMll304kKWghqHg6HEFbFZraE2pCfotb4KH/kTRmespJMjf0bYvO MXJncEy3 xIKtTIss1qVB//7eCiol+JzLPvfqE1Fil6jq3RAlh9ygTk3abx7MVeJev3LzT04sk/1NPZC+wWMBoTGOhOlZv9j83+UA+YwiSGGCigWZZT6IepoYXsIRUXsq7Q/U4U8Zv8NU0JPFJoawQaflU7lkN/b5Ksy26CRs48yORLLQojC8WmH2G8gsLvDF1gYt8GXINIbFKuxO+MRsimNiPkFfbgAs3BmM7BMBelfbSPXG3nB2A/wdvqhNreI2RbYurcaCRYYWDn26r89iBpCP0heFRF7XgyOeMtvH+xe9Rtv5cHgYqDiXjtHNwcEIwUHZgQdDoBP/KHaQJjkY/p1THj3OiUDTbQOY7jioBkIpOOGZML9yDM0ZSkUkRQz3ibxEcx5k6K+4jsJf4CFLvA9SZAdmqUNdLSxcpjyNhU+gqwYlmEvIWJKVmcikswg9kxzsNGTdDvgHpkLndk2WfEVoFpvdKHC5DXOW2gYjIxeCakeq2KZ4wUG/+bVJrPY+rhkQxzRlMhRfgaAaBjk79wpyrmVJ0SqwIIns1xOv++TwcGRPQ97gak+slFNgYHzQUtm92TV289aLggDL8NWENVVw= 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: Creates ptdesc_pte_ctor(), ptdesc_pmd_ctor(), ptdesc_pte_dtor(), and ptdesc_pmd_dtor() and make the original pgtable constructor/destructors wrappers. 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 58c911341a33..dc61aeca9077 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2847,20 +2847,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 ptdesc_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_table(folio); + lruvec_stat_add_folio(folio, NR_PAGETABLE); return true; } +static inline bool pgtable_pte_page_ctor(struct page *page) +{ + return ptdesc_pte_ctor(page_ptdesc(page)); +} + +static inline void ptdesc_pte_dtor(struct ptdesc *ptdesc) +{ + struct folio *folio = ptdesc_folio(ptdesc); + + ptlock_free(ptdesc); + __folio_clear_table(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); + ptdesc_pte_dtor(page_ptdesc(page)); } #define pte_offset_map_lock(mm, pmd, address, ptlp) \ @@ -2942,20 +2956,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 ptdesc_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_table(folio); + lruvec_stat_add_folio(folio, NR_PAGETABLE); return true; } +static inline bool pgtable_pmd_page_ctor(struct page *page) +{ + return ptdesc_pmd_ctor(page_ptdesc(page)); +} + +static inline void ptdesc_pmd_dtor(struct ptdesc *ptdesc) +{ + struct folio *folio = ptdesc_folio(ptdesc); + + pmd_ptlock_free(ptdesc); + __folio_clear_table(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); + ptdesc_pmd_dtor(page_ptdesc(page)); } /* From patchwork Mon May 1 19:28: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: 13227933 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 4DB34C77B73 for ; Mon, 1 May 2023 19:29:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4B4628000D; Mon, 1 May 2023 15:28:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BD3DE28000C; Mon, 1 May 2023 15:28:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A747D28000D; Mon, 1 May 2023 15:28:56 -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 9432D28000C for ; Mon, 1 May 2023 15:28:56 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id EACAB160824 for ; Mon, 1 May 2023 19:28:55 +0000 (UTC) X-FDA: 80742673830.10.BDCC879 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf13.hostedemail.com (Postfix) with ESMTP id 2E64320018 for ; Mon, 1 May 2023 19:28:54 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=B5BQ0PUP; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969334; 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=ZNft63XW9H/x5zK6HuCJK1zZ20bn1woHqcJTdinQF34=; b=5FH1nh+G5WyU11Oo87ffvJUkJsT5g/rNqBLRIiE+56h4V4qkYJsHWp/dN8N5J2vxb43COk 98UU0ndVinsrZ51YQcR3BCcM9hAeAFt1LFLQi0lqznIVqs9iu/gF6nmMniHd9172jPLl+w XvKp+rroGy185pdqOy4Ok2RfmZt8yZY= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=B5BQ0PUP; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969334; a=rsa-sha256; cv=none; b=znhpK8lYJxX22BuMnbYaEaNE6UPSyQKxvXRDAn/Dk4DeIjaFiTKFNvBrnpGk95i645nPxs BUTlqB3ZVlu4zEIHUw64VlkKWAxcO6Jr5Uc9xARsj3pnMF+3yFwM5m+gDdK91QG163n40W im1SfdVA14CIT7zQB4OFX7tWNE28Crw= Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1aad55244b7so19088465ad.2 for ; Mon, 01 May 2023 12:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969333; x=1685561333; 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=ZNft63XW9H/x5zK6HuCJK1zZ20bn1woHqcJTdinQF34=; b=B5BQ0PUPuJOe03g2Zj4SmcYFdZoHhvQEhjHjXIrDV/cPLgWmHOnGLph27PMtDy+gUk vrb8aMyrjxs7+rH+bt4rcFQy1jeum2KTcgeZne4eID9YQx0p8xFIvsQDPlXa9T02F5bm XDuuEHyhAFLF/N4HXmu9lHkWjBlAxtCK794Vd1UTAVcPxs1s/UJDMyYjBVgG5TX0KFIE Ex1W8v+MyjG1XFcX2NmMKnrKsIeNEQB+OMbajwZPymWFDvUYoyj1bmkkKVL9eBJZnPmo n2i7pNy6eK/amTh+JnM4F05ImhBvIH/eExR134Xtgm68Uv7no3ItCNvBtZlMVAsp6dYE 5mrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969333; x=1685561333; 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=ZNft63XW9H/x5zK6HuCJK1zZ20bn1woHqcJTdinQF34=; b=J9yiFCpKRamHOj+4+9qfj9l3/6ZR2j4n4f9UrEl7ZDDw+mrfWleDrceQ5G4mvoQk4i Alpuzhf7w5qdbz/y6ZTLgWH0Q5zqv/SgUWfHx4gLOj3nm5GgFDK8EknulSORU8TtAc16 7YdsXo5fBv7e26iwZzDKayOp9vh6AMLI6ZdJoq7+k7W7I9sW/z3VlHkdmO1ygCB1mxIB GZRv+IZCkZG/lV0gmoy/Hv8Cs1SrhEI+aprh60/Dt0RPNggbPou2HvUJ7UtBdx3qn9oS Cr1NcPHcVt/h22xvRqAS7UsUtItceSjZlNnJb75I42RzL2lgUvMTTe8HCxaOgfFDHppy 1Sug== X-Gm-Message-State: AC+VfDwulpI1IO6Te5zoD5IGR0ijVKam83xmPDQoAE2WA24IZud12Jpn MRM3cG9UGOxew75Mrd609Ao= X-Google-Smtp-Source: ACHHUZ5/VRaG2onpIf15XR/3p6i4VphUhlpU8l14iUMmxT/o+LeZ6COrGbtS8DM/yhDOMNorlLAd2g== X-Received: by 2002:a17:902:d48b:b0:1a6:ef75:3c53 with SMTP id c11-20020a170902d48b00b001a6ef753c53mr18457119plg.11.1682969333517; Mon, 01 May 2023 12:28:53 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:53 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 14/34] powerpc: Convert various functions to use ptdescs Date: Mon, 1 May 2023 12:28:09 -0700 Message-Id: <20230501192829.17086-15-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2E64320018 X-Stat-Signature: ywqg1xdapxh8e8xts68dfmdcqrkzx3nh X-HE-Tag: 1682969334-751515 X-HE-Meta: U2FsdGVkX19jd5Wnl0oHhAT9TWkZW6c4a0dqwn0sq/UAWqgwNjvUYuBLJO45CFZPkW3j/s8gY9sn+QJ8bQoYpkiBEk8pc+si6xppLc84oEpuuiVMEG8p+PM+OWkMqpqyg7Q868o3c6pHtwZXGNUYsLNg8Q4A06Q/ufhZp6uGPAe67UVTIUIKo2eHZ2rPTNT4LWhSubTRzW0fApiCYy8DigJy37O0+9g09EgXwcuYl5LeFCoahSY/m0fOs9dEIrhDUL2Oimy94tJ1A9Lo615YiRPtcz98OUchK6YboJhOHZ6lqJs4AoW571JEDD69qaVGqwF+GHkiWsAx+aNd+bAbihkOAIID78UnJEtbKjT+o2PFwsiQg3Fm0r5ZlY8IZV0v88WLTRy/wMlakI4hKqKDsXXMGRlHS+OMiRTFN0lD0tkvkAfP4alUNJRYq/dsbYbB8bH8L/gNcRZ3mW27e+827c7SdyNSx1HtpTFUlB6e7WUnZcwyXUGanxbvUx09dSsZdj1A8xoOMzpS0AqUnqhXi6/76X5iOMlhdrThP8LMq3Bofh8843R5BvRI2PEo5/8oMK2dszqIvsOPsZKQEwMEhMeWWUsgJKJte2pxmmgJJhuopYaCsTkEyKuVrWKnqjwTTwMuPU8js3uK0nB/EWBlUCcK6wgVDvIWzKBOPkgnvCG6EQ4g0MFHyoXLnk4+u5riqXS1BYADYvcTnxFXPNpt7EBSHxFDhGKEZsDYSQAmBQNzQKAV/iu50woZndM32qL4jJKBBuBcYpUBeU9jGHzLRDZtIhQ5fGncZg/5rJyqASfUKLfHQ/y87+i6b8HvimgXYzsN63VG+f9u+QPtqT4TMp7ozBt6f6oSFaxH4lf9EO4QEZu1nG+/ktKp1Nh5aCiZivQdrj182euZiMrC11G/KeEGMOgrC+bRW/u0q+g/IBCrIJJ4Z4b74/L4OdgVHGUJPO0+d+yazyagZt9qA9v ePcXEpHu LHFzyWu1qIWJ0939YoqhVxTEpaDoNBRL/3TN9LI4clSP6+Q9LCAUTYmRH54dUUS/xclDzSb4D3wZFjq2e8COQ/yb9Vv1LGLIyzYgHWWRTmjxkTn4tEusDY9CcRdhbfLgdxEglq3DmAoqjp2aHRtgM9qlKO0ru60zTFDtARzvY+I9QmKl/YC15lGWRMnw0K9i/WlGXFijI7IN8XOP/p+NK4fEyQ7ZkYHQrfTWqtho3c5i8Rrv3YfzjQk/5pZcoNdi2HehQvbpAuRWf24p3sYTGYDLvee5d0uYYifg2nZQ0xfyzyyxwIditsvXaUt0/UOmYH72UNQVvjkhs4O4dbEY6YAoYPVR+j3pMwHbC3jQdxaeCn058SelXJTSkQS0xQRucZUQ5Po/2G9Pm7e/Frx5UOSZIczi04ygc5Htf5MmRYAZXt9yf+NR41AQ3D9olLjodZuFsdRRi26C6E1GNmhraVmILknwkYRZfg6tlAPlXqyoyHAKAmlOf2lRLejNnXWyjY6y1MdjjsdGvgqlIZELUkqAk7R+nVHVzLyhnjXenkCMwhclgk6/YXU6ntyshvd4j+148 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: In order to split struct ptdesc from struct page, convert various functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) --- arch/powerpc/mm/book3s64/mmu_context.c | 10 +++--- arch/powerpc/mm/book3s64/pgtable.c | 32 +++++++++--------- arch/powerpc/mm/pgtable-frag.c | 46 +++++++++++++------------- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/arch/powerpc/mm/book3s64/mmu_context.c b/arch/powerpc/mm/book3s64/mmu_context.c index c766e4c26e42..b22ad2839897 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)) { + ptdesc_pmd_dtor(ptdesc); + ptdesc_free(ptdesc); } } diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c index 85c84e89e3ea..da46e3efc66c 100644 --- a/arch/powerpc/mm/book3s64/pgtable.c +++ b/arch/powerpc/mm/book3s64/pgtable.c @@ -306,22 +306,22 @@ static pmd_t *get_pmd_from_cache(struct mm_struct *mm) static pmd_t *__alloc_for_pmdcache(struct mm_struct *mm) { void *ret = NULL; - struct page *page; + struct ptdesc *ptdesc; gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_ZERO; if (mm == &init_mm) gfp &= ~__GFP_ACCOUNT; - page = alloc_page(gfp); - if (!page) + ptdesc = ptdesc_alloc(gfp, 0); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(page)) { - __free_pages(page, 0); + if (!ptdesc_pmd_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - atomic_set(&page->pt_frag_refcount, 1); + atomic_set(&ptdesc->pt_frag_refcount, 1); - ret = page_address(page); + ret = ptdesc_address(ptdesc); /* * if we support only one fragment just return the * allocated page. @@ -331,12 +331,12 @@ static pmd_t *__alloc_for_pmdcache(struct mm_struct *mm) spin_lock(&mm->page_table_lock); /* - * If we find pgtable_page set, we return + * If we find ptdesc_page set, we return * the allocated page with single fragment * count. */ if (likely(!mm->context.pmd_frag)) { - atomic_set(&page->pt_frag_refcount, PMD_FRAG_NR); + atomic_set(&ptdesc->pt_frag_refcount, PMD_FRAG_NR); mm->context.pmd_frag = ret + PMD_FRAG_SIZE; } spin_unlock(&mm->page_table_lock); @@ -357,15 +357,15 @@ pmd_t *pmd_fragment_alloc(struct mm_struct *mm, unsigned long vmaddr) void pmd_fragment_free(unsigned long *pmd) { - struct page *page = virt_to_page(pmd); + struct ptdesc *ptdesc = virt_to_ptdesc(pmd); - if (PageReserved(page)) - return free_reserved_page(page); + if (ptdesc_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)) { + ptdesc_pmd_dtor(ptdesc); + ptdesc_free(ptdesc); } } diff --git a/arch/powerpc/mm/pgtable-frag.c b/arch/powerpc/mm/pgtable-frag.c index 20652daa1d7e..b53e18fab74a 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)) { + ptdesc_pte_dtor(ptdesc); + ptdesc_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 = ptdesc_alloc(PGALLOC_GFP | __GFP_ACCOUNT, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!ptdesc_pte_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } } else { - page = alloc_page(PGALLOC_GFP); - if (!page) + ptdesc = ptdesc_alloc(PGALLOC_GFP, 0); + if (!ptdesc) return NULL; } - atomic_set(&page->pt_frag_refcount, 1); + atomic_set(&ptdesc->pt_frag_refcount, 1); - ret = page_address(page); + ret = ptdesc_address(ptdesc); /* * if we support only one fragment just return the * allocated page. @@ -82,12 +82,12 @@ static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel) return ret; spin_lock(&mm->page_table_lock); /* - * If we find pgtable_page set, we return + * If we find ptdesc_page set, we return * the allocated page with single fragment * count. */ if (likely(!pte_frag_get(&mm->context))) { - atomic_set(&page->pt_frag_refcount, PTE_FRAG_NR); + atomic_set(&ptdesc->pt_frag_refcount, PTE_FRAG_NR); pte_frag_set(&mm->context, ret + PTE_FRAG_SIZE); } spin_unlock(&mm->page_table_lock); @@ -108,15 +108,15 @@ pte_t *pte_fragment_alloc(struct mm_struct *mm, int kernel) void pte_fragment_free(unsigned long *table, int kernel) { - struct page *page = virt_to_page(table); + struct ptdesc *ptdesc = virt_to_ptdesc(table); - if (PageReserved(page)) - return free_reserved_page(page); + if (ptdesc_is_reserved(ptdesc)) + return free_reserved_ptdesc(ptdesc); - BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0); - if (atomic_dec_and_test(&page->pt_frag_refcount)) { + BUG_ON(atomic_read(&ptdesc->pt_frag_refcount) <= 0); + if (atomic_dec_and_test(&ptdesc->pt_frag_refcount)) { if (!kernel) - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } } From patchwork Mon May 1 19:28: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: 13227934 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 49FE3C77B7C for ; Mon, 1 May 2023 19:29:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8294628000E; Mon, 1 May 2023 15:28:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D9C528000C; Mon, 1 May 2023 15:28:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6533428000E; Mon, 1 May 2023 15:28:58 -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 5137428000C for ; Mon, 1 May 2023 15:28:58 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 057FAC06F1 for ; Mon, 1 May 2023 19:28:58 +0000 (UTC) X-FDA: 80742673956.24.D1BAE15 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf22.hostedemail.com (Postfix) with ESMTP id 33C3DC000C for ; Mon, 1 May 2023 19:28:55 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=AxAga4ao; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969336; a=rsa-sha256; cv=none; b=0IPM1HOVKblNkMzxfJUVg+GuYwVaMrvEY0gsPnV+YCMsN+eIltbCy6CAkg6ESL9mC6chhe 1UrisFH1Rd3TrBJN+CobcJcLRghCAUQn1ptYkqF2VAWHA2PvQL8YaEz73rpGnqnJOdUydg l1mrRcSn2EMCOzqcGqmxychYA0gUGdc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=AxAga4ao; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969336; 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=/Q5rpHIbLtPdsxzDzaO3buqXOd2yqrT0Z007lfiZkpI=; b=GUkYlTQmQUTbZck08I3PcF1yIRyMffyGi+arRX+n1vuvjHsPg1KSQzi6IlZO/ryhpDkBYE zY9wrET6Yq+4StQqNQH0xHq8MfRE6XeKHaKxG3OjRSD035uD4dDQFw2AnejkQP/HR5kWgc 9X5vQrLsI36FtCyXRNvNMnzRqNkhWBE= Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1a66e7a52d3so20939015ad.0 for ; Mon, 01 May 2023 12:28:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969335; x=1685561335; 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=/Q5rpHIbLtPdsxzDzaO3buqXOd2yqrT0Z007lfiZkpI=; b=AxAga4aoXPNlXE7+DeUiTXETzfeeCHbm4zGppPqr1MDTZFxhWAViYrGbWyE6GLWt+9 IB0rpQEMaD7N9ypKiOPbsaINcslUNsYjGQTG5q5vWeCnFZgA7dcIKUsRPd84RGXai5h1 l16CjSDmsfosD9KMmdT6xq8VRCXKZ9G6YKbNHAZjIZoU/NfYHkwEKIBnMm9mpAHGxSXg 2woYY+DxDFTOnXL4g3fftw/6LCcjY+gzdniMaWURcfFDuyLcW5IhoWI0SL4yBh+tQBiv tdoOcx5iHNlwMY/jUOXeVBpbt3BPtJyBIMif2r3nZba5xvX4tcuGQGviD0d/uLbj9ohj JJbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969335; x=1685561335; 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=/Q5rpHIbLtPdsxzDzaO3buqXOd2yqrT0Z007lfiZkpI=; b=RzXqlCwz8Swdm5gvTAJNDMzGIP5W2eQIKQ7jRpnI+Dox83zKR/PGlsTFKx73THYMHS wdMm4fsv8NFXk3Ne+ouPZlo632akvq1Bc7BZwdPvBwTQU3F7uO5W83djibUGNl1IK0yg bZ2LaO6Y5AHi1j2mG14SwCzHMtd4J2trrCeH9P4gsPR86tyVusinjCn1SbbLaOgNx9P5 3uenurGriidq8Df7CESj4Wdk7Jwxrg3eKwdtYnNAXPSw94Gw1V7ahCeDkPx4T1dQRnQ/ UlPBcF673MyvIB7I3+8NetXTRj4qXuUAFFVMqgTy2ApxHdsfMjZXJvaPH7TaLT1x4UrG c7/Q== X-Gm-Message-State: AC+VfDyo0A6di/AtfzbWTTteSoD0ihwY7MzPHwquG3OTCqHHPTaNIV0i rTtRsKAyTo7kUyj6MpY4Z/E= X-Google-Smtp-Source: ACHHUZ70tPtnwybaj+jIE0QGoYPcdHCYjv99qqOX/zc6uUXZ1o0XGtKwgumEUC29ZoX/UBhdbXOt+g== X-Received: by 2002:a17:903:41d0:b0:1ab:12a:bd2e with SMTP id u16-20020a17090341d000b001ab012abd2emr2887995ple.37.1682969334945; Mon, 01 May 2023 12:28:54 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28: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, "Vishal Moola (Oracle)" , Dave Hansen Subject: [PATCH v2 15/34] x86: Convert various functions to use ptdescs Date: Mon, 1 May 2023 12:28:10 -0700 Message-Id: <20230501192829.17086-16-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 33C3DC000C X-Rspamd-Server: rspam01 X-Stat-Signature: ids8cbne9anb1tc6zgccf8monuspa5o3 X-HE-Tag: 1682969335-678021 X-HE-Meta: U2FsdGVkX1+aZzHaHNjX5+kcgEr7cXyPLK62aQkylpYug2ldEemxflgikHpvg+4r7eOS8XwHdVB+V0o7GHZIvmbrrmjOzEiqAO+7pSvkRSZaLWQPjxOZUx4iBWsi2+Fkswyx3vtzG1gIX0QZK/bVXn0VO5troyCp34jR8Wclld1KtccgVM340YNl9sJ1RMKwWA6i20pOQ3lqc0sKTvW9ICs1jfJoKjHM6nM5hZ1PylO/oGJ/y7lTBYCQhqP/4b5XkoQONh/vhfTahARMcgdzfrnKrTS0Av+OGWEyli9Py/Rg12iZMfRFLwqucG7YcoR0NdEwmlGMTlyb1a4J59luBfe/nZzmruMPB+khbgQUjb2+DePlvrQjPCYaQstsEbg/0e5vz3UX0NKAsa/FEt4Cz4O48IpVs3dZMkNjODHFu2YZT0o6iM5pgQiCuR6YArq5928crNPVJvYtFlFg6+CcHpVkGyM5RfNuKQ9xGTD0sHXFpNj2nGNj3girsPjQmNL7/rPxlujUyvQVmowHpcdqP8RA3VKGbt2kFtQMFao/P7mU0r6nkEP44TnElbfDrUtnRtCcQRC6KhKuBRt8Nm+qKh2RWKJtsSZ91PWCV9ReOrGJTfsB3sEQ+aHuvQBBTSNNh/WB8TF+iEe84OgUfUsRo5FoJWeZMHlyghqp4ajXAl4RnUgIKMSM8mTOBK2cY1AwPxSjkuSOX3c7226PALuwCDWqjQpLEkenIE2vw+/k9xUFOmEc3l/SwDFDXw8Vl4/NaNcdyxNgWrQxGPtUnl90f1TJC3R0Xf66bZJTEHsn6zrhYOhK5TnJgJPoT1lANITeYqQ4y6XLx1qEgXrcT/Fo8Ee4Jilrw+z8bgGFNOBIBAlz783AcEiBL6TlxxZ4JyKNGtLil6htlA+dOR0BKnYBViUfYMU6N8dJNQZ6gqPaYurwO0i2lbeGkJoaZiJaX7Cdb2o/xyNOuVCLTPKOMG/ XDe4taL3 vpK7MXoXBcquvMhX8OO84/ATaOy6lEO1I9NTHNf6tmIgYZPu99qQDcdLh/2KKfNfBmq7zURGzvgm5JQD24c1QCAgTOoY1hYh7iuddXkT9rSq1KYPcJNbZrcUPG1tiBllP3gtin+7Vosf7aSakWjU6fBjJCLe4pB+RmL2ENGgjNGUViNAXK5aAv07IRFdTQcjK1lXaUPfB7k9u2O56xh+59bIxWQKn4gFFSLh1eRT9iJt5AEucc9TMrOIC2YheQQwGqmFqKFQngdqU7nWE4clqJWrIVMvUh0bWTnlyadpKuQewa39j/C/cGLxHvAss6ozYWUv0o+y0oFs6/gknmkYggvtPZb4nTifpFnPeJJ0eoNIXMu76i5n2zP+pbDc5hiySrhbQat0Eyyo6VNZKjne6Sb6J7Widfnv4pchEg1OM07OQ1/BOwj7E1DFAIZeYsnAwDnr5HzSg9hDy01d7Aen2GWjajI5y7HvKmOnUEMKJJB2pobdyR7MG8+cec8lSlCC2hfSHeHfu+PbQm6iHTJ93R9gstg== 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/x86/mm/pgtable.c | 46 +++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index afab0bc7862b..9b6f81c8eb32 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); + ptdesc_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); + ptdesc_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]); + + ptdesc_pmd_dtor(ptdesc); + ptdesc_free(ptdesc); mm_dec_nr_pmds(mm); } } @@ -232,16 +235,21 @@ static int preallocate_pmds(struct mm_struct *mm, pmd_t *pmds[], int count) gfp &= ~__GFP_ACCOUNT; for (i = 0; i < count; i++) { - pmd_t *pmd = (pmd_t *)__get_free_page(gfp); - if (!pmd) + pmd_t *pmd = NULL; + struct ptdesc *ptdesc = ptdesc_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 && !ptdesc_pmd_ctor(ptdesc)) { + ptdesc_free(ptdesc); + ptdesc = NULL; failed = true; } - if (pmd) + if (ptdesc) { mm_inc_nr_pmds(mm); + pmd = (pmd_t *)ptdesc_address(ptdesc); + } + pmds[i] = pmd; } @@ -838,7 +846,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)); + ptdesc_pmd_dtor(virt_to_ptdesc(pmd)); free_page((unsigned long)pmd); return 1; From patchwork Mon May 1 19:28: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: 13227935 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 328C2C7EE21 for ; Mon, 1 May 2023 19:29:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CA4D28000F; Mon, 1 May 2023 15:29:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6530728000C; Mon, 1 May 2023 15:29:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CC6828000F; Mon, 1 May 2023 15:29:00 -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 3BF1C28000C for ; Mon, 1 May 2023 15:29:00 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id F2E321A0580 for ; Mon, 1 May 2023 19:28:59 +0000 (UTC) X-FDA: 80742673998.08.997CFA7 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf16.hostedemail.com (Postfix) with ESMTP id 25F53180013 for ; Mon, 1 May 2023 19:28:57 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UkuGYyJf; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969338; 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=Ij5AkRCa+yootiVPqcVahGB0vu642P/kX8VFrblz4TQ=; b=Ic88V3D/YO7H726YsrJ7m4fuoSRsNpNvcsQ4z+OkQiA+6YWx7UQxcL5bfWjLFwa14kIuiF r8gqBk4WetdK3LsoxMWMh5ucIeukP5tKfmmY7rATtaq1cZHzzOZw41HPpNXIBYvOZf7MHg nbzgJ5sfDL8hhobTtZ92G+WYpvfe/q8= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UkuGYyJf; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969338; a=rsa-sha256; cv=none; b=rTWHV4Hyvc+0d2xKKP/J2uJohsystgjSlbsOzwtCWhg021aQYMqOsvyZEslInpPAuQB7Jo O0nVpLBdMor55P1Chkt6N+brbLW7X48PsACtN6jmigzZ+UCuFpsym4dSsedsyQ9ROYI/Ga bQhNJUNUkdkWK6mAM6Q4jk4pCLUAeS4= Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1aafa03f541so12194745ad.0 for ; Mon, 01 May 2023 12:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969337; x=1685561337; 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=Ij5AkRCa+yootiVPqcVahGB0vu642P/kX8VFrblz4TQ=; b=UkuGYyJfBaWkUOY2u3PlvKhnoh02w7kKy6Yo+3jgJq0jrvHddqf+dLyHTj9abI3kjB +3BvMKKzDVLKdOt8tjDXhylN3ftFB2Dv4naACQiv7JfxIAQ+eWqFsM2f729a64J6CKIo OlCeiwuLQwZBmOQ0K2+KuoVUh+iT8KM5gemKLrwEoCjwq4V7nKjRwu9ccr7I3jE8KUCP /cwHlob/NeEwLBmBQ0+XtF7e7T+SHAaH9GHToGx8cp5jdfXxZIxid4S+cFW1MgiFv2tg PqSj02mK1VvkeR5635etrkR82//haDgUAAf4WRjR+9CVW5EPPVO9DB3jlHc5FET3LbQo Yxrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969337; x=1685561337; 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=Ij5AkRCa+yootiVPqcVahGB0vu642P/kX8VFrblz4TQ=; b=jd0JLEJW8nKXcbbQPyOYtntYNXQxmWjpNIaNVjM7rhGvdBsQ9oJTPM8Hz2jKadJE8i /NgBUCilpdGOZPHhISDETLwAq37rwAT4Nwp2g6Lj2TmTp9SvqVbOOEw+2yYCoXHOK4XR wkfuWUIgJVXCZ3t4DMX/0Sg8T3kgpnvHdg1tFRd62AbVhC2UXl/5ZvKtKgfjNTjASk/g bCdqlzahc3ZAWe7wu00pKoLCW5G2ayABVddtMrvuzqSGzsZcSbLhMYb052rlirDPP/m0 oI09n6D+/aAlZOVg3TqCoCeeCfkV9ubFFrCenQ/NRXPKzmll9lce/Uq/WFzsMS6wePf9 PCwQ== X-Gm-Message-State: AC+VfDzz7DMC3J1PDO2e1w1IOu/66UkC4hLonSAyrpSRPGa3H4oapFmm A+Gx5DYBOygqF554548xmCw= X-Google-Smtp-Source: ACHHUZ56JMfJkN+zfbveEwGUizMU0dJC7BXLEE13YfG4Ba6DaXws7RlJ55LFBdOT1As72Xg5aIUi5g== X-Received: by 2002:a17:903:2343:b0:1a6:b971:faf8 with SMTP id c3-20020a170903234300b001a6b971faf8mr18128456plh.53.1682969336571; Mon, 01 May 2023 12:28:56 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28: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, "Vishal Moola (Oracle)" Subject: [PATCH v2 16/34] s390: Convert various gmap functions to use ptdescs Date: Mon, 1 May 2023 12:28:11 -0700 Message-Id: <20230501192829.17086-17-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: mbhuwinjxweewragwc8jtt3ogtupi76n X-Rspamd-Queue-Id: 25F53180013 X-HE-Tag: 1682969337-436663 X-HE-Meta: U2FsdGVkX18iBTPyiMxiOpNvmKlV6cA+Hxmkb8Soy5S3pv7qgh9u7XmNN4DEzm2HgVttFd+lEo2CsWu9EEci/ThykaYi7/T8RUB0GMIYZfrHwXxP52TZZZ0+G1l7rPehmftYE+bgvO0//K0+ellvueOey77as7UFPNSshapu9rgV3XsXa4l7/qUPMWGIn1nssYnIRU+5ullqcBpi573jpmhN35UuQZVTKr3yTeBR7ghgAhkpNY8WkB3qSlfePwKR91KcO7vw5et/2B52JOeyEtmFRM2TC2zTI2JPt73sIniqX+knJXCJTqahN1C7/Yjei9SKvZbNIrBPH8x//ym5tKor+LVwxlTltJXw6mleiZbSrifwxjFVxSsKkz6EWp9pPvZ79zaycTbDfhY164to5dec3ECeMWREtcpUmKuS149hlI5DUqh/AYjV2nJsISEbeGDwpHoMjc66ZzL1Ux8f7mh9+k9cYKn9JPOiy+nfHSsjtwvHXL+jius4kCNzrMB+j1PoYGTlKIcujuIfjDF6WWeopO/ZahwQZ4RrymOi0IBMxDAGBHgbY+c3w6ktksKGDfsjCurcK2AG6jEDeVeWJnnmfoUN27mxpJPFyBAqlqXtL36dSI/d0Kg0LJhv18fuKyXJCmkPZJErM+edaj09paaQxesKK4p4e8PrmgKgO2BF6f4ZL5WlK7p0l8Ny1r65netXrteXnq+jo2C014i81zCyQ6C8kNy4hUotH7wCB7eUSZBc77PgEdQ0R55+S0HUByDmCysXyHeqFDPYxKafBDczWyL37FilOA0IsNgXcPIw7YqTRmiQXZ42CRd/s5cvwWUli+G/beRsWEe36L6Eod/Yb7YvSb0z1M9oWID7BsbS+WU0V5BT8Q1pbNBiL7ADSf6hMWnjZUqO9uJ22fX7KDtvl/cN/q0uq1B5SaLL7U5ixkzfN7hyDpBc23Edk61HNnmUG7I5fxEb4HO6o8M +i8tLFdq u5o6GFnzcU87OyXzAszflICngHG7KebUkniC+2RN8beH2j2ETrpMMOBMaInNSfzsh+X8GoccurjVwOfyqTPmce95GiwqQlUwwQS0tbFbT0iWz6Cl8D/qO6E4JA+YZuIp9UxiwGoVW8d80YJdkw/Cq745YpgZF837fc0G4T2ZegYq5RFCAO3fnr4utYiaM0wKD0d+EOUNbILt89pmY7KThyFII6pmSQSv11el8TRC8Cq8OACEsXlIZv1uZeptM1GAOGydSxen2ahlyCePxTe3RgTMQeC73yzrAtwYrUnra8Z/kBvOEo3jsCdbVIwRQn/vUeW15Qk3KnV6V0JVLpsGs2g5q4Ju2Rapb45vfkuAgebM/9Xx2WUyPO7uIrdaRpzZzA2sH2njzQNhXyudbuHMcGvIDBBn5n8fg5QIarvkVQOzM8kMvc1yzHIKe6bReqwD2Q1OJpyUS8V2dLxlC7VQ4yr8qTsSJd+N5Ckv6Rgg3SMNTTpv7tiz16FHibyq4WAMZIhrYvn0axbaOSsR2DjY8pBJ81pF41HtyTpU20GwsU3se4cG60RvdH22zXQ== 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/s390/mm/gmap.c | 230 ++++++++++++++++++++++++-------------------- 1 file changed, 128 insertions(+), 102 deletions(-) diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index a9e8b1805894..e833a7e81fbd 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -34,7 +34,7 @@ static struct gmap *gmap_alloc(unsigned long limit) { struct gmap *gmap; - struct page *page; + struct ptdesc *ptdesc; unsigned long *table; unsigned long etype, atype; @@ -67,12 +67,12 @@ static struct gmap *gmap_alloc(unsigned long limit) spin_lock_init(&gmap->guest_table_lock); spin_lock_init(&gmap->shadow_lock); refcount_set(&gmap->ref_count, 1); - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) goto out_free; - page->_pt_s390_gaddr = 0; - list_add(&page->lru, &gmap->crst_list); - table = page_to_virt(page); + ptdesc->_pt_s390_gaddr = 0; + list_add(&ptdesc->pt_list, &gmap->crst_list); + table = ptdesc_to_virt(ptdesc); crst_table_init(table, etype); gmap->table = table; gmap->asce = atype | _ASCE_TABLE_LENGTH | @@ -181,25 +181,25 @@ static void gmap_rmap_radix_tree_free(struct radix_tree_root *root) */ static void gmap_free(struct gmap *gmap) { - struct page *page, *next; + struct ptdesc *ptdesc, *next; /* Flush tlb of all gmaps (if not already done for shadows) */ if (!(gmap_is_shadow(gmap) && gmap->removed)) gmap_flush_tlb(gmap); /* Free all segment & region tables. */ - list_for_each_entry_safe(page, next, &gmap->crst_list, lru) { - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + list_for_each_entry_safe(ptdesc, next, &gmap->crst_list, pt_list) { + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } gmap_radix_tree_free(&gmap->guest_to_host); gmap_radix_tree_free(&gmap->host_to_guest); /* Free additional data for a shadow gmap */ if (gmap_is_shadow(gmap)) { - /* Free all page tables. */ - list_for_each_entry_safe(page, next, &gmap->pt_list, lru) { - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + /* Free all ptdesc tables. */ + list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list) { + ptdesc->_pt_s390_gaddr = 0; + page_table_free_pgste(ptdesc_page(ptdesc)); } gmap_rmap_radix_tree_free(&gmap->host_to_rmap); /* Release reference to the parent */ @@ -308,27 +308,27 @@ EXPORT_SYMBOL_GPL(gmap_get_enabled); static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, unsigned long init, unsigned long gaddr) { - struct page *page; + struct ptdesc *ptdesc; unsigned long *new; /* since we dont free the gmap table until gmap_free we can unlock */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - new = page_to_virt(page); + new = ptdesc_to_virt(ptdesc); crst_table_init(new, init); spin_lock(&gmap->guest_table_lock); if (*table & _REGION_ENTRY_INVALID) { - list_add(&page->lru, &gmap->crst_list); + list_add(&ptdesc->pt_list, &gmap->crst_list); *table = __pa(new) | _REGION_ENTRY_LENGTH | (*table & _REGION_ENTRY_TYPE_MASK); - page->_pt_s390_gaddr = gaddr; - page = NULL; + ptdesc->_pt_s390_gaddr = gaddr; + ptdesc = NULL; } spin_unlock(&gmap->guest_table_lock); - if (page) { - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + if (ptdesc) { + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } return 0; } @@ -341,15 +341,15 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, */ static unsigned long __gmap_segment_gaddr(unsigned long *entry) { - struct page *page; + struct ptdesc *ptdesc; unsigned long offset, mask; offset = (unsigned long) entry / sizeof(unsigned long); offset = (offset & (PTRS_PER_PMD - 1)) * PMD_SIZE; mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1); - page = virt_to_page((void *)((unsigned long) entry & mask)); + ptdesc = virt_to_ptdesc((void *)((unsigned long) entry & mask)); - return page->_pt_s390_gaddr + offset; + return ptdesc->_pt_s390_gaddr + offset; } /** @@ -1345,6 +1345,7 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) unsigned long *ste; phys_addr_t sto, pgt; struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); ste = gmap_table_walk(sg, raddr, 1); /* get segment pointer */ @@ -1358,9 +1359,11 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) __gmap_unshadow_pgt(sg, raddr, __va(pgt)); /* Free page table */ page = phys_to_page(pgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + page_table_free_pgste(ptdesc_page(ptdesc)); } /** @@ -1374,9 +1377,10 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) static void __gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr, unsigned long *sgt) { - struct page *page; phys_addr_t pgt; int i; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); for (i = 0; i < _CRST_ENTRIES; i++, raddr += _SEGMENT_SIZE) { @@ -1387,9 +1391,11 @@ static void __gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr, __gmap_unshadow_pgt(sg, raddr, __va(pgt)); /* Free page table */ page = phys_to_page(pgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + page_table_free_pgste(ptdesc_page(ptdesc)); } } @@ -1405,6 +1411,7 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) unsigned long r3o, *r3e; phys_addr_t sgt; struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); r3e = gmap_table_walk(sg, raddr, 2); /* get region-3 pointer */ @@ -1418,9 +1425,11 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) __gmap_unshadow_sgt(sg, raddr, __va(sgt)); /* Free segment table */ page = phys_to_page(sgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } /** @@ -1434,9 +1443,10 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) static void __gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr, unsigned long *r3t) { - struct page *page; phys_addr_t sgt; int i; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); for (i = 0; i < _CRST_ENTRIES; i++, raddr += _REGION3_SIZE) { @@ -1447,9 +1457,11 @@ static void __gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr, __gmap_unshadow_sgt(sg, raddr, __va(sgt)); /* Free segment table */ page = phys_to_page(sgt); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } } @@ -1465,6 +1477,7 @@ static void gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr) unsigned long r2o, *r2e; phys_addr_t r3t; struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); r2e = gmap_table_walk(sg, raddr, 3); /* get region-2 pointer */ @@ -1478,9 +1491,11 @@ static void gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr) __gmap_unshadow_r3t(sg, raddr, __va(r3t)); /* Free region 3 table */ page = phys_to_page(r3t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } /** @@ -1495,8 +1510,9 @@ static void __gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr, unsigned long *r2t) { phys_addr_t r3t; - struct page *page; int i; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); for (i = 0; i < _CRST_ENTRIES; i++, raddr += _REGION2_SIZE) { @@ -1507,9 +1523,11 @@ static void __gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr, __gmap_unshadow_r3t(sg, raddr, __va(r3t)); /* Free region 3 table */ page = phys_to_page(r3t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } } @@ -1525,6 +1543,7 @@ static void gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr) unsigned long r1o, *r1e; struct page *page; phys_addr_t r2t; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); r1e = gmap_table_walk(sg, raddr, 4); /* get region-1 pointer */ @@ -1538,9 +1557,11 @@ static void gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr) __gmap_unshadow_r2t(sg, raddr, __va(r2t)); /* Free region 2 table */ page = phys_to_page(r2t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } /** @@ -1558,6 +1579,7 @@ static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, struct page *page; phys_addr_t r2t; int i; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); asce = __pa(r1t) | _ASCE_TYPE_REGION1; @@ -1571,9 +1593,11 @@ static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, r1t[i] = _REGION1_ENTRY_EMPTY; /* Free region 2 table */ page = phys_to_page(r2t); - list_del(&page->lru); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + + ptdesc = page_ptdesc(page); + list_del(&ptdesc->pt_list); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); } } @@ -1770,18 +1794,18 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, unsigned long raddr, origin, offset, len; unsigned long *table; phys_addr_t s_r2t; - struct page *page; + struct ptdesc *ptdesc; int rc; BUG_ON(!gmap_is_shadow(sg)); /* Allocate a shadow region second table */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = r2t & _REGION_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = r2t & _REGION_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_r2t = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_r2t = page_to_phys(ptdesc_page(ptdesc)); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 4); /* get region-1 pointer */ @@ -1802,7 +1826,7 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, _REGION_ENTRY_TYPE_R1 | _REGION_ENTRY_INVALID; if (sg->edat_level >= 1) *table |= (r2t & _REGION_ENTRY_PROTECT); - list_add(&page->lru, &sg->crst_list); + list_add(&ptdesc->pt_list, &sg->crst_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_REGION_ENTRY_INVALID; @@ -1830,8 +1854,8 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); return rc; } EXPORT_SYMBOL_GPL(gmap_shadow_r2t); @@ -1855,18 +1879,18 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, unsigned long raddr, origin, offset, len; unsigned long *table; phys_addr_t s_r3t; - struct page *page; + struct ptdesc *ptdesc; int rc; BUG_ON(!gmap_is_shadow(sg)); /* Allocate a shadow region second table */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = r3t & _REGION_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = r3t & _REGION_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_r3t = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_r3t = page_to_phys(ptdesc_page(ptdesc)); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 3); /* get region-2 pointer */ @@ -1887,7 +1911,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, _REGION_ENTRY_TYPE_R2 | _REGION_ENTRY_INVALID; if (sg->edat_level >= 1) *table |= (r3t & _REGION_ENTRY_PROTECT); - list_add(&page->lru, &sg->crst_list); + list_add(&ptdesc->pt_list, &sg->crst_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_REGION_ENTRY_INVALID; @@ -1915,8 +1939,8 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); return rc; } EXPORT_SYMBOL_GPL(gmap_shadow_r3t); @@ -1940,18 +1964,18 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, unsigned long raddr, origin, offset, len; unsigned long *table; phys_addr_t s_sgt; - struct page *page; + struct ptdesc *ptdesc; int rc; BUG_ON(!gmap_is_shadow(sg) || (sgt & _REGION3_ENTRY_LARGE)); /* Allocate a shadow segment table */ - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = sgt & _REGION_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = sgt & _REGION_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_sgt = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_sgt = page_to_phys(ptdesc_page(ptdesc)); /* Install shadow region second table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 2); /* get region-3 pointer */ @@ -1972,7 +1996,7 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, _REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INVALID; if (sg->edat_level >= 1) *table |= sgt & _REGION_ENTRY_PROTECT; - list_add(&page->lru, &sg->crst_list); + list_add(&ptdesc->pt_list, &sg->crst_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_REGION_ENTRY_INVALID; @@ -2000,8 +2024,8 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - __free_pages(page, CRST_ALLOC_ORDER); + ptdesc->_pt_s390_gaddr = 0; + ptdesc_free(ptdesc); return rc; } EXPORT_SYMBOL_GPL(gmap_shadow_sgt); @@ -2024,8 +2048,9 @@ int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr, int *fake) { unsigned long *table; - struct page *page; int rc; + struct page *page; + struct ptdesc *ptdesc; BUG_ON(!gmap_is_shadow(sg)); spin_lock(&sg->guest_table_lock); @@ -2033,9 +2058,10 @@ int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr, if (table && !(*table & _SEGMENT_ENTRY_INVALID)) { /* Shadow page tables are full pages (pte+pgste) */ page = pfn_to_page(*table >> PAGE_SHIFT); - *pgt = page->_pt_s390_gaddr & ~GMAP_SHADOW_FAKE_TABLE; + ptdesc = page_ptdesc(page); + *pgt = ptdesc->_pt_s390_gaddr & ~GMAP_SHADOW_FAKE_TABLE; *dat_protection = !!(*table & _SEGMENT_ENTRY_PROTECT); - *fake = !!(page->_pt_s390_gaddr & GMAP_SHADOW_FAKE_TABLE); + *fake = !!(ptdesc->_pt_s390_gaddr & GMAP_SHADOW_FAKE_TABLE); rc = 0; } else { rc = -EAGAIN; @@ -2064,19 +2090,19 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, { unsigned long raddr, origin; unsigned long *table; - struct page *page; + struct ptdesc *ptdesc; phys_addr_t s_pgt; int rc; BUG_ON(!gmap_is_shadow(sg) || (pgt & _SEGMENT_ENTRY_LARGE)); /* Allocate a shadow page table */ - page = page_table_alloc_pgste(sg->mm); - if (!page) + ptdesc = page_ptdesc(page_table_alloc_pgste(sg->mm)); + if (!ptdesc) return -ENOMEM; - page->_pt_s390_gaddr = pgt & _SEGMENT_ENTRY_ORIGIN; + ptdesc->_pt_s390_gaddr = pgt & _SEGMENT_ENTRY_ORIGIN; if (fake) - page->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; - s_pgt = page_to_phys(page); + ptdesc->_pt_s390_gaddr |= GMAP_SHADOW_FAKE_TABLE; + s_pgt = page_to_phys(ptdesc_page(ptdesc)); /* Install shadow page table */ spin_lock(&sg->guest_table_lock); table = gmap_table_walk(sg, saddr, 1); /* get segment pointer */ @@ -2094,7 +2120,7 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, /* mark as invalid as long as the parent table is not protected */ *table = (unsigned long) s_pgt | _SEGMENT_ENTRY | (pgt & _SEGMENT_ENTRY_PROTECT) | _SEGMENT_ENTRY_INVALID; - list_add(&page->lru, &sg->pt_list); + list_add(&ptdesc->pt_list, &sg->pt_list); if (fake) { /* nothing to protect for fake tables */ *table &= ~_SEGMENT_ENTRY_INVALID; @@ -2120,8 +2146,8 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, return rc; out_free: spin_unlock(&sg->guest_table_lock); - page->_pt_s390_gaddr = 0; - page_table_free_pgste(page); + ptdesc->_pt_s390_gaddr = 0; + page_table_free_pgste(ptdesc_page(ptdesc)); return rc; } @@ -2814,11 +2840,11 @@ EXPORT_SYMBOL_GPL(__s390_uv_destroy_range); */ void s390_unlist_old_asce(struct gmap *gmap) { - struct page *old; + struct ptdesc *old; - old = virt_to_page(gmap->table); + old = virt_to_ptdesc(gmap->table); spin_lock(&gmap->guest_table_lock); - list_del(&old->lru); + list_del(&old->pt_list); /* * Sometimes the topmost page might need to be "removed" multiple * times, for example if the VM is rebooted into secure mode several @@ -2833,7 +2859,7 @@ void s390_unlist_old_asce(struct gmap *gmap) * pointers, so list_del can work (and do nothing) without * dereferencing stale or invalid pointers. */ - INIT_LIST_HEAD(&old->lru); + INIT_LIST_HEAD(&old->pt_list); spin_unlock(&gmap->guest_table_lock); } EXPORT_SYMBOL_GPL(s390_unlist_old_asce); @@ -2851,15 +2877,15 @@ EXPORT_SYMBOL_GPL(s390_unlist_old_asce); int s390_replace_asce(struct gmap *gmap) { unsigned long asce; - struct page *page; + struct ptdesc *ptdesc; void *table; s390_unlist_old_asce(gmap); - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!ptdesc) return -ENOMEM; - table = page_to_virt(page); + table = ptdesc_to_virt(ptdesc); memcpy(table, gmap->table, 1UL << (CRST_ALLOC_ORDER + PAGE_SHIFT)); /* @@ -2868,7 +2894,7 @@ int s390_replace_asce(struct gmap *gmap) * it will be freed when the VM is torn down. */ spin_lock(&gmap->guest_table_lock); - list_add(&page->lru, &gmap->crst_list); + list_add(&ptdesc->pt_list, &gmap->crst_list); spin_unlock(&gmap->guest_table_lock); /* Set new table origin while preserving existing ASCE control bits */ From patchwork Mon May 1 19:28: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: 13227936 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 5A5EDC7EE26 for ; Mon, 1 May 2023 19:29:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CBC0280010; Mon, 1 May 2023 15:29:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 67A2E28000C; Mon, 1 May 2023 15:29:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F3D4280010; Mon, 1 May 2023 15:29:01 -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 397A928000C for ; Mon, 1 May 2023 15:29:01 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0500780867 for ; Mon, 1 May 2023 19:29:00 +0000 (UTC) X-FDA: 80742674082.29.0FC6F65 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf09.hostedemail.com (Postfix) with ESMTP id 374D2140012 for ; Mon, 1 May 2023 19:28:59 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ZGC4cCyw; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969339; 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=DfBzvZT8j9y8kX+XY5vccXNkzfj+khuHcHL5hyCh86c=; b=lbzrD22mivApteTtuiRAg7nqe9yHkmx01weqs7J6ehjHG6gFiWaakhbN7vNsHdHCP0sjuV dogGgdXgfwIzlGUATS7ggKlAqm/rlW/ilFs+owk2/ObIBVyV0GBTYqmCFCV82+IOz6QIXd mDxk+pksX3DsHxIyOCD9xe6KFeoCp/Q= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ZGC4cCyw; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969339; a=rsa-sha256; cv=none; b=xm3ZGdi+2fNg9pQYb3fp/9OzS/0EFsfBwOGQkT3wZYUYb6dOHAAzUDCfmA4faSewkXE9bq 0fOI+TwdJqTi/jV4iBC/MOwSEt51YU54EvTpzGLZ0jEeu4cukiAPkUdqAZMX62rnATtICf UACjLMY4Gs/zeg1qbC2XsVrdnoTZx0Q= Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1aad5245632so16555465ad.3 for ; Mon, 01 May 2023 12:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969338; x=1685561338; 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=DfBzvZT8j9y8kX+XY5vccXNkzfj+khuHcHL5hyCh86c=; b=ZGC4cCywpFatHbTovw1WlKjZ1/JpIzLm49ZnB+qALtN8+uBzAmOEyQhoqTiZAL9Lov 1//5Ifkg8A25NAtuG/zaT6BZSC/OxKKSrYkP8TeZX+kUNfD8Xntdlqk4M/TUk6HLakv1 nCrmIlVJ/lAy/lFljijZzj8/LpWBCQqPALZ1y/GGQ8i7Rpm01GpW0tHuORtTXujkRAt2 duA4cTRp6tLOiXSxedEuorGvbfQ8keU9JobrzJ6OWtv8cF/fNSyFKrwRMOsU31de5FQU 2Q0V2AuDWJPTZbnRyTcSGfBvM15PDA9NYPwDO/VpLGYUHfCtfkvJIisembrIccrMdBVE w3TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969338; x=1685561338; 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=DfBzvZT8j9y8kX+XY5vccXNkzfj+khuHcHL5hyCh86c=; b=WVd2FwcIANS3I36nHtaNitIPD5ShKIvpJS0cLwXNpbTquuxux/1PyvDMejzhrh3rcE uV5jxhVsooynTsZoiUyIRyZPK3GYdi/H43KVmxIGOZHXLJJ0L88Z0ssoXfJqO6AKkyr+ QYzJie7X56TZNW/+8pNxC6Imil4Ml2NfjKAdMfzMs5gCOOi5iCDS7jV7xG/X/o8FVC8d ZsjsSQayFfvRO5SGtlmK4yXKpJ2mpRi9bG+AuA2Kz9mWwpYXHUt7B93/eRTlyaYz1um0 F9GBg669sGiJLdUYp9j9mFfAMghLEKsU/5vTTTD8cFpl1ZZSKWVDIuz5E1nsIA2lYlpe xLIQ== X-Gm-Message-State: AC+VfDxTFb2pwU4VblzstfVEpSw28E76jVp42sr3Jy2v0zFKJ2xJ9yZz 1DtZthUdl0raDBI9D5mAmJA= X-Google-Smtp-Source: ACHHUZ6bNcHkqBfUbTar64QETUpHtB7bbYe1QXkuNIjeJUzlYTez90IJdWZAdk9hI9pBXzKuPuEYjw== X-Received: by 2002:a17:902:ea09:b0:1a9:79e7:2ba with SMTP id s9-20020a170902ea0900b001a979e702bamr18843060plg.23.1682969338010; Mon, 01 May 2023 12:28:58 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:57 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" , David Hildenbrand , Claudio Imbrenda Subject: [PATCH v2 17/34] s390: Convert various pgalloc functions to use ptdescs Date: Mon, 1 May 2023 12:28:12 -0700 Message-Id: <20230501192829.17086-18-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 374D2140012 X-Stat-Signature: brr4jwut16ce6pnegi6udy3kuf3ucyuq X-Rspam-User: X-HE-Tag: 1682969339-741565 X-HE-Meta: U2FsdGVkX1+r1KD0ZJAy6aWtO+QoyNJtso3OUFJ0V+0/e1o7DyQh7bdY0X7U6xfkowY7Z2H7TJxDc92/Ah6Bwh6oCSXE5CQqMaIYVy9PlyPuVwBfC737QeWe5IqFuo4xuz9uFzk7dAXYi+kRIc4eT+IcnMbErXFB5TEGKkv1PguAPrzMtgEeplFXnTRWnV4OKVcYbAGcs/GlH/aMrsc262u5TcdYN8Qahg2tmbwTf8g0saJ93dxdLgkZm+06+2OBKnGlYyFGonOR/kEtGLiIkhBTlN56BI91Salzw+2jut03Llwh+KWibK3Ecm6oGN+Qxh/6TCUftjnV7BgIbDMk2M3cmGAhilw3IH5rMCHagQIF7hwmTR+sDNNt6TecjTocTXHoTKVRO3KSVmY70YwtsH0QnZs8oB9wnRNyv5fFqz6zGjnuTrts2VWCM+4SCsKbRNztOcSWr6uBeumIQ/EFRNoboDS0S0dhdzqMSkuf4XcGGdDp37nhjym/A65PB3YKj46ktdW0bVBdDnCcACWhln+OXqIEuuVFko/O8DOM8THOkmawTrW8oTPyQCh8GS9pHBLttQ01LqQIJiE+ud5NamGmGY/Gb5nZGnxIPcvEbse15DF268ITX8ShigKBwO1X2h2OkolsyaaBzzx2wrXeQNn+ZiFy6wtoAaVc9s5prQsC9lfVGdIjwgD48jJqNlRT9oWNzllEUX42HNH+eMuRoteFRN9dVocn06UFuJQHJp2ZJepFFqOvdjvw/6SSrOU9FgNQyxaiDOWSYlc+3OFur3t7a4ARxkwYHjSOLNXbekIngQLZy9Zh//8Z1i7eYdkBUiyBy57mlewR1TJtMW7dMoTUCxbkZsoeVDpxQuW/bUGgdOX8hcZMV4Vb4tW1IcbYQ7Cl/225zor8W+QQzG7YoTbLeJj/D83chNWgEOSAzry7jg6h4TG/2ZEhcSjr8kYoSxOjG3g1aq1KOaeLDFp npRJiM+w X9OujyrOEJ10jNIqEZhjmHYl4H43gK+O/lQom+AhVQ5ZcYURdlDzRqxMsjgonZqUyT2iqM8u0xMJP5cjfajUaojbhzIKPSjt9EO6ZU4SIweC8pie7PHPhrgRvcorZBrwiiaVxaelxLEq7lBSawv1C43jwnTUGV6HzXC5c+SVzAY8X6t/UCubD+cLD3dVlKY2nrQCJTZTU5UKWTOSTLOkMHeI3w8DNJNEAM53iWzse4Rv14CUkudsfEcT1XXlEXEWMQ8TYbl3OKEcySLgACxd8VwTKd4fq7L8zJzMT6bKrOycMnKdgu+D7VKmMN57xn2IFGxjo3s5jnhDlnOR/g+rlxyyrGzNutDu4z/shKMnNJVQKFLmxwoEKBKLkypiyYzmR6+DwkIWqyzns94nL9EyX+fHhy2zCAZaMPKQIE4x/hb344a6Ghw4rOYF8xmAcN6SAfAkMDThStcVF7YkjCKQGygFnmcxsv+yi46ls4bfswiDHMhPcTfCXXMaW2pAzDfO0xxa4tbGUXRz3/hMAN0zYVCZlBA== 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. 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 | 108 ++++++++++++++++---------------- 3 files changed, 59 insertions(+), 57 deletions(-) diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h index 17eb618f1348..9841481560ae 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 (!ptdesc_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)); + ptdesc_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..1388c819b467 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)); + ptdesc_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 6b99932abc66..e740b4c76665 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 = ptdesc_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); + ptdesc_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 = ptdesc_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); + ptdesc_free(page_ptdesc(page)); } #endif /* CONFIG_PGSTE */ @@ -230,7 +230,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 */ @@ -238,9 +238,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->pt_frag_refcount); + ptdesc = list_first_entry(&mm->context.pgtable_list, + struct ptdesc, pt_list); + mask = atomic_read(&ptdesc->pt_frag_refcount); /* * The pending removal bits must also be checked. * Failure to do so might lead to an impossible @@ -253,13 +253,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->pt_frag_refcount, + atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x01U << bit); - list_del(&page->lru); + list_del(&ptdesc->pt_list); } } spin_unlock_bh(&mm->context.lock); @@ -267,27 +267,27 @@ unsigned long *page_table_alloc(struct mm_struct *mm) return table; } /* Allocate a fresh page */ - page = alloc_page(GFP_KERNEL); - if (!page) + ptdesc = ptdesc_alloc(GFP_KERNEL, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!ptdesc_pte_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - arch_set_page_dat(page, 0); + arch_set_page_dat(ptdesc_page(ptdesc), 0); /* Initialize page table */ - table = (unsigned long *) page_to_virt(page); + table = (unsigned long *) ptdesc_to_virt(ptdesc); if (mm_alloc_pgste(mm)) { /* Return 4K page table with PGSTEs */ - atomic_xor_bits(&page->pt_frag_refcount, 0x03U); + atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x03U); 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->pt_frag_refcount, 0x01U); + atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x01U); 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; @@ -309,9 +309,8 @@ static void page_table_release_check(struct page *page, void *table, void page_table_free(struct mm_struct *mm, unsigned long *table) { unsigned int mask, bit, half; - struct page *page; + struct ptdesc *ptdesc = virt_to_ptdesc(table); - page = virt_to_page(table); if (!mm_alloc_pgste(mm)) { /* Free 2K page table fragment of a 4K page */ bit = ((unsigned long) table & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); @@ -321,39 +320,38 @@ 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->pt_frag_refcount, 0x11U << bit); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x11U << bit); if (mask & 0x03U) - list_add(&page->lru, &mm->context.pgtable_list); + list_add(&ptdesc->pt_list, &mm->context.pgtable_list); else - list_del(&page->lru); + list_del(&ptdesc->pt_list); spin_unlock_bh(&mm->context.lock); - mask = atomic_xor_bits(&page->pt_frag_refcount, 0x10U << bit); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x10U << bit); if (mask != 0x00U) return; half = 0x01U << bit; } else { half = 0x03U; - mask = atomic_xor_bits(&page->pt_frag_refcount, 0x03U); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x03U); } - page_table_release_check(page, table, half, mask); - pgtable_pte_page_dtor(page); - __free_page(page); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table, unsigned long vmaddr) { struct mm_struct *mm; - struct page *page; unsigned int bit, mask; + struct ptdesc *ptdesc = virt_to_ptdesc(table); mm = tlb->mm; - page = virt_to_page(table); if (mm_alloc_pgste(mm)) { gmap_unlink(mm, table, vmaddr); table = (unsigned long *) ((unsigned long)table | 0x03U); - tlb_remove_table(tlb, table); + tlb_remove_ptdesc(tlb, table); return; } bit = ((unsigned long) table & ~PAGE_MASK) / (PTRS_PER_PTE*sizeof(pte_t)); @@ -363,11 +361,11 @@ 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->pt_frag_refcount, 0x11U << bit); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x11U << bit); if (mask & 0x03U) - list_add_tail(&page->lru, &mm->context.pgtable_list); + list_add_tail(&ptdesc->pt_list, &mm->context.pgtable_list); else - list_del(&page->lru); + list_del(&ptdesc->pt_list); spin_unlock_bh(&mm->context.lock); table = (unsigned long *) ((unsigned long) table | (0x01U << bit)); tlb_remove_table(tlb, table); @@ -377,7 +375,7 @@ void __tlb_remove_table(void *_table) { unsigned int mask = (unsigned long) _table & 0x03U, half = mask; void *table = (void *)((unsigned long) _table ^ mask); - struct page *page = virt_to_page(table); + struct ptdesc *ptdesc = virt_to_ptdesc(table); switch (half) { case 0x00U: /* pmd, pud, or p4d */ @@ -385,18 +383,18 @@ void __tlb_remove_table(void *_table) return; case 0x01U: /* lower 2K of a 4K page table */ case 0x02U: /* higher 2K of a 4K page table */ - mask = atomic_xor_bits(&page->pt_frag_refcount, mask << 4); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, mask << 4); if (mask != 0x00U) return; break; case 0x03U: /* 4K page table with pgstes */ - mask = atomic_xor_bits(&page->pt_frag_refcount, 0x03U); + mask = atomic_xor_bits(&ptdesc->pt_frag_refcount, 0x03U); break; } - page_table_release_check(page, table, half, mask); - pgtable_pte_page_dtor(page); - __free_page(page); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } /* @@ -424,16 +422,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 = ptdesc_alloc(GFP_KERNEL, 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); + ptdesc_free(virt_to_ptdesc(table)); } #define BASE_ADDR_END_FUNC(NAME, SIZE) \ From patchwork Mon May 1 19:28:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227937 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 590BCC7EE24 for ; Mon, 1 May 2023 19:29:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EBCC0280011; Mon, 1 May 2023 15:29:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E43D528000C; Mon, 1 May 2023 15:29:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1EF9280011; Mon, 1 May 2023 15:29:02 -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 A846728000C for ; Mon, 1 May 2023 15:29:02 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 885811A0580 for ; Mon, 1 May 2023 19:29:02 +0000 (UTC) X-FDA: 80742674124.17.8A575BB Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf28.hostedemail.com (Postfix) with ESMTP id AE7C4C001A for ; Mon, 1 May 2023 19:29:00 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YynIc3MW; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969340; 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=mrqntkjJd8BO8YfASMnosk0HIl+t/0EXXW8sSx0dJVg=; b=M989wYYpqjQkM6M70gTDsWGHaHzXReFSjfHAAzANT26c/0EZmTeWCzrlp732sFbSi6yHxd IyyESpSi6NYuqrKSRPPgMznMkmEi7zfy+/vVRvwOCToEv9Iv3wbn0GehD9Nzs64aeoGePZ +Zp/RdQBtvBSvNEORdWaqD8NeGdK+uY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YynIc3MW; spf=pass (imf28.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.180 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=1682969340; a=rsa-sha256; cv=none; b=rp9HclkxfBfJBOyK26AqHH0iJNbTIWm8JjN0WPSiNiy2qCVlhHXA4MJYCYjIiz3G4gCEu6 j8QaDAx9tyE0Ir6cl2gXkXTtLF1dlCAVyyq3XTpfVyGbRj0+d/w/Dd3p0dy4V+AlD+5zQX dzjk2WUjEZNCiYlNwnbIgw0VBPdVr1k= Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1a6715ee82fso29080395ad.1 for ; Mon, 01 May 2023 12:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969339; x=1685561339; 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=mrqntkjJd8BO8YfASMnosk0HIl+t/0EXXW8sSx0dJVg=; b=YynIc3MWOn+7eKGjmZARCn/IjCANfe8gTHKhI/1ubKTs4ZbiubHG1P9aimD9KzNrIR eunJCIzqiXfZGl0CCMrWEsO+nwpbu9UTA+2coBncf0PpX1ohouYsG2DEdDJZPuTXi/ir yR5oJPT4K2awb6eBfuzacZRfwPXKDUNKWynDv8oNvVCBXhLYj3JhwMiPBRO+Fg6hjdSs FM9xgZDHU6Sc+urW7voaFKEt/7m6LjDuxZZp6qL4zZI9dwEcGtT8oaSDqFIY7TNV4Oop NDnPsASY2UskW6usELO5k/OqVJv807YApzHQHt4bSD2BLXySmWIPAbRFeQIxlm3YwdkY qcpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969339; x=1685561339; 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=mrqntkjJd8BO8YfASMnosk0HIl+t/0EXXW8sSx0dJVg=; b=Cq31Cs/2rOqssImMRi4nJIBkfgmD1kyMfpPk+NAi3kIs5S4hEAfsYmwnKDDcjKenps mDm21PJa+rQOr6T1gEr7Euh1F/B2+dWbwMesqNpNkHy6zGcSg+BN3pbv0H1VcNdoJiln 6w3uYsv0HLt4REwGta8R2SvXnDYBo3JRSv+TgGVbyL0dbGfr4PaM7Igqn9jnMX0SG83/ YDF4bmgNkzD4pN9mlBEqgD+88f4XrW2V60YuU9HmOwK7hZ+9LvMgdzvrZBTyYxtEfY0B dCIg+e5hIqUuOoYQtCfraVhmkkoEWo7N4LrfQ7vGkPnxFBx8bfyO0BJr44vccBP2F+97 aNgQ== X-Gm-Message-State: AC+VfDxKkKBoD4USKP+L1ZGa/nNZNjmEI18M96jRFJax0e4VDgvL8zW5 QnM9KalJbokPtldmI7hhmq0= X-Google-Smtp-Source: ACHHUZ77ujqEA4Fn1OLOb7e5ecCGVNnJtAoTp2B3mAkadiAfSXyelwvqP5mlNEo41vojA+MW1rmqbg== X-Received: by 2002:a17:902:ce8e:b0:1aa:efad:f2d4 with SMTP id f14-20020a170902ce8e00b001aaefadf2d4mr5633464plg.63.1682969339499; Mon, 01 May 2023 12:28:59 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:59 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 18/34] mm: Remove page table members from struct page Date: Mon, 1 May 2023 12:28:13 -0700 Message-Id: <20230501192829.17086-19-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: AE7C4C001A X-Stat-Signature: 7wtrgbeu8imnxtzsmyb98ixgd8tyu1tx X-HE-Tag: 1682969340-120939 X-HE-Meta: U2FsdGVkX18aylQu7GCiwKPcb7K13KtSohxIcKwJ2KvWaZiEm5OEZ5d4ibHSFx8W3np0cgC2qiJFim6pm5tAoI0tMq43kTUh6D92YLq1V1KmcYsDD6YeXFHxDF+gkuEI0TmOG53z/STOvkc6BNj7w/S77SOTWeBdiiaIW/5jvDXDIriB58dlWR6Vwfyvec5rxznfDEVVWu/83U7Rc6Ad+oIg4Evde/k+Ug8tMFBLO8bs6D/gTbVqEZHwWRSWbWqDb29WfwSKeB9EXseDSYImMVBFZuXsNSMMPzzDzRJh2hjUJM6FBMMd0vU7oaohlhp2mp+2U9z8J5gul6oA2L1AvBQsXxSTlrTGVtvl8wMEf4E5DnGPxMWlVu+zv1TczjEHcpX2zHJ5C0H/8fMc9Gqjmr35B4BL4S0ac/PJ9ibpMbnBQhazSmkUc87be+sFghElPLh9Od0aKCRW0YqoJW1pDJLozGMSXCzC8sFa6OnxXIsvdjQNjsvqdDyABDy3chjUi/qo/g+TwsHflfpZ+xtmS539QJK4B8p6l8S80db4JF6v8hyo2ux6cuJiPCwfpqmxYqGC/lNsHWrVhlVqaK0YfVlq/2JUHuOtaspY/CiMfjHkL/jTE21hkNtwX/yBrOm9l6QAt9qId6EWO3tBoaRu+35RjUYNmM5FCzhBAqVdOSXuDjHizEAG6ucedXHepxWr0EuhPDhAuhyaXOcwXWeHCJ7PdBJeU+hW3HAYhVwJWctvecIq9pSzz3Q6HabAcaarODA2su6UAJiGmh+sOrmN/6IhPVeYZR5novwJV7oA1Vmc/zBREXTXA/1RIJj+v1xLPiLgJnJvFEz2f8TbcwDds6kmkeTUoiqvXfXwH1EbeSJ3KB5C4MnsNNUpmNKH+0LvAXyQl+3BFN+fZmLvJweoBHv8lk3yLu3RuukZ3hQKne7S9h1jkuJTbghnleIMvkWDeynj4Wlh3EcH8rj3RWz OLxCgfKK XkNP/9Rlmv2GYYLIdr0j5kdZUOpHXupbUM668YMCpLHwZ3FmKbHRkDkhUw2IacghF7Y3Dkl8MJQxP00C7TVtE7FJkRj3cNHVsIl3SdrML/5H1h0FqP6ddblUJKTXHqALieBVjEg9ziyWqVUMXCF2k045SRfgZmjE9AgKxeiWWpysAwqU8fTwwFmw1tN/NR+Cr0cGB3kR1QsLtAzLZWq0Os+CR9tS2ANJ2HQkLC2JDR4cHmLjdRsi3oG5CazdfgoC5wbMS8omdVxaOVtpEp8HR+GaEXOby5y4CZThvfw+KeEsbUCBPsTeZ+8dnQVRJ9YsSJfJjh2bGzKUSqyaFqqcoHmPIw1ClRtAzKJUrcoAAFu2dt/MclyZ8ic4CY8CHfqUjkrWSL15I1J2DJoG+DQDvAxa/TCxjTmAVvFYPWqnt9pyK6aChR9MFKQY1p07ZcFipHd3J2G17coJISGNvfn+v1YvyPT40kg9x4BKaiQRWusIClWVzQlCw6v8KevN94ujn3sI/MrzT+tKEns8c0tqG8z+FFQ== 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) --- include/linux/mm_types.h | 14 -------------- include/linux/pgtable.h | 3 --- 2 files changed, 17 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 6161fe1ae5b8..31ffa1be21d0 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -141,20 +141,6 @@ struct page { struct { /* Tail pages of compound page */ unsigned long compound_head; /* Bit zero is set */ }; - struct { /* Page table pages */ - unsigned long _pt_pad_1; /* compound_head */ - pgtable_t pmd_huge_pte; /* protected by page->ptl */ - unsigned long _pt_s390_gaddr; /* mapping */ - union { - struct mm_struct *pt_mm; /* x86 pgds only */ - atomic_t pt_frag_refcount; /* powerpc */ - }; -#if ALLOC_SPLIT_PTLOCKS - spinlock_t *ptl; -#else - spinlock_t ptl; -#endif - }; struct { /* ZONE_DEVICE pages */ /** @pgmap: Points to the hosting device page map. */ struct dev_pagemap *pgmap; diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index b067ac10f3dd..90fa73a896db 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1034,10 +1034,7 @@ struct ptdesc { TABLE_MATCH(flags, __page_flags); TABLE_MATCH(compound_head, pt_list); TABLE_MATCH(compound_head, _pt_pad_1); -TABLE_MATCH(pmd_huge_pte, pmd_huge_pte); TABLE_MATCH(mapping, _pt_s390_gaddr); -TABLE_MATCH(pt_mm, pt_mm); -TABLE_MATCH(ptl, ptl); #undef TABLE_MATCH static_assert(sizeof(struct ptdesc) <= sizeof(struct page)); From patchwork Mon May 1 19:28:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227938 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 5667FC7EE30 for ; Mon, 1 May 2023 19:29:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01593280012; Mon, 1 May 2023 15:29:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F064128000C; Mon, 1 May 2023 15:29:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5879280012; Mon, 1 May 2023 15:29: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 C051728000C for ; Mon, 1 May 2023 15:29:04 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 81245807A8 for ; Mon, 1 May 2023 19:29:04 +0000 (UTC) X-FDA: 80742674208.05.C79D2CA Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf07.hostedemail.com (Postfix) with ESMTP id AA97B40008 for ; Mon, 1 May 2023 19:29:02 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=NGlfJzK3; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969342; a=rsa-sha256; cv=none; b=kG9xm74m4F2sFxLaN+K6emSgJvVpxjBIGbHPB41rdf/EkZkQ4hAj9aJMvZtLtbf8EAm1qJ NGrMSCh147XiQ9BrSSUIqA5UoGIK+KUQpZoNYA0qsSbS2w5Dxq0M2YwS2dG3dMqCrDdIaD ySjHC2bCgzM8+mw2tEm+zqXpoWy38RA= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=NGlfJzK3; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.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=1682969342; 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=dfen1Ya6fa7BCRlN1BPOcmTNp3Sy/DALCm51X/wHZX4=; b=II4X28BFmE6XyO3oZKaOTD/MAb0y4zhfFdqlTO8W9dKK4JwwTMZAxPio9SgThCb6EWgIOE a+s6ORIKFCWW5voiEmU+TZqHNPjq5UR9cBDkyqjIzdvitcugKs2p3hPTI/8QeMBe2FVg5I yPGrlGEmcZJTzitVZL5v8v9Vram+/+s= Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-52c30fa5271so467242a12.0 for ; Mon, 01 May 2023 12:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969341; x=1685561341; 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=dfen1Ya6fa7BCRlN1BPOcmTNp3Sy/DALCm51X/wHZX4=; b=NGlfJzK3SLIyrzVeCW+cy/LENuF7AIYcpLjneyCln8/dN8tsSa+TUgx6Zs0xZt09V/ AUoO/9vVboMIkkiAJKzWw3zNTkXyZHbg5i+Uv3Zqtu+rX4tuOiaEx2sdsDxoZuaBDGgr vod9dLgUvGamVrCZ2EGOCdE8ToYnRSXk/vhm78x+dP7MR2nyb1QcOC5STzovq8Qe7Hqo h0w/rTHUO6l4DW/cRdBZ54cZqeORpVG+YoPGSUP9GNzfvkM/15zFtG0hwm7rzS97mp6T 8K3nb/fOTHh3fKdVDbkoQtqh9GEw5zSK4hVf63htcA2MUZQPuMJk5JXlIyYiKdaNTnZr +1fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969341; x=1685561341; 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=dfen1Ya6fa7BCRlN1BPOcmTNp3Sy/DALCm51X/wHZX4=; b=gZOx3xHNstTM0xl2wwXbz7WdLy0JBdgwnSPR1M+O/++xI0V84S5QyzkLxFADIpXsJV 6GxPhJPjdtT85HutkCyP323B1hqTUzEcAXYix/EKmL8F1Pf7fvMXbVODP5iS1HChtg1R luhNu+KJa8KVAvvJhQMu8YSH2zChxdRYbJHlsvG9h2OI/TgyO9UawJK8cRMY2LcFL3E4 E6oi1ilsq9ZDAVfm7FqvId1calGgY27m9VfHiqCK3xpFQHlURgrHFihXVUUZgKWcr0+C ZLQtYp69d7F/hvKEvlpysQzXIYGoMfP74BTrO+O6hTQj7HBiaH2W31TBeIpsux6mw0PK Pk4Q== X-Gm-Message-State: AC+VfDzvg3QwJoqnx+AZAaUajjKPhRbwpowlA2XU6jPWXTOkbSIwcCgt rAaJa9xGaFEsAN8rMs+nvcQ= X-Google-Smtp-Source: ACHHUZ4bym3aGkcEwh3pzEy9AQ1AIJMbPocjKSt/BA7y0pQIbB80eZOWxLwavvxYdF9801tFQUA10w== X-Received: by 2002:a17:903:124b:b0:1a2:8c7e:f315 with SMTP id u11-20020a170903124b00b001a28c7ef315mr17565749plh.21.1682969341343; Mon, 01 May 2023 12:29:01 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29: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, "Vishal Moola (Oracle)" , Arnd Bergmann Subject: [PATCH v2 19/34] pgalloc: Convert various functions to use ptdescs Date: Mon, 1 May 2023 12:28:14 -0700 Message-Id: <20230501192829.17086-20-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: AA97B40008 X-Rspamd-Server: rspam01 X-Stat-Signature: 37oycm8tei3sogyuj1w7qe613pnceiif X-HE-Tag: 1682969342-180245 X-HE-Meta: U2FsdGVkX18vI8TKVDXARaNQX3DctayhvlBT5mBke9NKAV9BtvsvXGha6rjpPIkTuloxz77y663/nbjt6msC7ygbmDl+JpG99SJ/AWyjKZMXuyBExHXiaevhrVNEYklvAdFiUKbM79B0Wjd3qQyzumXCRYJZebIyFHX7+oj5IrUgcKZb7dYMoHSk9VgvIgTNLaED0Aycf9Xem7a7p7BDSpCEfL6NUijzXdbbrlfslVS7Gx9CtnH8AZzbQ9aEAu0Bmvv+p3uFYmpczOt62CSDoPwzUzPZdxV+Ig6SlbMeDeeQzoyfWR7dkLhHNMo+DQnL8Zejzn3Ku244Xkkk+wNbq+xp3zO8CU04utyjFIoT2aKjwAGW1G9BNcskH1MIIxquZesyKifFCYPn2kmM20AE2F+h7BX6dfDdan1WPBMWVNt0wbw7GEo+9Ijw7B+d4+aP0ukUcthhyQn4NP1KohnxHDfnRpGyyprBaUocmEzJyIxakZfCAGhKIpA8d3xuNsMcJ4JIhURiakecpQHDmQA1WHzywoNC+hjXRxUFRJYmDXxFd3qy85o3OBtYc3PT3OiJzsde2Wn9PLs5WzUR1uVkvK847LSgF9m3/HcS3BzNJ2Duqqxp73TqGQ5w64WBVfQ3I1gwxT26fEttQGA70/fBoxQtoaQJUJ2s7CGdOtTt0oXD+SMGDxc66oVPRzIZKoU1iaRxA0gTZUKnY5TrTx6ENcbDPLvSiowV1dUEDsHZx7q5IXmM9p9nazebZGOz3ggHIWOEDVej3QjeqL6QrjQYGlIVD8icmzb5Nf6DkyfgSAAFPrR/mh7DYG6tWLwxYUL200pwisKvz7bv7W76VxqCFTlWDZmQpKJayRprpa8etHYEMNRP77FnpgpGPWM+Oxrox9tbidnfpwrHM1RE8RYUoy1iIvCnNzO9IumftPCs6KpsMB91FOvMZqT2vMUfO7SjRx/EV35155/+OLbLXJk vO0mUsCg mDB0HHLMHe231VIjZFGm+3wx6KgkE8SEYqdeUa9VKAhFiWJwiIsbJwDjwpG1JIeRxyqOAqLd6mWZZFKV6vkvVcZ1GoWH8/YosKDiso7K0Q6wyDu8YXhaCyZ0xVf+0pIlFmTSjzJfNQ6gKFqLUyWBwClJllxJ6ttXFJIzOqB+mfwX+APG/eRSVgX3zx8i1x4B2LvtX5OVEu2p6ffoH4iTgl414gE9+zgc0wv1OuFs3B2olfH6jadYuCMRtAzka+7PSzJVsM+3DAVEOBnp18CZ6XMHwFR8hlOKIRW1lbORkDB62ljFCxJpWUa35Xu5bUU1ae7NgUB7U5moyxJ0yf3AXiBorgjNKtB0+DSpqIBpp4MOUXqnguEhQ44TyQd6i31e2hTwK7aRhBTRgAQTzN7FqxFWKJAlICxlVy8d1+er8EIB6+Y+csN/ThIVXkz4v+YnlCYTuigsXxABkgAVieY3TgOuRHVk6xM9Vx+UEwLSV1fR9JqSylC5L8HY4xOjJrWQOOMo2TYHo9k/rR7npcFCM8DOFiw== 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- include/asm-generic/pgalloc.h | 62 +++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h index a7cf825befae..7d4a1f5d3c17 100644 --- a/include/asm-generic/pgalloc.h +++ b/include/asm-generic/pgalloc.h @@ -18,7 +18,11 @@ */ static inline pte_t *__pte_alloc_one_kernel(struct mm_struct *mm) { - return (pte_t *)__get_free_page(GFP_PGTABLE_KERNEL); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_PGTABLE_KERNEL, 0); + + if (!ptdesc) + return NULL; + return (pte_t *)ptdesc_address(ptdesc); } #ifndef __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL @@ -41,7 +45,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) */ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) { - free_page((unsigned long)pte); + ptdesc_free(virt_to_ptdesc(pte)); } /** @@ -49,7 +53,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) * @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(). + * Allocates a ptdesc and runs the ptdesc_pte_ctor(). * * This function is intended for architectures that need * anything beyond simple page allocation or must have custom GFP flags. @@ -58,17 +62,17 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) */ 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 = ptdesc_alloc(gfp, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(pte)) { - __free_page(pte); + if (!ptdesc_pte_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - return pte; + return ptdesc_page(ptdesc); } #ifndef __HAVE_ARCH_PTE_ALLOC_ONE @@ -76,7 +80,7 @@ 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(). + * Allocates a ptdesc and runs the ptdesc_pte_ctor(). * * Return: `struct page` initialized as page table or %NULL on error */ @@ -98,8 +102,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm) */ 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); + + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } @@ -110,7 +116,7 @@ static inline void pte_free(struct mm_struct *mm, struct page *pte_page) * pmd_alloc_one - allocate a page for PMD-level page table * @mm: the mm_struct of the current context * - * Allocates a page and runs the pgtable_pmd_page_ctor(). + * Allocates a ptdesc and runs the ptdesc_pmd_ctor(). * Allocations use %GFP_PGTABLE_USER in user context and * %GFP_PGTABLE_KERNEL in kernel context. * @@ -118,28 +124,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 = ptdesc_alloc(gfp, 0); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(page)) { - __free_page(page); + if (!ptdesc_pmd_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - return (pmd_t *)page_address(page); + return (pmd_t *)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); + ptdesc_pmd_dtor(ptdesc); + ptdesc_free(ptdesc); } #endif @@ -149,11 +157,15 @@ 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; + gfp_t gfp = GFP_PGTABLE_USER | __GFP_ZERO; + struct ptdesc *ptdesc; if (mm == &init_mm) gfp = GFP_PGTABLE_KERNEL; - return (pud_t *)get_zeroed_page(gfp); + ptdesc = ptdesc_alloc(gfp, 0); + if (!ptdesc) + return NULL; + return (pud_t *)ptdesc_address(ptdesc); } #ifndef __HAVE_ARCH_PUD_ALLOC_ONE @@ -175,7 +187,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); + ptdesc_free(virt_to_ptdesc(pud)); } #ifndef __HAVE_ARCH_PUD_FREE @@ -190,7 +202,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); + ptdesc_free(virt_to_ptdesc(pgd)); } #endif From patchwork Mon May 1 19:28:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227939 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 45333C77B7C for ; Mon, 1 May 2023 19:29:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 51C28280013; Mon, 1 May 2023 15:29:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A4F728000C; Mon, 1 May 2023 15:29:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F847280013; Mon, 1 May 2023 15:29:06 -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 15D8128000C for ; Mon, 1 May 2023 15:29:06 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DE28B807A8 for ; Mon, 1 May 2023 19:29:05 +0000 (UTC) X-FDA: 80742674250.23.EA349DA Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by imf22.hostedemail.com (Postfix) with ESMTP id 1DED3C001C for ; Mon, 1 May 2023 19:29:03 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Qau1TBSy; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.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=1682969344; 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=gfpIRfFq9zSU9T7uNfhlcYr/W6dIxhZkZgP28wF3SDA=; b=dsB5K25xHsky1MkcbMi5BFFZaQIWL87e/SVWTQVAEHzjymPPb4p1LUcjei2D3ZR6wbr2Gj hJ+HSi5XYSHxzVEyr4l9J5iChjSH/cggU0hcC2A7Oxc5lEyG5VctX+iS+RsibKq2HUeHRG tjS9PKrYu8SUIPQiAtBzi8Y/HXXh6Yk= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Qau1TBSy; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.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=1682969344; a=rsa-sha256; cv=none; b=pQj0GHFz2yLZVMcwPHRSfsgx/oPnD/uOZKq6Afbjaqd/HthO5hTH6W7901VBPIVa6Lcpep Ut2ve6jQBxa8qYCQ0grRa3gWkU4bczk6t95JqUyrZfDW9OjnsUdba77YqlyRv4QP4+NY9m ZERYejRuHgQloDY0OQfcAFznfVkcd/U= Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-52c3ffc8d13so158595a12.2 for ; Mon, 01 May 2023 12:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969343; x=1685561343; 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=gfpIRfFq9zSU9T7uNfhlcYr/W6dIxhZkZgP28wF3SDA=; b=Qau1TBSyVipNmef8PNT07M/JoK5y55d5cqgZDlN4vhhP79tr9yaRETSYXvwSfxkzpQ 1wzTUy/T5LzAEZJEeUbvFZuE+VickGgRQkGj6paYz1jDOFsUn9ZCDLvNYYI/Zyr2RUmg bm3l9m5jLCH0toRw7+aEb6gYmXflBLWLMpuQeA0OVXisZ1A5osNX02KzemiZmkdGT+6d H7+k3mn0V3HtUXPo/S8coTYf23tz7uGdOWK0nFPfjqqe58njMrJom/cuk3n4mMysX8dy jTZaIlbFQNlLjrIuXwQgtdhVp6dM9pTxTSdYHIHgZYka1AJxhJpIcTRf9fC09oM2h4fK Ax0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969343; x=1685561343; 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=gfpIRfFq9zSU9T7uNfhlcYr/W6dIxhZkZgP28wF3SDA=; b=XsW4UF3I9Owzkxgp/P5yC+SjWpZgMFYeTNf0VPdabR6tPVSoxJKc+5hcNSHoFaM98t VvQhIs/CFJyg2G4Q0YwGfG161YQXuN4BZFU4E5PKlaQVlRq9zqa9RBOVBSGSwmU0VrfC /JYACyR9twm4tihkWg+zvXA6OO0GHIz/Qs6+001E+JG1zBfOngUNFP60bl2VMGqlrupz 4bj6+i/ud41eHz+DJ3FCO6XDvuRxEFGFY9cicyn13AxRfYo39PxmaCZByN1T0SUS5/kO kwQaVBqodaoCIE7GKFy1+G5KfzOBrhYRlNLNKspHs+arzdBf6hkNXS5bWYEBTqL5TO61 0wqA== X-Gm-Message-State: AC+VfDzA7L1Un+8MT+3s7PLJTuVT5KnXy6NRJsZFOLxqxw6UHAwz5zXv lvp4ZMPc9dNYzQ5ORaL7oFI= X-Google-Smtp-Source: ACHHUZ7gDAee3JEsjrpH2Z6atN7OAzqWZ2l6e0m4gqF7AbuDA0ihHMvj1UGUNCCunfz91CTNrFO0iw== X-Received: by 2002:a17:902:e547:b0:1ab:8f4:af3a with SMTP id n7-20020a170902e54700b001ab08f4af3amr217267plf.39.1682969342957; Mon, 01 May 2023 12:29:02 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29: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, "Vishal Moola (Oracle)" , Catalin Marinas Subject: [PATCH v2 20/34] arm: Convert various functions to use ptdescs Date: Mon, 1 May 2023 12:28:15 -0700 Message-Id: <20230501192829.17086-21-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: isge3toaap584ppq7p9rzzpwxap5pe4j X-Rspam-User: X-Rspamd-Queue-Id: 1DED3C001C X-Rspamd-Server: rspam06 X-HE-Tag: 1682969343-51189 X-HE-Meta: U2FsdGVkX18ZvuKrFxwqvKN6KnrRLYfVdKpLpko52mKCEAruS8fIGHpQDs0J96j7PFBHEZzh8sGwGH6q8SQJtS3IrrHcHF7dals/1Zkt0NN/EpnpgjfKZL5w/vjFA0H+x3+9rhL5FAlPogmdAu83z7Erx3ZSrbjBf27TnCnp+t5V3IvXtmwPyZvtHfsgf7N/MnJqTlH7H1KaCO6kjVk+P1USB4ks71NoBuKKcpmLR04pDL5Ee8Vv4pcx4bPPyianx0sJav2Gcqf5XMDpet6TLTnKwRgsFNR3z1n8m5TCY0dnzc53a0PSLBJq42p1s93YsHZUWaw6YEeNfB2YEcPklDV3E+P+g55UJJsPB3715nwlWNm5qwf6uDIoTqYzxt/dmXDIK0TpgCgfxKSSvTbcVQ7a+OGC7B9a97phdmqxhsu4jxyE2Y2vI5jYjkJnkeOKaeHJqEYhqUZDCHyLEoy6dGm/bmbTq13K6k1mjLztUxdVOfX7Ech8T0jYMcafvUKOq+gtFnLFYOH+43k+CWQa+2qSf7y6f6BqOvv0MBHXtclU4RFjI64fzYTOjAUZox6xCa0LcTfPMSojs+txtsgWzcZK2IIG0X5RG0xgFfguj2X5ZBR0V90Syzg6uX+gSJ50jVkUf4ps7PWmFwoDbufwHNXsSyR31S94T6uHv4ZOY1awyarPuF5NDn9p/FvxxSyE8T8nvRUDr7AZSiahzKlDIT4D8h+/PE1D3orRcJDTG48d1JH2zyCJ1wVOpGWBdZrZNB7TQ27WTmPWMZVbWT40t6XKsB7S9HP51H3vz+56CC5wUTgZ9V+lK0Cjxp5ZHJYdPPZU0cz8A6acxuV5E4u4nro02Ul9+4+ig6v4RIMYYIbIrbzxQ1Fe+V+28uSPYuko7z3VY+R7faZBzQoTAehVk2yzzjTUbz6m+pHiqJCxGbxtO6Co5AVNPbifMO54kX1QuZE170uTAvCIECagMZK 1DnxTmcP jPRa+qM9oTpYViELcszzgh03DLSsFz9iTOragdGQc4dawjLrtEqMV3x7cYp+lt1nDPnQStYDvYvTFYzWZOv+ogHhbuxdjtx3lPLUGXa/bO76R1WokAV7NvzZNW3eMaS2cILex2e83hYfq+agR/ydjTjGQ50pd3hqBSNwwNaPUAtuJGhwfdkfmihMcDbYDKv98k+SMqDc4SEN5TjJmanlUS9DG4g0zOUkopv1NyHBe7UBjD1+cITXgh8ldlidOmQ3x1+9Q7ZSW1hT2AO+ny/Exav4Ba/I7bXnR/1GdirwxW9PFFdu6VV7lWWWdKvGPOLHLBsDlW7+/6yCLUnYDmfaqZxU6JlGY4gpVEwVM7kJSzwShaywgkPuAI9THwB8NEUquFOrmKsUwWHX8FHYmiNgol0lA8UK8mNf/dT8vSdeBr1iYnQjlOfcZ2Cpb1AemXx+FacFbWHImc5fP2K3mJ0kOmanBXA5Qdxh/ZGujPAsSGSSqYPTLIBQKJYqlTV23l8+JmHH/DfmVTL2OGyaQCUEve7e78w== 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/arm/include/asm/tlb.h | 12 +++++++----- arch/arm/mm/mmu.c | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h index b8cbe03ad260..9ab8a6929d35 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); + + ptdesc_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); + ptdesc_pmd_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); #endif } diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 463fc2a8448f..7add505bd797 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -737,11 +737,11 @@ 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 = ptdesc_alloc(GFP_PGTABLE_KERNEL, get_order(sz)); - if (!ptr || !pgtable_pte_page_ctor(virt_to_page(ptr))) + if (!ptdesc || !ptdesc_pte_ctor(ptdesc)) BUG(); - return ptr; + return ptdesc; } static pte_t * __init arm_pte_alloc(pmd_t *pmd, unsigned long addr, From patchwork Mon May 1 19:28:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227940 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 0FDA4C7EE26 for ; Mon, 1 May 2023 19:29:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A2808280014; Mon, 1 May 2023 15:29:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D76428000C; Mon, 1 May 2023 15:29:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 851E1280014; Mon, 1 May 2023 15:29:07 -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 73E9128000C for ; Mon, 1 May 2023 15:29:07 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 596EE1C71B7 for ; Mon, 1 May 2023 19:29:07 +0000 (UTC) X-FDA: 80742674334.09.D1FF9CB Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf11.hostedemail.com (Postfix) with ESMTP id 8E1214000A for ; Mon, 1 May 2023 19:29:05 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dujVT07h; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969345; 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=oJJ/5JNaAhhn0BtCWyESRHZW29NfaaBB7RT6Dtpfjog=; b=rV9nLkq/IyE4+rG+YNUjdGkNEQ5H37Hr5RYo5DGvKtmxur5wd6w39QTocnwK9eOYxUThlq aSeVsirAXJeXjfNM/W2lUzVDjnIL0ozrlNh6lI8T2KhM5+okGwQ7Zp7kUpDdlOTjlCP+yv mkfD/6/EasCqVSV/degQ3X/a+o4fsFc= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dujVT07h; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969345; a=rsa-sha256; cv=none; b=vlBtzjfuazCYusHJ6WOwJiH9pzxl66ZP2RgvAqbfIZv1Ka6B9dGSMZhoRz4KAA3B+7x5ew Lc/gaVO4Et3pxM6VNp//B3NUCOrHJnS0ppWtlCa4o9q5jH8wEINXp8wOyE0qhz2/l90b9H ol+qhSJOjbVLDSe+X19Yru8jrnFfkcQ= Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1aaf7067647so9432005ad.0 for ; Mon, 01 May 2023 12:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969344; x=1685561344; 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=oJJ/5JNaAhhn0BtCWyESRHZW29NfaaBB7RT6Dtpfjog=; b=dujVT07hfeADlXP8VLeHzHZos19FRJjW/aMFZqcOyBAO37TIyuOPUD4cjiEOtYecqR Tiwbs3Jgtkq4Kww3BZLsfUeYGH01HRped6BHBhotJFQfLn1orwI/QFojUqd07/woILZm IdwKD4oQO46zQ5FUSiD0ClypRdGvF7AHFnh12n9hs1VGHXuzfiiaf8+D2bQL3TQLnlID aypLmgidYgZS67oc/+3avE+c7doqeOxXcTi5kAqysB/3bLqLAcTPHmeArfdREDSIi+5K 85L7sVL9riiLJDbWejHR83t0dYjCRXFIJ1/0gZmctdGxqkiAMg4Ak+2alOu75j8lTMAw rYkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969344; x=1685561344; 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=oJJ/5JNaAhhn0BtCWyESRHZW29NfaaBB7RT6Dtpfjog=; b=M/ka68ao5blDnVuVLgmhWItHChnVfyETCAtELqhNo3xbJO73FZSZgzo0XYOq7yvkLx R4CsuZbxF3YGp3o0WnCuQfZ9bwTXWadh7GLnLM+32sI+wOFtSSumgr4NtuBfp5gEpdP3 VJYpcbBAFRbArdXPmbJI1FS7AMjdQ5KrwaSMl+6Pgrasdo1aqO0C9rwK6rFpiy5fLjPz Jn5GLgBE06q+4lVwcCo70pAppwYGZOsV+WzG+MW5UdzF7Lpm89CQADGM1S1ITaMaCfEY bFmgye8xxqRTTIW5n5K1DdNXGMeSqpG3y6L5+5sGT1XDp44y59legpHJT5E7e0OOVXeS XSGw== X-Gm-Message-State: AC+VfDz5n7K5g7SvNm6zD7FgWMGawqpzXQjv0ntFPbZ8vQwaJyha+QmJ IEQzSMuj5bfnxA+/dEgfjp8= X-Google-Smtp-Source: ACHHUZ4ZEnjwtlgm3inm4fu27SXTrMWZSABNUt55ss8dOEDonQf7mUoqMAdyKodh48zsDDd3raB2eg== X-Received: by 2002:a17:902:f68b:b0:1a9:2e3d:fca2 with SMTP id l11-20020a170902f68b00b001a92e3dfca2mr18382952plg.33.1682969344394; Mon, 01 May 2023 12:29:04 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29: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, "Vishal Moola (Oracle)" , Catalin Marinas Subject: [PATCH v2 21/34] arm64: Convert various functions to use ptdescs Date: Mon, 1 May 2023 12:28:16 -0700 Message-Id: <20230501192829.17086-22-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8E1214000A X-Stat-Signature: cmpzodqwhybudo7bis5nuk76khwbupde X-Rspam-User: X-HE-Tag: 1682969345-37515 X-HE-Meta: U2FsdGVkX1+zObYPeD4f0QaSFmKHX3s/pZUaT8BYQ72r3xkZKwD84dINVtXLNr7O8RuONKE3qs7L0H4zExuNxvNJsbnCX32LyyJ1tfVvkYayMLjY0nUhDKwDMRF8qzQeJx+v7DAw+xM+BRWpu5dFHp6uMO5ommZtBp9z/2yJS0zBBjjiX9sf9KhS3arCBzdJvFEUfjfGSlQ/km0tcjOA37vXUYGLZMPIalzdwshwcDZKDLICdx1yJyLLKEbOHSTgEUyniISUKhG2xSSllvX6Gac+mFUIwOA+N6kwKpA+04Lywe7LS1kU2eIq8SpvSPkDVbhd3s9mfK0B5mOEDsz8TOyGkpsFovSukFHrhXxlwldmGYxlhf/m/B3IxfmG3Sb4IjoPUs4i2zBl0ZRRhhpnbVl7Ydcbb3RgKR59XS2utSp1Rm/a2lGxjXTSFfMr9BKpkbrZCDzhd9PM9JHEfkg2dj2fk14izRMHaPFVCa7s8gobx51i8UCZRrugqFIcDDSiI4g4iM87LQocmdZBNMH7Tz7XfbpZ6MaJdAdwYdRO/2VBX8KTBIFA6VhPpnN0jHT2KyZQubGl2FcAKGTX2YsKlfreLH1IZX9nerHRIrf2+Roii41H0k9k0HkMrXkCojf1h0q5GP12DCvSiHz9Uwl+dPKyc9e45V4tfOOBrCXcRVYFaHHCmBLGOdaec4vRAv+jl6tYIi6mnQHI4GUNpxzYStxMIF80PnB9p2nFMAP+ZSVkvtUrsOVGcskNB+Vr+0jF9pgX5+oNYWWm3HRWcE74j6yH1OTuuaDN/kt0xriKGt/3eU6hOzYALFK4qzfNyr96pq8xzJ0K/qm7tE4gsB+Vnbh7qReCWCa0MmcqcyFQou4dYemARNsAX7UGsXlMtxoKFv7uHT0T85vMN19VuH7S1qc7xE0kFRFw5sYA5vB9eM3r0oSGvG5sEsxWLuqdgBtTYGHCM6eZ2DDCbEbNbKt ENHEyxXX KHmGn92DdB5wCxiVcIAkrV6Ian8YJvoHyrsUJmtjv0lhpC/Mj3VSzl6LSgGsVd0vGbzrJIqBi+xfNpXILqA8N4CTAWRdhluwosdYVDKqXiV2t8xCoRFDbv4SbyMJmDLRSv/1Vlo+Bz07Emkd/dYmmd6Oo20Wldc4vRLjF2gvWUfSS03sZxDcsMW+JZdHJLBCigLfeNwpBncDcQMFheTeQQIyLtHd0pGRMhlLH/bSzh1zH5iTQZbkUhLLWizNdE0Nndm2WsRZZBEFRZ5Vathy4Y0xhQAitcEjEMWCAvCXdGIlgc6nx3tLJmRCn9fLOQu6D8ujWux6xJBkF//EcXdFatDVBLxVeMEUFo3qUYiRYMcJ7Xv1UOI3E/t7rPWCYIVIPGvr3Ccpuz5wdUpiwedXecfOkG4LI++BLYb8TygmWRhYL39Oh77cQczJhHlTaGl5nfNNqMKMMOVQk/HZn7eKh3hlsdqajMlcMQFLV8ZOKQD3u89rJWXSUVr6wQPMG2GPf9Xb7v1KH9nwN4zzN79ALofrQBA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) --- 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..6cb70c247e30 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); + + ptdesc_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); + ptdesc_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 af6bc8403ee4..5ba005fd607e 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 ptdesc_pte_dtor() becomes nop. */ if (shift == PAGE_SHIFT) - BUG_ON(!pgtable_pte_page_ctor(phys_to_page(pa))); + BUG_ON(!ptdesc_pte_dtor(ptdesc)); else if (shift == PMD_SHIFT) - BUG_ON(!pgtable_pmd_page_ctor(phys_to_page(pa))); + BUG_ON(!ptdesc_pte_dtor(ptdesc)); return pa; } From patchwork Mon May 1 19:28:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227941 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 D071DC7EE21 for ; Mon, 1 May 2023 19:29:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 25CEF280015; Mon, 1 May 2023 15:29:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 20E4628000C; Mon, 1 May 2023 15:29:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01289280015; Mon, 1 May 2023 15:29:08 -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 E6C8B28000C for ; Mon, 1 May 2023 15:29:08 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AFAD81407FE for ; Mon, 1 May 2023 19:29:08 +0000 (UTC) X-FDA: 80742674376.01.F81BAC1 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf12.hostedemail.com (Postfix) with ESMTP id D233540012 for ; Mon, 1 May 2023 19:29:06 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=q4na0YpY; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969346; 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=WInZHFLF0E37CPvH/fyQuQmpONrFi7mPGahLu3Z9gNY=; b=Jh0At93Puain2MqcZJ0s0tEYTEl3DqU/hGGJdhJQLVIqZmHycufnX4ah8AYokL8C6ybZZr VtzzUTCdPLAT1KbaHmgD9vo0xHXdrPIilix7hd06zflTmAhQHXlkINmvXP+bh/Lsu4+MeJ 23l3yZz6IN6ybj1u34bCiZ/+yLnZ6iY= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=q4na0YpY; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969346; a=rsa-sha256; cv=none; b=Ctbh9VXJMP7eMty4zdFFr3897wJ/VnQKBfvh5VJm2snTiGMjx8qHu2hR7qFQRAstU7xT8P oTcfXRA3EB6eD/uG6GcSQMT9toO4EYtIyZO/SH6BNKTwkUDzbs862YSclpyPMIj3t+ww8W uunZYMQgeBIIwVdXk9F63QnjF/3nLgQ= Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1aaea3909d1so17752795ad.2 for ; Mon, 01 May 2023 12:29:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969346; x=1685561346; 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=WInZHFLF0E37CPvH/fyQuQmpONrFi7mPGahLu3Z9gNY=; b=q4na0YpY6+HIdR7eCjpOfgl3pLZKXaYPSEQBquag8z/68f0H1ARrXFU5GHdi9YxK8/ rB/VLGJXy6D4ZufE/2LOOEwnretxgWAB++ZlGVRxVIYCoUOlMN8apcsmkHtbQevtOOJx LNKiQlcElPDsuGjD80MSn3zT41r1jijBtepWy2itQQP8kPb/qbuR3Nu9du37XsuFat5b tY9vSCaH65FZJZYGzqq6Sev5FEiEarceFI+PkCB4zysu+TPDmYzeupQ3qWrtewRiW+Ef pPbEC2E+2Gu9odmO4zWHfrgw5vSTXCdgYdvlBNlEJqZMmLFOH+elBEgtadEGjmhbbSeV twkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969346; x=1685561346; 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=WInZHFLF0E37CPvH/fyQuQmpONrFi7mPGahLu3Z9gNY=; b=Bp2DOEb+T2NOskvaYwaErKogi6LKZtmODM4EYnEsccnr7fw9MTjwD+bMyv1lt00dsy G+CfL8gL+LY5vPs74WykmMVCTjV6evvS0gE4mOmgjdbiQPLXW001WEgleyVcaROa9k89 YWyW8I1ob6ahADMNwaca3TIXcYqri1zeHykPpOcHz9uYP+zyi9oZhsFRMwHuG59NHbeT 5LJ31lyPLl91v5RMP6kI9jTBnjc4Hk2Wn7Nhe0UP3ZuIB66Lso5ras0D2xmrZuQTQA5x v2uOd0H7EBVD7rI9a6+cXO/Mr6RDC5cAn+G7d7e7EcEgOWODDYnIYVjhdJziJKM0DnQy U+GA== X-Gm-Message-State: AC+VfDyFGUKOHahWEPUcKjYGSTbpYg41lAvvR4ANC/0kwn+4XNkFsIqL ioHOBUhLIUFnIbKSYALeGX79WtLEAFREhUWp X-Google-Smtp-Source: ACHHUZ4G7uSDpj0Az+Rf76NPdw6reyXbUYX/RD5L7uNUC8eMCewkmfrtYB+I6yNLHyDYyReDKoyXCw== X-Received: by 2002:a17:902:c947:b0:1ab:8f4:af21 with SMTP id i7-20020a170902c94700b001ab08f4af21mr235908pla.42.1682969345737; Mon, 01 May 2023 12:29:05 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29:05 -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, "Vishal Moola (Oracle)" Subject: [PATCH v2 22/34] csky: Convert __pte_free_tlb() to use ptdescs Date: Mon, 1 May 2023 12:28:17 -0700 Message-Id: <20230501192829.17086-23-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D233540012 X-Rspam-User: X-Stat-Signature: u16eayfeubm61mmwrdf1zjhtamfegab9 X-HE-Tag: 1682969346-54392 X-HE-Meta: U2FsdGVkX19DnXjIjUncDdxatdHaQgjprztSNZX2c/C/30cJKD6iKxiWfFNbJLNJsGV716d/zwEGlcCMLoRMsGel+FsSR6YaHs/AW2cxYwqD+jcFWLqutsAz2gVrTYmo4LXCiHY2Wjnr9gqj0cSZjiAlHys1El9zAEbO8frkx68DEmIuBvCoajMVvmnW6TqfIe77mohNU4W0PrdhX9dLULDPEsbyrB9JXss3T46h7DhfM5TQ86iBxz8MHqWqojZviFDOunHFzQh7fEPSDZ0AicTEruGBoeD1ZxnF7CQBtDNKol9bnR4EYEzRbYGmW65oXFOQVy1MsN7SaBI38sWF13PvIE43VZ98ysSPHSdYE0dh1gK7naGy7q6SSAIqZXLPfoqFzuNePfKql4QNhX39BpBYeqfszdr4zEK0gen4M0QjxujCxPCpcKz6Mra9AIKyaBnTrLNu4P7ZpmxkDeIuioK0Ml/nDV0T3Gc6HsBQ/reedn4JlUUmgiY95jrcBp49EsfV6oxgIaV27znfo/wN2gfVfhrP6Gg4W1iC/jgWVOZsFj4PBV8HXsvWGTZ/Pc4h6msn9yzEI/WWfnsGWALoxyFIYaDOo0o60G6cKkrE8d7GKFXsD+lpdEHUuC5bofcUtLoUKDRquLH8gj0dWQaoGYYnpfi5ReKk6buJAChWcR3pqrAKxZP68VlQttPEHO8dDRslnsWRO8NaQ9aJK/CFoK6IJaCfsUuvApY3aR3Eg4anuITfSZjSWcb1JFWrCXfmxpE6uubUrZ1q1KYjeRZdz2wLppzc1kxsQ+9gGQE9/aeLmSppUDE8+xuQd3FJQVJkBVES4K4Q+NJuG6RaL1wj4UABvKZp7Bc3ZCnAPLrm9nEkmY1o0DscPsLeUlwlHlJtHwcgh9cn/knxqkeebSZKnZpgCs0uFDT8STWR/Bso6YkdEt9+SFAtJ9GAxynaVBWtOqwkvUSg2maqOecZUzu +w+LP6YP NjyFlK1bK1K7icpImcSO50FXJ7yCwsZQIYj/OJiHZDafubvDFWNXmuXgjzdVwenOviAogHttvTeuGyXwCjtDIkawPAdEMtaI2HogS8KV+xYJuIo6MKsHW/T/k+lbNnd3bu0RdaWsqCpMnf6pyWYNvg1Ifdwj6mAkplDWVYz+0cjZYsSOhmYuYoJK9DuB31CpGAVnZp7pPlIy4TD9b3ROZ4njhEauY04wDm3KISwCU0hu0wgfesF4Hb2iG2QeB6pG6ohjEqH8SvbSSiVeUtgJnt1VdXUNYmcC2WADbdTePSIfk1FabdqoTNcF8dbSL+jjZFvc23Kje2kZ5ss/Vsx281uPlOUwN9+9FDOenUCrvhwTegWHkC0m67Y1EVVo8patBe6vXy5/rDya0Q+bT97BKLagkj0pWPoaDR/hK124khWx+B0/XPoEvpnOz9xKsNz4MgN7jTPH/+KwGdoCFbRhxI4/zhYFaJZvo9G0H0tvgotAtgyNJpO6UBRGGChGS2QqCYdugEvLnk47uFd3hoFgn1cDydCDDMy1dcKAFLYAMUiVY2KgJNw9KCH1nIuHyB8h1mXueFO0hkMMq/mY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) --- 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..af26f1191b43 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); \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc(tlb, page_ptdesc(pte)); \ } while (0) extern void pagetable_init(void); From patchwork Mon May 1 19:28:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227942 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 7B57DC77B7C for ; Mon, 1 May 2023 19:29:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7DE9B280016; Mon, 1 May 2023 15:29:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7901D28000C; Mon, 1 May 2023 15:29:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5DEFA280016; Mon, 1 May 2023 15:29:10 -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 4A5BC28000C for ; Mon, 1 May 2023 15:29:10 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1368EA07FB for ; Mon, 1 May 2023 19:29:10 +0000 (UTC) X-FDA: 80742674460.17.4C3BAA5 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf25.hostedemail.com (Postfix) with ESMTP id 4CE90A0013 for ; Mon, 1 May 2023 19:29:08 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WbTJO1ay; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969348; 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=apg836Gn0N7QExyyhUUGNgc2fd2r3iyoAghRwsUjc2o=; b=oVVEXwiBT001e18EQB9BYOuH2IYwjIvF6kFrvZqzuT4KRlb3/DhjBwpFOc6xB0xlw6VWQb bUwed+hqFvkcCKHGxc/hs50wHZhoTk1jwdGcHbX6bDbQviT+1R98fuuYU7MzsK/ZAh2mHq cYLBGpwjVhnndGdgE6+L9MxHFKmdb2o= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WbTJO1ay; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969348; a=rsa-sha256; cv=none; b=Cdb16yycqG7TwtGqVCKxNaD7WZ/jpxiROYdxRZETFWYJcBvjoyQxM+CaLQuvgD6SuvTyk9 wEJet8TLvvszrTH9jt6/jfCGmW/fF1o3oaEIZ4rV+2ymTBjKXkTR4wpjBYimWmxmPJwAbp 4GV47UMacR+gzCCqSIXeCJg/cp93Hvw= Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1aad55244b7so19089935ad.2 for ; Mon, 01 May 2023 12:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969347; x=1685561347; 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=apg836Gn0N7QExyyhUUGNgc2fd2r3iyoAghRwsUjc2o=; b=WbTJO1ayjn3HXL/iQMZCmT2+RnFSF2O5WG+VKbNfOxDU8NvbfSgz+Wjs4UVgNNQcMr uLj57ayYRa/f+rOhAVP0jHM/2f33b+TbcsUuT8OausfFIQuWjGI50HrH5E0KiKkIgQwa 0uM85OALkALC3dGk5nJ/tYYANgKg4uu8cRvFIwQEiY4YzwHIJvVidPyhHtwxmNKQYA0W tAWz4vl42KgoRYKzs8w7tUocWedsU0Shw+kefBEmySvrYYB7bH8pThcvpYZ6Dpmw316z icjhKqrruYJxczjDCcNsGgrwDrViIcKW8h7/U3ESAg45ipYAB08luKD04Ylpo9b00Q6j cFOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969347; x=1685561347; 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=apg836Gn0N7QExyyhUUGNgc2fd2r3iyoAghRwsUjc2o=; b=gEDHi1DHPDfXc0z2AzdIuvJAyu435iwrlw0nju4QdlY3YhU5Mh6LHYGnz8maIJeT4u W0wwS2YG9VE2hxxzt+73I5NHNyhc72Z2rIVV0tkaNZTv2mUblMR0WR3SswsSPuLFgkFk d89zT4tacwV3z8HZSJ9g6XNei+5jNDlGbnbeedUKNzJw1ws4xWqqzZgV+g9vjdVXNZ81 gjFR1cJDFow0ugORSaS9KcMEHP8A1V9jQ3XWeG4y22dxUzR+kKJyCI5Zxq6LjHfNJ2Yx f3Snz7sU5zVLYip+MoTgeLoDJqMoXxyBwkPJ2P35FjnQ/Gq1b8p0WD/Hrzo16d0C7RFF zM9Q== X-Gm-Message-State: AC+VfDz6U72Hn/wGSHCAFLO/Z5HlKG09RRUKaVkn2mRxCiClIBjd0Iku ScMgaNPz0qDDBTtmRkRpD08= X-Google-Smtp-Source: ACHHUZ6JhHSCQpD21/kJ78iavglhPlPTqvuf+3JEce/L0R67tH5klQ2MwjR0kPXU/JMC0Y1BeGjoZA== X-Received: by 2002:a17:902:c94b:b0:1a8:626:6d9d with SMTP id i11-20020a170902c94b00b001a806266d9dmr19271440pla.62.1682969347146; Mon, 01 May 2023 12:29:07 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29:06 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 23/34] hexagon: Convert __pte_free_tlb() to use ptdescs Date: Mon, 1 May 2023 12:28:18 -0700 Message-Id: <20230501192829.17086-24-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4CE90A0013 X-Rspam-User: X-Stat-Signature: daojxjp9nmw9cr9ymq4ecsyiesb6osbh X-HE-Tag: 1682969348-867436 X-HE-Meta: U2FsdGVkX1/fWp6r3gXedL4Hevu8t5U9zCXq0tlbZsxzzF2lhKmHp5mZ7G4/mULwlATesYcP3UZEMfyK3nDyX54G8RQ92ip6snavNftwwx9D+yJ0M0/h9FETAlU529Du2cDFsGNdJKAGY7+95VxmFNwHu6rf74bBTjowMSdHuRoC7tq5hzllzLnJz6P62dRluxXaF4h4ixBwfZSzq2kkw4Te871vOU5MN/1UcbmzFoIqih23WCLNp0ovdcYgyWn3kpLM99XyPUcQO2M58q0ZR36mZw7+4ftM37PYIqAKjxVwiiUk36XZHUCHYI19kBanIe+uSRIg6bmuR1/7aJFic6E6hVlMV5ksLjWO3BqPcxixM2VYABNMat/0CDSN2BaUfcrPZTZQyw60D4g2ueYGxpMuUDtle8+FSVR8ibhpdv0XlSm523ZZ0weBbVMfTrHoq4xfseYcJursLhPaz0Jy9hpA1FYSido1w+7idBpMc5N67g7eyQgk+EzZyRiF2h0AR2qrKx6BDyESbDP3DoIU/SDLIDNjThAcq9dj8dzRoaL9MQkpAsDvQHSERwF/2zFvVQPFxrv+c/cExmF0Am/3ItBc3y/xwUed6/m2IBTbHNhNrVA01buozmQvgrF2MgBkG+Z7PgfE7mvKmQw0C+ZoI5CZ78XAVgJVDNgJckNFz6jM1hEgapWbe/Pj9V4njoeHWMc68MWMnKjj6OXnI/jdzOtbhDlfNlwqjn6ezEWYFRtiBnQ6g4kQNHifTSGgVtILG4Mxma8zS1mSYrZxH+9gQgj8+j60UwpBucdEj2N8nmJCi59rVwbg51ymTP7MI4GutrGUgbsruhbCxDIEojjy94WgU91MgZ8E3B3N5Wq0T9rCi7rPu1JCpLxyz/gqYV1pc0X83YMYQGDcrd/KzDj/mSDHmQ7nL9KZPymQLDcs1VicJjQ7M0qSctj/vfH0l8pnllgrCOWFC8bP0Ef01o/ 2TiRSCrc 6lHNuSSE/wvsyVh6FYDq7YzvDXeEBXTbiuL0B3xSf7nuJ4Md1BhxVRkQ5anTmlW7zpqXQMbyKbD9D6VW7ODmZmNlZs0vdwUPAVMnz4ygV54hLMmojd+3GlPlMW3OGZKYnyBTF6tG4oOt1lp/2n/VMpui0qTX5rrZ71SCzGvuWBs2E8BjBZI/0WjfAJVdhpTn75qgP/ZZfjnxyf8pJyB+n9bgjPadFPcuWSu5s4hPboyhIXSNIIWvWnNhPR253q9VZgt7F7jD8sKkPWW7tRq6zIcL88yDdGTHgVeL5q1i7qOajaYYl3E7Rbt/D8jPtNJZs1Ujicg9f157RJ3iacnlZ0TKIsm0LVDxEGDhSHTvOYXjlHbqHL94BTo/Cy7QNgrop+iPpFPVHKccsUuvUkFiRFqJNFh9Vhtcn+BlHqVfpLA71nJWM+e/Jytbm2HGetHAU4FNAMVgptbnoioohvTR0Zngl/NRELuHf7q5MOeFSPe66jAL99+BN4FqcA5x8Vg932ChqjjqoQ33I+ilE6QabTb671RmgaOSR/k4r+nXES432zJVyZLRDWZuCjD9GiTuxdY68A+CSBGDSgbs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) --- 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..0f8432430e68 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 { \ + ptdesc_pte_dtor((page_ptdesc(pte))); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif From patchwork Mon May 1 19:28:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227943 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 E8722C7EE24 for ; Mon, 1 May 2023 19:29:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 62D2F28000C; Mon, 1 May 2023 15:29:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DDF6280002; Mon, 1 May 2023 15:29:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A54628000C; Mon, 1 May 2023 15:29:12 -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 3415D280002 for ; Mon, 1 May 2023 15:29:12 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 05E3316075C for ; Mon, 1 May 2023 19:29:12 +0000 (UTC) X-FDA: 80742674544.04.02D8C8C Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf16.hostedemail.com (Postfix) with ESMTP id 25961180020 for ; Mon, 1 May 2023 19:29:09 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="Ln4mDR/5"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969350; 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=Pf7K/iFMD6od7/SRYpuPsYcodkkXMgOdjXv5YJvZldk=; b=LEihJvmMMZcFod5ZhjFcw6GPjQ3cZj1ZUjrodduuHBi8QwmlF5mgf1vu2OQT43g3hgDCFB 6Q9LXY0ePF9cNQV3ts6C7zW+7kg0ugRbrc/JeAq/BPHdvjjyaGb3NNomXaGMDMb2MksRdF jXgIC0+HqvUcJymPqVTtO0hoUJni5rw= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="Ln4mDR/5"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969350; a=rsa-sha256; cv=none; b=MnpZLGP/D3CBHQqbPCVSRkiJ+Hko/3EMJAnwcWA58yOYhjSMo7qWCr7ob5S9QezbTzIoGy YbuhCjmsYHC5hrIodsdXiavVabRZ3G9e9JbIrLX/FwTQFdTwVmB0/sKNrVIy1pRyy0TLYn YB9k9tJ262kCra81D9QJV0X2pFU0zgo= Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1a516fb6523so28450345ad.3 for ; Mon, 01 May 2023 12:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969349; x=1685561349; 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=Pf7K/iFMD6od7/SRYpuPsYcodkkXMgOdjXv5YJvZldk=; b=Ln4mDR/5PqhQgedxrHvQljALDEWoa3b+hRIGv35D/XEQopkojKeYky16q/KJiQP190 gOXMLkWlsxRYt/qNbMMHduRgO5rwSHkWxXdTawxJdNC4w4aAhizbEp/u5yJIFvo+hvkC CzCza/yOOV7wQ3CRXlPMEZ6eMm1zhczAF9AJlp92How5r4l3oEpl8xhmNNQZ5IRuQriJ 5iq8Jlorps05Qifajbp6RIvsWCW3JV3LIBqvQ7RLXCzoWQn8RP/izc4h1lgdgQ7smZ+o cGeex+nu9iv1OEbJv0WRRlF1TRZ+PJHxnItl8vKiR8iqu8w5u+UliAsQ4ZVuON7yHbns fmHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969349; x=1685561349; 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=Pf7K/iFMD6od7/SRYpuPsYcodkkXMgOdjXv5YJvZldk=; b=U+86W3wdO7Jpju0qiKmRiso9woN82tsKnoan6rj5aan/LIK/d2ynA5bveHJgnrqDLc CQ5Y4nxtFPt34b7IIJ/4U01N0bVvZvxjMEX06RLdGkIvfHu9klrJOb9re09TVlKgGdo+ maIDxRZeM3MyRJQnPoM4RZdNoQH/88sZQNEIrZdZySWDKcSlzFF7YU4hu2Y8JzJI+Yjr 1i8iQYl8JQwobAstxfiOXL6HPuRwyp3LiQQrafRfiexL/k4mAz4/eNeoKM/4i5lnAo+T BZOvdif/vt/fb3cX/Nb1eZreIQYEttqjv7SSOI3w9bV5a5Tm1aywf7S0C9jocVgmjneL L9yg== X-Gm-Message-State: AC+VfDy3oKt3QScYQNV66V3p5TcY7fswcPTduCiXt8HrrJgoR1Wbd+WA uGYrJagu1GogHs6/PT1JdCQ= X-Google-Smtp-Source: ACHHUZ4pGEgDP0ct3SBtbJjK9qWlsOBNKoJkb8hPo4/muNsqGBXZA1NHW06v64HPJmj4Ckit7F5PBA== X-Received: by 2002:a17:903:2352:b0:1aa:ed6f:29c2 with SMTP id c18-20020a170903235200b001aaed6f29c2mr6827893plh.11.1682969349038; Mon, 01 May 2023 12:29:09 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29:08 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" , Huacai Chen Subject: [PATCH v2 24/34] loongarch: Convert various functions to use ptdescs Date: Mon, 1 May 2023 12:28:19 -0700 Message-Id: <20230501192829.17086-25-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 25961180020 X-Stat-Signature: 89mpx5osqi45646eyd6qa5iy8sgszy7s X-HE-Tag: 1682969349-389281 X-HE-Meta: U2FsdGVkX1/f4vZxO1uRA//oNXPF7hWQEQICgtrfSDb8Q2iJ2jm/3AWcy3WacINEAf0t7SAvsYi9igqTv48kQHlrIXvH+YBzvWQeZLQfphssWiEoLMaPJ8KB+GhyQCpwPwFm6JyfI38h2YxkPJTZznwUhaCt9iMjZk/Y0C9wfDU213EievcbKgU1AIh4uw1yE/4Oi7WDoznZVMVg6EfmgEzFRRz09/o0xmXCpgJGXqzUHOPaZ3Q5lJf5uiKzNteMA7UkbO9YqcXDhG4PcZ7vXJdZLdoQkw828Z8H4ffuImSFHaVmPQ/VTMmeNfLZpfkzz7NFZDQjAU4Vr1qR6zrYXz0+RnuAmYMDrLz1t5VESXwn7tZBxeaEX4lPqhrUo+lvGpAUI38wkEkKdIBEwpoiE3aOUXBrh9IpDlym0yXQrBUms8sdx6Q6cH3rHsC5luidKbbarj4b6EKqzuib1WsDMgNmaofxV0DNa+Yt/NJS85uYI0Td+ahQhbGQUVUpFMDAouXjmJQAC+klZL7Z0gKwnIkg6uVKOnCHk3WPxZdTkLVlW7SuQha8Q7W0tP+rhanfalRQWkfN3uaRqnXomCrc46GZCn6HnGugPpMqhVxQIcvAyvOg7YpMTNMjMHATSaDrg0mscYpkZYoUMDpLATgZowmpxWyNMwvd7Fkbb0wRwYnmSqexWyB4/8eWYEjXq8Qw5oJrv5hnCo6FC926c+K0Bk9B6rwFsKoQ+ls7j/uv9gY1o2ecAARKtOcJP39+MyX7rYyPenpc69EHFoMY6zh4tIgHg+c2FhcE3u6b2gZISocRVBeVOjtYekA6TNgY7wrOKi3Gl2IXYKL0tX74MlnmW643KXnf8Gwp4iD90rucBuNTfm278VZ+3qRwf1gyNb57J2OCoA34Zryr/F6OAhPnAlMAtgA7arsjjwAyR7lkT5OAvnxJg0hCbJ8YzyWmkamedV+8ipb3hXdha9/oyc9 blEYvb3g APgZiyp7DjjDeWeKCGY06aQWtn5UHUbSI/UMtvDzOZs1JRCFMeKCS5L17a1bUPo71y8hI+VEhr0R4pEk6JKUO0226y+GJ269wbpmiwu5AojI/LNrre5j6vxqQCS3YiLri9AjpRcOeJkZKGafLaC2E4REpGRZZ2/Lp8VJfcAkQg1NZWpARyUU/iCaQN5npTSxeNuCkkpzN2qhzc5M77eC1bt0IG2KpT1kQo1Doq2CT+Nxr2na3LSyFwxNTUWvEs1HRQ9hby118vD65FKKJ9Z/42B88ZJcw8e98nYQA0Twce2p4Qw8Wf3yXVzWnn1nroaPfV8nibqOoKmm8QFOyyG1xKUphXDjcreJjQmSI4ugZR6wkf/yomLW1ftvHQJGPC990MjdBMjuWGqsyk7KrafEl/ujK9PqrMhIN/jKpe1994P4Ej2A29+m4hultYB7QCkEtUnyG6nkLuOHz4wpV1treLyyQfbKEVLq4OMlMEepaDep2e7D3FY8d0/ATFAdmAsP+ZmUfumnbrOndWPHy02aiw58myw== 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. 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..1fe074f85b6b 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 { \ + ptdesc_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 = ptdesc_alloc(GFP_KERNEL_ACCOUNT, 0); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(pg)) { - __free_page(pg); + if (!ptdesc_pmd_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - pmd = (pmd_t *)page_address(pg); + pmd = (pmd_t *)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 = ptdesc_alloc(GFP_KERNEL, 0); - pud = (pud_t *) __get_free_page(GFP_KERNEL); - if (pud) - pud_init(pud); + if (!ptdesc) + return NULL; + pud = (pud_t *)ptdesc_address(ptdesc); + + pud_init(pud); return pud; } diff --git a/arch/loongarch/mm/pgtable.c b/arch/loongarch/mm/pgtable.c index 36a6dc0148ae..ff07b8f1ef30 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 = ptdesc_alloc(GFP_KERNEL, 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 May 1 19:28:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227944 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 6208FC77B7C for ; Mon, 1 May 2023 19:29:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D7D2280017; Mon, 1 May 2023 15:29:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 25CC0280002; Mon, 1 May 2023 15:29:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D611280017; Mon, 1 May 2023 15:29:14 -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 EB8F5280002 for ; Mon, 1 May 2023 15:29:13 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9644AA07FB for ; Mon, 1 May 2023 19:29:13 +0000 (UTC) X-FDA: 80742674586.19.B1108FA Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf06.hostedemail.com (Postfix) with ESMTP id BBD9A180007 for ; Mon, 1 May 2023 19:29:11 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Z7q9x2Xo; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969351; 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=4OtNgWOkZ3LfZLHJ8GzTdJkHLxMJcmtHKM1yrsNlf/Q=; b=fuUOwTnz21/zSHClkcq/h1K8S6avpWQBk5eVxujraTQdrWg7h0v2MVhpKsYQ+Y/JE11ZaH AUnSweOLjH7WVV9FzaOfNutbnkkowLp2EKvKubPJFfSiYjLPWekG3eWFR1xevtKIomnC3c IXyWEqeRjv1pedvtvMwN7xI/bAmll0c= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Z7q9x2Xo; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969351; a=rsa-sha256; cv=none; b=7QBKv9U6+NMSDE6FnWkjNOk8lNfPQwOjG/2ft9WmuQIeTkuvVQDw2Wj/WPzYoGyhlsDQKF CMDx3jHnU5Cv9DCDK3JRj9ch85+0uLhNSS0wODxiKZ6GpIf0S873g9TlF/mbt10r8UmYKN 8uh3Rcd2Rvu9jz78r6aRoR+cbTqHuwA= Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1a69f686345so21085605ad.2 for ; Mon, 01 May 2023 12:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969350; x=1685561350; 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=4OtNgWOkZ3LfZLHJ8GzTdJkHLxMJcmtHKM1yrsNlf/Q=; b=Z7q9x2Xo+R2VkP+SAoL4No5SPSbkqDSqv1O/IrhmxSJUfCVapYFLSqvpVv77DdaaNp 7xLFfeVlS+/Z0T5loFjBwxXBtJMOL0SomvnLpxrMgUE0H3Z2NwMVPWqjWZZaWw/Xtz9H bXhAt7jaDl6TAQEvatyLSYOokashb8FOV+mCaWLsgTEKm8FhtMTj/edGzjuLKaTQnJVx 0eZhRzcKCCgmZxOyeAj8qE7Nk7KdCTP6wyrMnmtMZ4gp104XnMq6z3YcmLmYurGQiyUb qQCTGhNGKLl+87vhFPVut1PJmPE/0ePjlrtCLEgAAJx+RTgFbaFyPCMZ3prXkkSGna7E KEcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969350; x=1685561350; 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=4OtNgWOkZ3LfZLHJ8GzTdJkHLxMJcmtHKM1yrsNlf/Q=; b=D9eAtFPYPD2r5PUQSLgF1Wk8vOEgxPI7wk6ejbgeTu5dq5/ivXqMWI1S966fOZ73dt exQVki/BEmmab45MqPZ/JOALReYvH6oHsTEzCDrRqf+a0dtF+9MejEQTyn3heL7i+CC5 bW01QH/V48gzUNhEO3dJZ9D083ASPu6mYmTET1rF1XNvQROwtkK0/hCMTVfAGreF6UxQ gjTm0XSJ2+EnIT0iYXxN5Dfd9Z8D2HhAKLnrbLVhtIYbMWdRH7Y6Axyz/rOov6i5n0CK 1opJBn1nSklzsFEaVGMJ7VnIH3brqLk2Oj9TmzALOIkdDDCqC5Zgu0RQh/Eeia4onmmJ 5+gA== X-Gm-Message-State: AC+VfDwNrqY81H9VYzXElE91o/osmb8Mr9aIKboE8rl7BMQGZwOJ20Az egFGAXQ0d//B2Dk8pnEH/9g= X-Google-Smtp-Source: ACHHUZ6ZQG7EefBUYeumgjpKENexw5lTdMP6ZEhxCncdw/ecXlC+vhc9H9rF3r/Lw9bkiQ71uazgBQ== X-Received: by 2002:a17:902:a516:b0:1a6:6b9d:5e0f with SMTP id s22-20020a170902a51600b001a66b9d5e0fmr14561274plq.17.1682969350547; Mon, 01 May 2023 12:29:10 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29:10 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" , Geert Uytterhoeven Subject: [PATCH v2 25/34] m68k: Convert various functions to use ptdescs Date: Mon, 1 May 2023 12:28:20 -0700 Message-Id: <20230501192829.17086-26-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: BBD9A180007 X-Stat-Signature: utuu8p91tqj5154sqyrtoarq674obicf X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1682969351-332932 X-HE-Meta: U2FsdGVkX1/NJfTFgJa4pauCC+gsMufZJFaPUHq8VHaInqlCEX9ZuZzP49AGAfMefBrPCpJpzltVRh/w6j2DHf0+P4lg0T+q1LO7iez3AEdG7WnY1/M5zkvBgYM3HF9e0/OGqqYAV+MJWw6G4OSk+muHlmUMIsCV9wCqk0AYP/+Ug/A6Bm1co6li7WUt3zZmSGYXR+u+ceoiJF3oUXuCsabIfV2y8nB2EkeMS/SHju2H69e7BHvv3Jeo9UhoFiks/pfWDJCt/aRMxK5vt6uI6MoW+havqiVcZrvNBd9IaH9iXPf/d3Sv3jj3gaK0uqiBk9aQwEHrVWNjXLr52zMpKzAhumAmI/V6JjvIJugdKpxjG9XDmRiDlvai/3L8c1iv7KCheTN8kzGgEARozVH+pGsaH19JQ/jqLO6UT8bU+gxdOW7+WfTOldCcEIzNK/7ESAXDPQi74/oJgmlvHupRDbo6DRzlKNQ+QReVaoY11s52RnhJSz9PK8cXovSVRNG01oRA5pVc81/haQu/Svx3J52Mq8UYCTN4/wIW4DgURDh2nrG6EOtW3fp3Mmgj4hyc38PCYCFZtlirHBBMmFRAqGTU8KlyAfnRSsre9qxeFmRHz3AKhOBle2Vk65Xyv5nUf2lR71iAlzQr9DRKxwdVBoPIugNMj8FF52yLSS6+hg8wV5mY7atcQ+nFEFwKKrujZVsAl5q1pIieP6Q5iSLLF7PZb3ionz5JQaZgFpFMt+bwkNlxYG7q0x+A2XBQb4DYXbvHyuFbXC0tsUsipLkHMhLwDfP9WpKBxizHlzpmwKQ+KvvKGvp14Ud2CJphKQt5n+zgbMmX9P4zcfVP1f4cTMw7nVhFnyzpiSS5BPainXagxwU2x+/6a8QIpEG70hpE3b0CZ3xIVSx6C/PCaagxwRNTQshiZPOJJRm9XttfqcyJ6jTHCeMW177C90Nq+AzrfbiTHDSPU8jZtidC3bF Oxoy8cBA Rd8YsjogENjPykGeC8Wwwd6cSrtjFPkeMB5QgflsbvoMCwK4cRL4kxYlC0mVwuInzN+dlFf5q8xb433rBKsyjpB7fnjHvGgHqINeTbOb3U9l83xrMJdnZ2ktMbPIv8ZvLQ9BQrc/D2r9PUWHYYthEU2XS+yV0AgMuaKl6QmrkYSmjtuKX3Z6JwzZ7quhfDP/tMtthEVU0L9cK2WD62/Yqshz97nro+eykZb+ZVzo9jq6dTrzKQVTUFRDohfFfdX0OA9dStt1o/QxMur7x1CBbzpbpH/ZHyMiQeLLhZtHWNiCz4sKvDCIv4D6MdmmrXv85JXorTq1hjI3yHPdfzWVEv28/803hXIuUWrOurZQrMz4pS35BR8djfHS7JIctK5SoBTe7W9j7rGpssFLK1WBF1daoetFo68sUi/HvRdsvq4prz1m7kXfZo5Nt3FVaT+DXXK1Y1d9tXL3A9k+Td+0bKnIguayiEpovuERoqDbsqtRfVhqX1FCKIq0/HBqCDbitc726yC+OSBupdU75BI1ZojdUsQ== 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/m68k/include/asm/mcf_pgalloc.h | 41 ++++++++++++++-------------- arch/m68k/include/asm/sun3_pgalloc.h | 8 +++--- arch/m68k/mm/motorola.c | 4 +-- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h index 5c2c0a864524..b0e909e23e14 100644 --- a/arch/m68k/include/asm/mcf_pgalloc.h +++ b/arch/m68k/include/asm/mcf_pgalloc.h @@ -7,20 +7,19 @@ extern inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) { - free_page((unsigned long) pte); + ptdesc_free(virt_to_ptdesc(pte)); } extern const char bad_pmd_string[]; extern inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) { - unsigned long page = __get_free_page(GFP_DMA); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_DMA | __GFP_ZERO, 0); - if (!page) + if (!ptdesc) return NULL; - memset((void *)page, 0, PAGE_SIZE); - return (pte_t *) (page); + return (pte_t *) (ptdesc_address(ptdesc)); } extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) @@ -35,36 +34,36 @@ 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); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } static inline pgtable_t pte_alloc_one(struct mm_struct *mm) { - struct page *page = alloc_pages(GFP_DMA, 0); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_DMA, 0); pte_t *pte; - if (!page) + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!ptdesc_pte_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - pte = page_address(page); - clear_page(pte); + pte = ptdesc_address(ptdesc); + ptdesc_clear(pte); 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(ptdesc); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } /* @@ -75,16 +74,18 @@ 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); + ptdesc_free(virt_to_ptdesc(pgd)); } static inline pgd_t *pgd_alloc(struct mm_struct *mm) { pgd_t *new_pgd; + struct ptdesc *ptdesc = ptdesc_alloc(GFP_DMA | GFP_NOWARN, 0); - new_pgd = (pgd_t *)__get_free_page(GFP_DMA | __GFP_NOWARN); - if (!new_pgd) + if (!ptdesc) return NULL; + new_pgd = (pgd_t *) 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..013d375fc239 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 { \ + ptdesc_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 911301224078..f7adb86b37fb 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)); + ptdesc_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(page)); + ptdesc_pte_dtor(virt_to_ptdesc((void *)page)); free_page (page); return 1; } else if (ptable_list[type].next != dp) { From patchwork Mon May 1 19:28:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227945 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 E512EC77B73 for ; Mon, 1 May 2023 19:29:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5BB6A280018; Mon, 1 May 2023 15:29:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F486280002; Mon, 1 May 2023 15:29:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D0F3280018; Mon, 1 May 2023 15:29:15 -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 1DFE7280002 for ; Mon, 1 May 2023 15:29:15 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E59D11C706C for ; Mon, 1 May 2023 19:29:14 +0000 (UTC) X-FDA: 80742674628.08.E5491F7 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf22.hostedemail.com (Postfix) with ESMTP id 209F3C0013 for ; Mon, 1 May 2023 19:29:12 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bIC3wiMr; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969353; 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=kyicI3UFSJTH3R33HGjLFGEyUDrTPXlIkqJCgIfzdrc=; b=CbTjAdjUrb+sH1SZQYx1lFK9BfLNZ5u0uHHucPz/IGcwo6UNr5NnSe1SHQ33MKKGRHxqfB 26tmmHI+clx4AjrgrB3Hrv/jgUWH+U/1P87IYjboBg6PC5l0qiWT12JcMrILTFO5kvzCOV od5rKQvQUgknic/w9r/CqF93CNkRmX4= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bIC3wiMr; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969353; a=rsa-sha256; cv=none; b=1Iva0lGmc0qRgrJiZAjG+9rZXQhKipwIjtKcdNOmaLE61wTa/MTGF9RxYwMJ4fEf0Amc4J kOeUbCptZVGp3uPYUudJLjEcGA26o+6S2G8KpUe3Sy4aj/GjsDJzezPZwMJjzgBkf26p+Q EZl7QXUoGP6Z1jm871PjTe6YIdjDhvU= Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1a6ebc66ca4so21091485ad.3 for ; Mon, 01 May 2023 12:29:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969352; x=1685561352; 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=kyicI3UFSJTH3R33HGjLFGEyUDrTPXlIkqJCgIfzdrc=; b=bIC3wiMrkZ043YRG29tisEfS2j+UeOAsmyII3EDzrldtjEb8icghvzgUTYdQYM4doj vdu0JKDKQcL03t0/j67MJsK3EMdVvlx3Lc/9NrJJJYh+5KdPrYzRKBiHtTGqpBRhkA5a ZboUsEenHMS9VrUn3gKI66CrCL9Z8GCruZLIMyl89zj2oR4Tg7uJGI/BsPQUk9uXq4w7 IEqVWzOt4YqC8i9AxlAbu1JP49n5XnekAOLER4FSWBBd0M0ka47bttpu+oGYYPDkowKQ ep35YwloCTCGYeII4Pobz7D0t4NcJCq50AMppyxrvfN/Wt0IBRqMUSxoDgh1JHSYp5Pm g50g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969352; x=1685561352; 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=kyicI3UFSJTH3R33HGjLFGEyUDrTPXlIkqJCgIfzdrc=; b=YxcWqlS0/ynq4FHzgW91+Mw7Gipm5ha8Vd2EfbnJDL6GqOS4uZSY/mQeVWdi+7cwMy 0hWIoTzP3vgyKMADEq5n39HoGl2NdLs0dJWq3gzhUm6MKIA+6IvELqnWTK/w3HNWcwGF oBLUJvxWb72Wko/UtLmIAoJim7bYBeNCiIvGNrK5lq6BSAdQnmUGzYQgsOzJxLMa0peh LFe2e1mBWllqlNNqWzl+8NRi8moNR+qg+Flk0YfpE8GYahXjTQcnR0AGGnstGrftRTAY D4nLwb446rHq5htYhCsnzcrLO+aLPJ678/09IK0L4jz4V283sq6hUy/naVyygzLB1uRw O8Og== X-Gm-Message-State: AC+VfDx+Ms2t13kB4vgT0JGEIqePc/3JAFQF8AlarHI0FLES/27NJ/dM F3gkGxQiZZxn47LJq6GfV4w= X-Google-Smtp-Source: ACHHUZ6JGwiASceIv2N+eQzagLfWHlR6lj5LsM9PIBmbvfqlnJYs1oK6NLyKl7E/zGC8k10AZHOifw== X-Received: by 2002:a17:902:ea0b:b0:1a6:3b9c:7fea with SMTP id s11-20020a170902ea0b00b001a63b9c7feamr19311944plg.36.1682969351902; Mon, 01 May 2023 12:29:11 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29: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, "Vishal Moola (Oracle)" , Thomas Bogendoerfer Subject: [PATCH v2 26/34] mips: Convert various functions to use ptdescs Date: Mon, 1 May 2023 12:28:21 -0700 Message-Id: <20230501192829.17086-27-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 209F3C0013 X-Stat-Signature: ze8jmsf6tnfro93apm96bfzrrsconiec X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1682969352-477165 X-HE-Meta: U2FsdGVkX1/wzIO/hoYLDID/wr6n7WRLJWvXqq8v32to4T9z3bG+OQs5CMKB/3iRlfYQnRWIxEwxyzbspe/Yy/AblT02pqxnmXjaRVl/c4/mRFUVMGLChHBOWAJCY45yJ9a0mJAYr3bHziyzyQl5/p1U6VU20/nPCG5Swbh7Y5G3lXN6NcBIwgvoOQUyJGVuVzAst1GxtmpIJ+vWl1p/z+VJLyE2h7eAAQRcTiLqzwdbsjZbby4unxzoK3RM68WPdcsa033j3uksfbh9djuB6KEddzOgeUi/MNSTk/q8oyUPuhZrP0rkyULVT7gePKigwMV8hNUFQokWCAlYJTfPMTGXw3pOET8EeG05+vYg37fCQah/0xo+V90NWSKWOhN54wIK46Tah+JZs5k52ZN99fO6mEKGYhEPZsd+OWdbEoqNh9cqJL70MxS0ZPw//gI3HCGgh6v0rDIx10rjXphtzlYmrHxuhAt2y/WGs2D2Lg9e2mAv2rOywcKtK3zB4xO5dQZuxpAJ5b4hgEcYKVd6agoDm8FWcbSCEJ00AAsg1EFlr5uoMNDcXXAJaRR1NMRKBFDoXODmUt9SBV/ObCSyiYVr8rOrDl8LHB476Pw7nRfp5rbtfr005hWZaogKwOkbRUdjwo4vle4rNPSROqwiEghMiXjj+MZk5uPFMJwDLCpRh/aGLDKWvft3Hrehrj0kpstsGHSNhh0ahe71eGX50AfrMcpYD/O8CehZgxPLE0PslMcSabAuRHnpJswRnDCBs1dAF+ICFC2ZrTN9nk20UCDvPD2536/ACvrP/Lc2YKi+YQs18BpxY0as6z7O59WugT4sZepAHvGMMwVY01KEWRFpdzt9UViccuI1qhR7+t6Ds1kjly1kBwdMSqxLgVU/7o3UQcEacPy0Bm+zL7sK4iE6f658nDDBL9t/CtqUdb1mrxZtZzeKT3O/yupqhkyihLp8sqiB5eoZaHPvCye GfeEdFyA 7PloZGjQqojZeeDVcJ1JynE8mKS2Z63pXdnLiK1G/mmTsGvBVYAzm5BWmFUMCj4PTPiEH8zjA88W3OVKGpY9fuenRy8uxYZ3qx1oZT/t/npQw2DG4imX7XTV8zLZ/d9D5xAzF6DU+V9k0nH2RnZpS1a1axQ4hzFr6K3+xoaXQvkINGfOEqWZXVsNE0jYmo08knXjG7ptHvtcDD3aWM9DndmRlQR8u8IPsh+dorPW7IXL6Zf8dAvgLvvjaBDtOyb9HbCmHtnR5R64HCTQt7Ob93ftxVW9Uvo3X9jfMKrhKkCjVUPuemvO2MBHe+PmgxpyZskALbt3qLswApGoV3D7jyMUohVTZhosbeqP1SiMglDBarD71lG+6xU9tQ7Z1YBM1WjibIxfTy70hG5XcWcxxRQh+koS9wvmb6uPtPYKcoNlZil4yuzCyvQQwoX8vPES/4Vmt6Mi7nV9gH1wJen644N/R/HMDhskz5stwllo4GAUI5fnP1ziL25Tcx0LfEK+VHEAZF1sX6f30cDLKlUv+TIGgmA== 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/mips/include/asm/pgalloc.h | 31 +++++++++++++++++-------------- arch/mips/mm/pgtable.c | 7 ++++--- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h index f72e737dda21..7f7cc3140b27 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); + ptdesc_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 { \ + ptdesc_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 = ptdesc_alloc(GFP_KERNEL_ACCOUNT, PMD_TABLE_ORDER); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(pg)) { - __free_pages(pg, PMD_TABLE_ORDER); + if (!ptdesc_pmd_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - pmd = (pmd_t *)page_address(pg); + pmd = (pmd_t *)ptdesc_address(ptdesc); pmd_init(pmd); return pmd; } @@ -90,10 +90,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 = ptdesc_alloc(GFP_KERNEL, PUD_TABLE_ORDER); - pud = (pud_t *) __get_free_pages(GFP_KERNEL, PUD_TABLE_ORDER); - if (pud) - pud_init(pud); + if (!ptdesc) + return NULL; + pud = (pud_t *)ptdesc_address(ptdesc); + + pud_init(pud); return pud; } diff --git a/arch/mips/mm/pgtable.c b/arch/mips/mm/pgtable.c index b13314be5d0e..d626db9ac224 100644 --- a/arch/mips/mm/pgtable.c +++ b/arch/mips/mm/pgtable.c @@ -10,10 +10,11 @@ pgd_t *pgd_alloc(struct mm_struct *mm) { - pgd_t *ret, *init; + pgd_t *init, *ret = NULL; + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, PGD_TABLE_ORDER); - ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_TABLE_ORDER); - 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 May 1 19:28:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227946 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 7A393C77B7C for ; Mon, 1 May 2023 19:29:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A26CD280019; Mon, 1 May 2023 15:29:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96A4C280002; Mon, 1 May 2023 15:29:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82736280019; Mon, 1 May 2023 15:29:16 -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 6F4AF280002 for ; Mon, 1 May 2023 15:29:16 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1EE1414070A for ; Mon, 1 May 2023 19:29:16 +0000 (UTC) X-FDA: 80742674712.29.AEDE8B1 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf12.hostedemail.com (Postfix) with ESMTP id 424824000A for ; Mon, 1 May 2023 19:29:14 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=sCYdFD4O; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969354; 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=tniPUuVL526Jec1TVIaHRLAUx7OruO8jRIKlA5wqt8Q=; b=dbX5W82DAVyzddiMe85oT/aFzoLHfVgOqnvXQwQEQ8BqMohunci4vFfpmgNlrcvLQryPZT OkRqQ5f8kVjJHfDfZ2Jy5cPg2WTigJqcVelaCtG+2PUFmISd8jpVq/TOZ+LU40uXhJxqFA /rFr6XxiHk1DZB+knKqI3tcBaCedrr8= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=sCYdFD4O; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969354; a=rsa-sha256; cv=none; b=TRzoiqTVt23D8rjrT/YFphWgaRoNAsHQ3vVDe1aqjbP9VKSvWMDDI1rb6aqAIhjCbo+Gqr Va5LBavQ3vHkfK60RAQ5A1JWeLtQ16IUWKtQRLLQzs6mndwVyPerUnd6mWldv9lPUgS9tk Mh3wvEv/D3iSMOLZnJk/TjLsorPSEnk= Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1aaea3909d1so17754445ad.2 for ; Mon, 01 May 2023 12:29:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969354; x=1685561354; 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=tniPUuVL526Jec1TVIaHRLAUx7OruO8jRIKlA5wqt8Q=; b=sCYdFD4O8Had2jReQPDULWIb6jXMWTBVOP1xIsSQDJFrjK4Unzq4xPir2vv9xD60ba KhnmERHxh4wjne9PTfzHFe7mUKtGQVGSRxsSTI7oGHQc7fKexIRwy4BhAuhQWGLGw+L4 jhaBOvefDEjvTltxe1zcg9AOJCenWnwtbQvW8h9UKrmrEmLrYzROLydP0XMIyNyplCDF ksvZ9Q2L1rfMSznCSwk+WHikKvzxa7zVAjndA+MUieyvTGKh0Hnkx2VWar6ZLI/SEpj3 zJ2Emm1btVtqn0B7TpGayRWt9h4mLeUHtWruxn5Hxr1lyas/Ibpq/YOzX0vO1bUnoNNT ju/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969354; x=1685561354; 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=tniPUuVL526Jec1TVIaHRLAUx7OruO8jRIKlA5wqt8Q=; b=ix3GHcsRLxpWgc7BwCpwQcChjtt4u8TsFwBgTykYcqMPrCed5Qn81bufMjoWVFc1Oy OyNA1qHtxBE1d5VjT77ObV4pErg7kwF7xrDEYFLvV4Y8VTypNeUpbyB9MZwBp8ETYdSS YYP+kRLurGAwtFLU4JyzImpwxq0pJYjt99t+djy6j+nYX8gxgZq5dsk3c4v7DHYFYjcN 9bDJ042NxFKpoR5vKln08hMTspyPRKTopiMZknFwEta+kEQwfWl9DL9VpNK0cwwhP09g 2vFc5oSANMmpNS3eyMH2bS8WM94dtwtXlXehouI93AEc9O4oLbiUjm6J2IZd6Xdh75mA gwGg== X-Gm-Message-State: AC+VfDxV+9KPIGQeKld6kvHoS6gyMT2+RYTxjjjFUi4sg0wFIoCqDKco iuoarja7SGSWHAn4EGXNS2Y= X-Google-Smtp-Source: ACHHUZ6fkDxKllaaORZgzXEjR5COvh0uqYIPMfHZHm801Tjdn3OT0QOppKb8hXtDeBwjumbd6cc2Pw== X-Received: by 2002:a17:902:c411:b0:19c:d309:4612 with SMTP id k17-20020a170902c41100b0019cd3094612mr20785827plk.6.1682969353666; Mon, 01 May 2023 12:29:13 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29: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, "Vishal Moola (Oracle)" , Dinh Nguyen Subject: [PATCH v2 27/34] nios2: Convert __pte_free_tlb() to use ptdescs Date: Mon, 1 May 2023 12:28:22 -0700 Message-Id: <20230501192829.17086-28-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 424824000A X-Rspam-User: X-Stat-Signature: n8umb71c5ueawixsyyp61p5h5zk4dixk X-HE-Tag: 1682969354-946976 X-HE-Meta: U2FsdGVkX1+nnAtQV9ttHoZydSUExZkg8YAz50wez1tWAcIaEhgPxXMO/dYa1CAv6FpdegSnqwIMdXTrIC9t+S8iYpgIl8M7G6w+r/2U8WyE5SUgdp3x6fzZB59mVqokob9nk3wTmf/6MP0V6oVdZEIfqayBOjE4YkBcNLLoeWEDW86lnN+qmabxwLyXUbzVJa/pgtoPDOV2wpcRCh2rnnIUBRlwUoaUb6v+Y99GsMMMRo2Jwf7BqOSacua15Yzl21EhTrW82on/bCnOwxMsQLuWN4E5tTskNWw/s8khGNx/ZICGDAjyYQgHRV8yOK0ytUtfDzpji6Ib/GEQdBiU076LVroWVoqwM5tn4OfprtbJyZXAk2KJO2yLZBaVVS3uvvPd5q1Gj0zN4ChsXim+74HjEVxcSVYcbV2sch46C7a02pqRsqo1g+jSNFmpcgv0biLlqbZfmWfvs10MucH/C2THmRGkAbP7Y0vwP/GT1TJaP/rcvrxHXlVgxggMX5hL9g5Ad9XPqZekO+OuxTVaae59ivcsUnXcVfG27x9IGuPKqVwPQk3gSyBWKgqb1PBAb1DIn6MFeZyZuqE3biSEx4KCIogw4OwUynkXV0kwtUzeEQctC3EaVPUjeNltYy/BaZCxxYC/clLksxiydMT5/Dk/Pj/ZUWs/whHELdDXdiiw+fauY8JnyStZYegYsQMhmR0SJ8q+NtTAINZKvJogRulVWdF8EmEdK+UIUZq44GgOd/4Srjtha0ZZLX+qLmpvCcp2nXMVAnPB2EOubPYH98DnotNcmWatqyCkS6LLHyW7P4uDxWjKUb7g6cBzdt730onYd7YzhHfDXP3e51ErwYJgLWpzbmFo/AmMVbii1TLo9FwWvqghTLxVENHEeSktip4IerlYoPRhtr+/nlGuRdHKQpdO8IIWaK4IF1ot3TtJQxvfDiRsDmFfJbS6rxNFIjEXxo93UpVJpRD+7sO p/HanP6R DNTEuecgZb62mF6sTiGWqK8VrjhsmBEtSge7tGVEqgV2GnFPqHD4wQ/pejzRfWJVNW7oefUC/SOAXB9xsuSrkZTDvnrUYNS941vp1e0Us+0N72NaZ6BoX290iK/iSRk82T80tfywQgYk3V6u2SdvOZMCi0fjzHFG8FDqXeLXVqO625E3WGLuqZqHpPnmykY4Qd97qzktwjnagDxLZkcB8cMu4fdUtOVLmYNJNjDED96dcuTBxh7M2Xznm9O1Wc2PZi6LAy9fKRFoTqcSBy8G1moai/3ZXmFdMPurpyWWRVB4O/NxGEDJP8oqojmSZjhzm0XzhB3kuZykWmj3TdsHnE8zmRdnEw35BRC34Ew05IZLSp16JZ2P1vbs3zHgay3lTyOIi3I0HrXLf7XZ/0kk+dr8GUHQ0cf4o2uT4v4ywfzK4Wsfq00CfoE8O1GqncToW5bNi1UvUlY4QMjnokK9zDpOfzKx9V2xRjX/vzSLcseZgl7BwkW67f7yEC0yoI5fRaa5UnpKL5JQiFbjI386A8Ih2EoVpRJ/Vp4DaBq184X7aeU9z/4nMBnQwK3d/sXtmNcSQdPcKzP3lnyk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) --- 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..ed868f4c0ca9 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 { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif /* _ASM_NIOS2_PGALLOC_H */ From patchwork Mon May 1 19:28:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227947 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 4AC1DC7EE30 for ; Mon, 1 May 2023 19:29:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD0A228001A; Mon, 1 May 2023 15:29:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C46B2280002; Mon, 1 May 2023 15:29:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B34D528001A; Mon, 1 May 2023 15:29:18 -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 A5DC0280002 for ; Mon, 1 May 2023 15:29:18 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8107BC05F0 for ; Mon, 1 May 2023 19:29:18 +0000 (UTC) X-FDA: 80742674796.08.B5ADC19 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf15.hostedemail.com (Postfix) with ESMTP id A0ABBA0015 for ; Mon, 1 May 2023 19:29:16 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pbOgq641; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969356; 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=M2PCFvKq9JWcIC4Exd9oDYO0v0PQOHyXRap+yEgbOb4=; b=ka4qchxkkgHmheOQbt41FOtta+aMIQ194oFqYXxeK/YUlhRW4bX3S4TSyeyXtod0CHKvi4 LwVi1OkoOCHe94mwLyLAHwYtFJksAeMQ91ICk8v1k3g1TExbO+5ctzL0PV3MQkvEot4/n3 TD0YPXf9jCGanYuZUZy08X9Fs0bNsGA= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=pbOgq641; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969356; a=rsa-sha256; cv=none; b=N8G/YGw/EAvcKEWZGXTFvoJR1V3TQ4y/Kxt3HDL6Irk1PqpXFkSNBolCkPaNuCyySvAUf3 M1O4024ZKdrjHRATcdJCIZgb4neqKwwiqMmR49DO1H83Z0shv/Hbu6lGlQCsFj8wwmgbBq PaZSu85siOKNomRqbUIWdnkHS5ErWB0= Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1a66e7a52d3so20941135ad.0 for ; Mon, 01 May 2023 12:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969355; x=1685561355; 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=M2PCFvKq9JWcIC4Exd9oDYO0v0PQOHyXRap+yEgbOb4=; b=pbOgq641Q1VbKkWYpSKEOBTaJbK7N+gn3tPQxAnQMHVxsbuYS7d6gCFZWWRyAoJPvd QWBoalX7ztTkXy1/S77S44wUsaYiw+c9l0pjoAvj83RwanS2FHVDTD9b5yLt3dvSiRkC Y6FbuRkXeTez8mU8JwqFdJ8q3udPbLVyCGPniHNdmE3Bvis2G1N5Cf54GBHK19m19dh2 ECy1qDfhwNI4K2KlZeZKdUsb//pSuTNjtcr9BAZz+ZE7jjtZb0g8W7o+eLshkW2fWRhk rjbBHucvZ06kdc4e0Uijz1mCvV4V1RY1P7Hdmh8XbAUQYZvgzIuSpNmzClPaEZvw/eBL VKvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969355; x=1685561355; 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=M2PCFvKq9JWcIC4Exd9oDYO0v0PQOHyXRap+yEgbOb4=; b=LnTtBS3zffCHO2qzAPr4DQwyjYf8uGOMstbo2hTvWJE/RGrvuPdxnO7DNyv1s5S+cC pR6N1IQNzl5ZlOlBYF/t2z+ONsQzlL2c3VO1Px1285UiPlGFVdIAKJmJ6pObw5vTUflv rlQvy6ZFLro6H9yVLQEBs75Y6lSIktVYm9sxlsG9OBsStFmBfYVSQN0aWWS2Gg82/SCw cUj4EcQ/PMRNRx/AfcAyGuGgIoCMIMhjB8OInrEtKG5SCPBjc8gjAVVnPrEhYFoNh54o RAuz/7oJUvxkdx8lhb5x0JXLOCTy5i93fvqW98zBmhnalqJhRr6aV0Ve5b+LaJDF4MBD /rGA== X-Gm-Message-State: AC+VfDxytjF3oK/whH2/bRAUg/ia/AqSbjNwteQjvOiqbPYo5bYbRrPf RFPsMk5t5HoYAebgdXRSJKQ= X-Google-Smtp-Source: ACHHUZ5aUwQpmXFq62IOwkeTiJiFUSz6Wt9PaXTxNdRH/kylJwLUJvf08r71LifeGRMo3EYnyRIKBw== X-Received: by 2002:a17:902:dacb:b0:1a8:d7a:9255 with SMTP id q11-20020a170902dacb00b001a80d7a9255mr17869996plx.54.1682969355424; Mon, 01 May 2023 12:29:15 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29:15 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" , Jonas Bonn Subject: [PATCH v2 28/34] openrisc: Convert __pte_free_tlb() to use ptdescs Date: Mon, 1 May 2023 12:28:23 -0700 Message-Id: <20230501192829.17086-29-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: ck3mabkopcqhrgnrx1hz6pwfyjut884z X-Rspamd-Queue-Id: A0ABBA0015 X-HE-Tag: 1682969356-42688 X-HE-Meta: U2FsdGVkX1/RFwawJYsB14UBOEUxe7YtvOcvbDsbCA5kXJq9uiU1+dwClz4SC1Zj2s3vNj5UMiyyf0yYf6i8AIRBtsA+FbaQB04iOH3yUv8E/Ipy1Rf1Xc5SczzGx8g4Xk8sCUP+cfv+uX3gCNTZKo7jFOCuENTtFIR1qckDpTwnNwVkY5JbzBiL3vVcP/obv9xr8XdeqIpc7xheOO/iEFDANssOnJ42MbAuneBPTh4SHZit/umonBjWs236L+lVa+Zccy6ia1Sq5Fv2AheDqoLYOBDdU4AIvS689Tvl8o2vmqpErVW5ajzXcUMgBg3zTTJHmrTsk411PHNZsFKJ3tdYMAWI6OPYdsKGcPkhHsy4QXYha0l5Xes7j4iCf+UQWLVYnofoa/3O3d4lckzR2fbxFK70rj8vJ7+Jtmslpq5B/6OqbiJzD+cDE5VXvPhIao2cDmp25Wai0gLpdVJ9i1/zeWgTBkR7iJLMKN427a5/hIPi+5fTskLYo3lsZ6Iaaj7ca853BCdQb0layVkqNfoBCcWRK3ScN0DbVAQX1ngmAkIoRxVEpgzS2sazZkHcPkx2OrayI1SJJHjYXWrY50avdLb3bi4ifu75sml36rd+Qy/DXKIcGgjobpxKKcr7+0Lq7OvNOP/3Pv4MDG/b6R1SRuRwKcx39duJSFrVjDk4ilcvsEDsFn1r3vTNnJEt5G5E5AvQBv9giy7rhZETOvMcBybTgf5TOTu7Fmz+EJDxIFljL+Pi9HXbnxOOGikuhGigeAvu8hKQ7oGu3B3TmWxc4nMiuHd7OoOW3oPz0B2A2Ga+VAldiFUo8LL7itgy712CRTeTPIkDioHXi4NzSXtCkVQ4X2BayK0IY3qBGBTe4BZs/j2Zh6CehuJwXz/dGY/SwOh2AND2xFiXYNVO6nT/zuUUSfOgt3DWOhQsuu2x+0jwkUznhWdNPIJYx/Mz6rKCvgiePpmGLV9NAa8 u6HGd7We B2gtjYxjEdR3iM4rAF55qMNhQI5KsqQfgzEyhVIn5e5DZaP8mj2ay5zhJblQHfKqUdsz6YRk9xc+l2wssjw7SdyY1tIgOS3lCQd4lpTVfadoPKOBVVJABd27ADonwLLeDPw89VcB1HPMnflnerjcUOsu4kLakXRmenTMQ13izN+Ws4tyWpeEXTLAIh6A9xKpXMRKY9mjdN34og1zj4dYyAz+0x+j3usJyGbuRFXXxvhweqGrBKeuBAKpSlGuCaTEM2RoL2mOPBcE25fX1/QcRA8G1WFys7meB0XeeTPemkaa3SJ99XxLYL9Ovg6Qv1TgQ3p0bxLhOek6fX00ICjAek+4ijtheJNSpaMoiMo6zRFJcLREtHzdRtLCCaWoshmI9aJYvopxAb5jnwLV2VZANtijWl1axm1sABXLwrfNziK++yz5DT7AHeFqy0LLm5N8HMcrYG8G2u6FMpsGyvyxCt7X2TNK9asHCTYT8pXoztrzwKgf4RDbrifrvfecg/zOYXi8y95DGuQEGMeh5xJ2K2q3jxXD3DnUXlgEwspWRzOEyYRnMyklA3o4/9etWq8PMyriMDjWD57DGONU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) --- 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..14e641686281 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 { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif From patchwork Mon May 1 19:28:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13228030 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 0A300C7EE33 for ; Mon, 1 May 2023 19:29:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3222828001B; Mon, 1 May 2023 15:29:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D2B3280002; Mon, 1 May 2023 15:29:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1728328001B; Mon, 1 May 2023 15:29:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0791A280002 for ; Mon, 1 May 2023 15:29:20 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D415C1A0818 for ; Mon, 1 May 2023 19:29:19 +0000 (UTC) X-FDA: 80742674838.25.F69AA3B Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf03.hostedemail.com (Postfix) with ESMTP id 1F54F20015 for ; Mon, 1 May 2023 19:29:17 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=QOhINfLs; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969358; 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=l1ckLKbyzk3TycCfORfJ/TBkh9kewWK+wgbsmWovkLc=; b=CJdGMXSq03r8qzLYnCXRljVqzWmBdyKzDpMClpSYneWHK1ehnTaUGstZBhaSSPbCU/scUj bYR8tKgK7wt2dxF9HbL2D2pQs0ntrIE8ftZx/4QtPrWT610KVB1UusQRrUrKlfm5F/ysbM 4sRxCbFZmNqNQFy6wON0ks6ta2h61L0= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=QOhINfLs; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969358; a=rsa-sha256; cv=none; b=ij0wyIgz2D4AhiUMEmFxunPGkf1h5lt5wfrKtwx/6IGBHo2YAOccK+iR+xEPGZocvOCPnX E3jzsTq7WD3wjaxxD1wP/c1p+GVbTRhGl9QXOH8DyKR0Y5rCsJc4ABv4Zv0wvdv8Mab2sj NxYSXf2ArdcFCgYLCbsvmtZ/x+rpAIc= Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1aafa41116fso8346175ad.1 for ; Mon, 01 May 2023 12:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969357; x=1685561357; 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=l1ckLKbyzk3TycCfORfJ/TBkh9kewWK+wgbsmWovkLc=; b=QOhINfLsJScPCSo/IfeyIyqWMqeIs48D8yaoqlS6ttjMbmNZXsD0pl2iRSwsAXqRrv zUUJOXK9c/ejP/aK8PhIumKGyTM6wx4FMhZyB9B20DcTQunSql+VvjSwHErAI8TxAw4R Y99zvhqhTYwxHGbhjSdsPxRy9B+yD0izY9vTuFFo+4wz8Jz2C37zAT+8c8EYp2fDz24U oGrB6CUieeF0SbwTG14XhJhloKyt3nzbHvCyZJJU6u4aL5aKMUavEI+jK4qMtp6ZB84A TmLf+lTqOkVGEF+wZ1coiBesyT5OIE5Gk6hWNsWKJwTKVv0S28KrIjiosst3fU+17ZhU 2bkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969357; x=1685561357; 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=l1ckLKbyzk3TycCfORfJ/TBkh9kewWK+wgbsmWovkLc=; b=P11aIZrZBE9tI9nTbVu4u1R7TSmS5gMYlDtXZTDI8aYZ76G10ZKcCZT/H9GokCd8t8 x8QDKJE1Fl9kSgn9y14qJ9/+ZpcFg4Bk6x9lE8dgxZiOIl40+Es+CiZxXcTRf/Ai0mV5 udgO+1fNwo6qGkN1393VInnzOdWU53NDETnvWGifB0Oclb9TQc00gGoQgLX7tQN0UBoK TnvzHaGyPq8V+ZPjCjJEb8k23JbgOqLqH9N5IYTdMvX89ZLqkSrGDP8LtP4Bq45ucZbW AXjJGjjpjkrdOCkySKxLaqBWEnKbYQH4eFbP82GcsUatDNWkE6wKzBuWv1LH38wUyQie Ha2A== X-Gm-Message-State: AC+VfDxv8rVuXLORaK0Byh5d3hQ6qKwvNaUxZbTd2Cl5K/PqkWtbM281 SyBZn8EZKRTfGPGsvBjzKRE= X-Google-Smtp-Source: ACHHUZ5ad9gvhcfa1XbL+pCFsXQ41wyEuU00A0VqKiT0180mGKgTi8tTwjBbR7r20yn6kHE8l0iQaQ== X-Received: by 2002:a17:902:ce91:b0:1aa:ef83:34be with SMTP id f17-20020a170902ce9100b001aaef8334bemr6350222plg.47.1682969356855; Mon, 01 May 2023 12:29:16 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29: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, "Vishal Moola (Oracle)" , Paul Walmsley Subject: [PATCH v2 29/34] riscv: Convert alloc_{pmd, pte}_late() to use ptdescs Date: Mon, 1 May 2023 12:28:24 -0700 Message-Id: <20230501192829.17086-30-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 1F54F20015 X-Stat-Signature: rfnkgkayakuztqffo6whoe4w4gmsqgxp X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1682969357-232988 X-HE-Meta: U2FsdGVkX1+D01zm05/PuIS09kLxq6uTrPnbP+dLfHCcA1asIVw7ag4iY+yofjCziA1F01xyKrLwEx3fXYAZmCfFTTr8n9EeSmH92kYfKJC2uEFzvf9v+f1XSalgJs5HDf1rDSYG8e8C8AiTgwsM/yAxW3YQg3LzzgmGUMoZs2ymnlEogv4jXdnzZOt+tgoHgqE/uTCjtFznGvoU7/A0lUkiDFszel5wHK6DTahcNsLUqvVd9TWQmQ1fjuPshUaCz++Bafd1lWQrANg05jO1x2otCoCHINK8Jom/PAwTMXOmA8sUgPHWbsoOvLLYz7f9kzHouM4DgCeQgQIh2jswQ7z5TlpeSk7pdlzipa7S4eGq30mVXYRAXwm+UbqG2HeWXT3RVLO/nDIeaTJVg6M2l9GATWwdS/F6LpkyhBnsfbRrV4UvEJ7G96aSM4Flqx9SSp+9FRRU1BVEM7BnZ73E3csp1uZE8BE7nMpnYiO7taZXKMsyGyI/KJm0yN3RVALNBUm9kBPaZVJkFzjwmlV8olZzyKGL2d6MVtXk42kaKbZTON3fclFZGYbseEVSFwe/Tkg/k+KQrzOoARq+jLPp4U36/G4tbW6Dc1pew0xI8lmMpnbkTwfWvbFI5z+NgkKxPm8F6aDK+J2dL5t1vAG8oQzDXPV2xEOeI51RFEjIoqP/bfX6u5To2mvfRIMPmTmMStejkXobmR7ju1287Ixm4v62wkddCNdfNN7bQEkPK6hTxTOu03tEKyibhOLB2HpXPjMWcxSaXni+N/CneLYXJlmQL0Es28b3W4U1//b0GnwSr4CfMpM5D5zr32S9vsLYJ69ac21i4M07Kk0hDMgVeD0GFIAp7BkAoNeWfdP4Aw4I5hXioUg1L1ihETicgAhdK3i04jg1zjubZLQ7nNM/m19aaKi5ZeHcIDR8ISRrRGE5Ko5LTg523EGjbRRRoETrCh+bYFapArFoCSj4HGA bm/i2w4Q rALQ9gYs6C0zxHlQS7Y6tZ7lOtb2kkN/mVRrHGBBhQQ7x3NjVTpVv4ckq62TSavnzTRB0WF9VXEeBZnpWV47Q6bTADlk+TY3+sCWKZHBWZ9t8AG20bCHHidY95n3RyCV3xuJNBlJSUpiw+GT0Q+lgpKChZSSLpWeAhkMr2CVDULD86cANiuAnf3OxOEFqRmPpHHpJNXNDWXU61Y70fDIaKBH007x2N/IFBQJ8X3C2N3baCiwnNRqxwHZkadU25mBRvAirRFeiEarhgqrFvxKIUlnbXQQLanD1nQXHRCVjfHin/UDnb7PQ5Hf5ZZHbmf5Tl/PSP7VqRXRR41Hop6YI6hqcyr7ezzSb/qzskiWSgyHcdRXM+zEHWCJIH24aFmkYC7e8x8A8FZka2mWKiDrCIciecTu0Uf1B4XOiZEBiFFgthpRiQIRSLm/MULTPgERVaXRg1GFzfClsZP2EWyLlI9BwJ0rvWUb1HdilcsjnKLqIcWQMv+3Yk5426CZ7gP6ghsCc5KlV1Sp8scQ8ir3hUFKpLZDcO40bypGlxdkLGqCJMoprRYeht1Sog6kxHFMxwPhHIV8yrcFX0Ec= 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 ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Palmer Dabbelt --- 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..cb5536403bd8 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 { \ + ptdesc_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 eb8173a91ce3..8f1982664687 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(vaddr))); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !ptdesc_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(vaddr))); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !ptdesc_pmd_ctor(ptdesc)); + return __pa((pmd_t *)ptdesc_address(ptdesc)); } static void __init create_pmd_mapping(pmd_t *pmdp, From patchwork Mon May 1 19:28:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13228031 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 74DF9C7EE2C for ; Mon, 1 May 2023 19:29:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8043128001C; Mon, 1 May 2023 15:29:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78D4B280002; Mon, 1 May 2023 15:29:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 604B728001C; Mon, 1 May 2023 15:29:21 -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 4EAE2280002 for ; Mon, 1 May 2023 15:29:21 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 27F1C120658 for ; Mon, 1 May 2023 19:29:21 +0000 (UTC) X-FDA: 80742674922.15.6AF7058 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf04.hostedemail.com (Postfix) with ESMTP id 5536B40011 for ; Mon, 1 May 2023 19:29:19 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=AK+jJQIn; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969359; a=rsa-sha256; cv=none; b=G7d8W0OMax3mKNi+JH8lCwHE/G2nbt6W6xvwfxYz87Cgx2/iw6rXTwBjfrxAEsDGSItEtI S9tdvQ/Q91zCInXw1FVii0BieUTceXcs/YpPLG4OLGaZYkdL0aYWWpX60j2YU7qSqDpMPc MKP9UmR4O+dOX3Q+1in4G/RcGyEBLmU= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=AK+jJQIn; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.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=1682969359; 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=5aCjEZJk/he0B507v8WHbAo+ayyw9u0whNe5hSh1Qc0=; b=5vkL7xZsFSjqs8PldkFfaZI6qe2v9xO5EOpzgBvKKSXE6e5h8iMMZZoH+CODDDCQT13ftV 0GOygkYrCwLlHYirCuoSOttjfHfZjxRl0TjpPg4aGoShi53VvmjOxTZbm6i07CSJI88ilb xp24u63wu7iYby0pSyEm1VM6goc4Jwc= Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-64115e652eeso29041936b3a.0 for ; Mon, 01 May 2023 12:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969358; x=1685561358; 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=5aCjEZJk/he0B507v8WHbAo+ayyw9u0whNe5hSh1Qc0=; b=AK+jJQIndwyipvZ3j74RRrDCnGWb55RfRTFZCAj1QjfEP6JtcEnkxab8VHfUxlnJqD nzyDIYAX6jvOrQqc9g/TswPCkcqNA0B0b+SVKLMEmNApHkelPozzZarkoTrP2UobldQU E6NqDV1CfueV3wQaPICMNftiMflroUHircwtbGv3hyeRwqO/KqZCxi3BNAP0dk8lYID7 5OwqBACQpi+nvrf0goZMdOfhVuRwRiXsUHvkFH+vRl0eIOaoeix6IqEc2ZJsYZWlONhr qoO4S8rXijotpMJHxa1FWYbjKdY7R5WGEGDzLNmBq3rOIwjAHcvHuIBKVpOdfgv+tSJ1 RDOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969358; x=1685561358; 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=5aCjEZJk/he0B507v8WHbAo+ayyw9u0whNe5hSh1Qc0=; b=dhNlkoQOduav1dLoGnaFUkPWmFfTsTxnlDsW179w+Ae1LIJdMCdYiyAYFVbHpFdu3T n7t7OD7f5KGI2BhjN7K/O+fzqCdtV5U0+nmSWc2Xo1ev6zB6Kj1gMmP5ky6t3hkelyXL sq+6OaFK5q98CTLbsrIiSM+W0LjwwozQCAUhWb3Soe15Z1svr2Io0DVDCIZlz85tzzab wf+vVptDEmOWUUBboQNapLbih7lFw27TsqYKCSqH0+Gy3i2kdVdRIBc5CFiSg6T0z51t 7mCL4IMKazyTKXXSbcMI5SMSEEGqQo9yLf6neobIT93Ov07SFWgneQQXL4fgeEqP3zNz uHXg== X-Gm-Message-State: AC+VfDwNmyCxiG/HX97WpFwmHM6nXZWWRTcrlD6QNA5q5cDMo3wjZu// 52MhIS4Dvgzq1+eKWbWkou0= X-Google-Smtp-Source: ACHHUZ6t8R71ld5pjw9YJiJ63m1PjvmCLBjw2ONvK02V0vikRtqecj56I+goZm4GypngOeaNmv5J/w== X-Received: by 2002:a17:903:2307:b0:19a:96ea:3850 with SMTP id d7-20020a170903230700b0019a96ea3850mr18111173plh.17.1682969358236; Mon, 01 May 2023 12:29:18 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29:17 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" , Yoshinori Sato Subject: [PATCH v2 30/34] sh: Convert pte_free_tlb() to use ptdescs Date: Mon, 1 May 2023 12:28:25 -0700 Message-Id: <20230501192829.17086-31-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 5536B40011 X-Rspamd-Server: rspam01 X-Stat-Signature: cy6uc4phpkdw9scnfmt8csbf76bm9w3r X-HE-Tag: 1682969359-671407 X-HE-Meta: U2FsdGVkX1+SmMFgnU3kfmA1qIDbpzL7SVcmiRCzuBpRlCVJ6ApEtwDDTM6YCfnAB7VTwqMRS9tOgZeMC41IKZcibSJtGnb5hVJ8/1ByiCrgjTMOO9byy8ASzthNf+L8gtF2v+VojgdTt/De/4yVvWq3U0jQlWYz8buIKf+oJv6EU4OPnufxK68ZdtSfX3IDkbTZu/nOkB+XN20hxR9bJMeE64qInO0P/C8RGL8SHo/QsdK4A/YJtUMtNI5wX+d2XRS30++nVxcwBgU4pIxH1bdZlFN3FWkzAmn9I4X6IC2IVAFSivAor4fvOy6Mi75agc1XwHy63ESSfDEd5yTeKNbd2Ro3z3aqDS2afKgUtt7SCwBgL5L3NP7BBKCw1k/yAU8l1KqjQE6sI6XDWRTz/pGeMQ08/oGUEP5BZ6Z3XwTpRYB2ehiJado9Oi8OFBsDadvy53M9RSnJv34byc3+jI0daDiHjeVW9VfGmj/x2m66Gd4a2MTw9i8FEk5Fem0ROEm1V9UlJXFcmsgP9hlppX0OPHiJWQc2Z5H3yuvBSFBK/301gGX4MMA6QwAsmywrXlnll0L6pSNN12dxihWAANVqSJqhLSLkv5yr4OYirxY0RhHJc03TKXdTy7Bg5XggLNY7RkDgofVGxF/toIMpPsx6H+qBuKRsgsr70DGiBPtDeJgsUzsXY03+wOjK0gtAkxTdz9KIrN1sti8dT/tc8wST4TdWC0MZJN2GfPmSHpnnEdR+IydaOowv+kKp7v+J2jcfn2q+//gsTPzK8V08QUFmjEFsp5u8avWXS4iaTY/7QUynzM8v515jQ57yC/xlNGwSkHB6sobuYHDj7odOnYCiC4vqSnwQClFRxABZo6vfx8i6DDbY+63b++DLWUpN5P2BodusVFwUXMhtW9ZmMKxRLmhfFYnVdZlJTh/0RkK8jz0ipODPVNB9EzFPw8ioIqVWLC+4M+/Q7gFBJMP hauMmJUT hsmY1ZUu6kFUU/Sfrt0MQrZOCHtPwMOVtKFgTAJaVCH6VQzaMUWYGeInMnPQcBSwhwTk8pDyrrQzZ+y5HuFelRNcKUzqm/rjb/MkD8+rSvUCCby+VxHoaqbweijWq0ULhJy9xCNPKs9ZXL3am1t/8Dqk0XFzcL/jCImz0aeVCKnmqJNDGtXI0NXUuulFmk/vvAmb90zAAY+GYh7msqw4Akk4xzoIBOjgLJxskND8Cup7UORkAJLeEbrSwr+z63Oa6eojpnMzlzAaTdsNESR5IbjsqKWcUGDe7oshIf0x4DdyXcvUniCg4Dkil4YYxHuvTw2+xkZO+sIabIFEumqMDXUVED/8VMnSpG8sey7Nsgc0jMgPfgKQA1QH/E8QGsXTWnrUkNef9VZN4eKp2i5U6nGRp9zmYqUecJZwYRAbIfwvvqbT2aQMhq7sx2CAeAq117tvrLLNeVnNZnl5PO6Nst18x+WaAVdBres0+Vj/YjOlZSyrlEPi3jrwDnYFpyQOVwiVJBkvq/Om32YB9IPaDB13oKO+LmuMqgQjdRIbrawbvATOKVM81xnu9dhRkfqHPneImnEeYJ+S6qDA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Also cleans up some spacing issues. Signed-off-by: Vishal Moola (Oracle) --- 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..ce2ba99dbd84 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 { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif /* __ASM_SH_PGALLOC_H */ From patchwork Mon May 1 19:28:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13228032 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 152F3C7EE2F for ; Mon, 1 May 2023 19:29:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67B8A28001D; Mon, 1 May 2023 15:29:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 60738280002; Mon, 1 May 2023 15:29:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3942928001D; Mon, 1 May 2023 15:29:22 -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 1E255280002 for ; Mon, 1 May 2023 15:29:22 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id F390F14080E for ; Mon, 1 May 2023 19:29:21 +0000 (UTC) X-FDA: 80742674922.08.B35D326 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf16.hostedemail.com (Postfix) with ESMTP id 3467A180008 for ; Mon, 1 May 2023 19:29:20 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="JvPLlmC/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969360; 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=uIsUNYOwSPNxjYFxvF4LgB4Ah8JH2T7Nmtlw8Cz+gsw=; b=ZpGB34YjCEMrwrhnGE3LKYPywKcKH72X5BcPLSGv3L8iw0Ln+pZOoX0GJm10RF4SFvHZ9g fARneN1pcbK7OG4WKi5V1YKZXrN6ha2K2P9pk8NyMzcEUjpzyhNAoYclyEA4aYTRx90aV3 p/Q2coqo2H+RF7Mgx0AxYP64EK3OW2o= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="JvPLlmC/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969360; a=rsa-sha256; cv=none; b=bkoYEn6XUJg/vsI3y6gFiAwFQgw9tqoc/lhsDJoQoqi78tUu8Q1s64RKXnDpj4ZKvn0xCi /djjNIG0HIxgK3cwFXwY6aJUlNnYSG2gpJ3b7/JShAcFa3eDZ/YlWfPc6YYzcbhM2dhoNw 6pRlAYy8KEfdkb6NzXhC8NMtZr4kMq8= Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1a516fb6523so28452745ad.3 for ; Mon, 01 May 2023 12:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969359; x=1685561359; 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=uIsUNYOwSPNxjYFxvF4LgB4Ah8JH2T7Nmtlw8Cz+gsw=; b=JvPLlmC/XzUWqdECLyDwvfeLFLPFT450E92A3QXyvZyOZFiHjs0SqrfxeBMPzeb8LI K2VYtEv3r+e+UcHKuqN8TTRgEDMk5QiHg2w8LWe4aiFQNNV8Hh6df9gt7z6D8qxOouWJ wLPmS/k/ifaj+fNqHq4KBrLkalomexLgsPcDr4xMzpwyPwPn0hyVLwNcBBGjvlXZkwRl lPtqWGJrBs3wn3DJU9zWYI2bb/1KFvoVhNYahmv1oY0+idoipKM5ABGGY8tIdglpIS4E WqBtNig6OCJrivJLAJr7mSv5nUheWG1j4pFaa5KN6zFjtfYkKhLunWXNp9G65rPn/E55 zhpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969359; x=1685561359; 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=uIsUNYOwSPNxjYFxvF4LgB4Ah8JH2T7Nmtlw8Cz+gsw=; b=YEIAXEGSB9z2I3DXzm0Ys0+5elhpyuYhpzmMyiMWSitPKa9giJ/T0OcNCXFEJEYNy9 js8N2D40VDvYje4nds801NGpjn3xzJ7H4stUKacHcNVMnLdbRsz5pW/aLP9feyujPGPw YskDbuHdwqlfItKVZOqqV1KhORhsH5f1kD7ldjv+Rvl2gOSaZFdb2H1BNGVHl6YBN418 WuE16aGmZr+lqCYNRkMNOCfZ3HlMRWhfgiui+Gsy3ulgAYdQrORB++lrBz9G3t67ad8a 7HFs1Pkm6XRvU8zoYBO6MVnRhUVgXJtTQYZduCAsJq1Us/uQtG9ISqte94G4CSTWXcla He7w== X-Gm-Message-State: AC+VfDyFYNu00RGJvplmZARXOCZmT/Bg4KUugUzmEyP82n6AGPlPrIqI ABXXtGVCIQopbRY1VJOeVNQ= X-Google-Smtp-Source: ACHHUZ4XGLMgkIB9Q6wCsJwFAYUMJfuCSptJDhnDjc9kz87hQFDk4CAG77uXolw+VTSUtUndXFrgrA== X-Received: by 2002:a17:903:120c:b0:1aa:f53a:5e45 with SMTP id l12-20020a170903120c00b001aaf53a5e45mr5020547plh.39.1682969359666; Mon, 01 May 2023 12:29:19 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29:19 -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, "Vishal Moola (Oracle)" , "David S. Miller" Subject: [PATCH v2 31/34] sparc64: Convert various functions to use ptdescs Date: Mon, 1 May 2023 12:28:26 -0700 Message-Id: <20230501192829.17086-32-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3467A180008 X-Stat-Signature: ybng5cpmoyju69d74tot6ekx818t7yq6 X-HE-Tag: 1682969360-51840 X-HE-Meta: U2FsdGVkX1+2apvUrcdC8BqQSnd3Rl/jYTDhJyImPEIPWMdAeD7RvB/YyeVDvj7MnAvFUEISrfuzbuBv2m51+BWxiUeckmArlkdcyzJp4RWPWomZ5Ja47mnbXSOxF1JUaUv0zSoHcN2ZzTbFMYnLAz8ktg4zOHboXNyJ65v1Rfqvud5Qc/X3x/RWusQXag7mRk9XLPNSdvvOOz/XZHaw8fCN/pYFM5w6lITCnx0xRJhsaUw3w1GD3UvZxvtVBb0Hrp5J7VN+XtwvCubHYBz8IOYrabSCwOe/LQ5Wni4+KdI3F7dC+fnHk9l/1IeNHLhgfx4oUS70ugoTAV/nRTT8T8AmX1mv8F7JjV0jp5PX+3OS11FHxqRDzePpY+Ms/CArGnm9d4OqhyEXF915jDcdr4SNAivtvMTo/qSAMOVX+7zQT2/9HiALemkiTWjiGTWDlbm4lBfjO53XbUTyQIGmEbjKg/DqOi/onSPTK/oNh2onTTjnGaEWWjlyCo7w/FWqscK0iKn9Xj04yGMS11a5VBH6a+Oaum6Fz290MAmjrq+QRvo67MdrAD3Zx2hp6wCraYcYITyoxfFcLup0NE+1XJB+fNKKwg4wUzE9dHgH90WApHBPxKlfSoJWSGb+Dra7PBWwo8Ztb5A+IYfv73mZL5qjhelbBlErTrzzeeLKdoLnqOT48WCA3fs/NK3aXPDk8bQZ2B/ey1lnz1wURqx6ZXrUofHktUp556HPgs4U/w5b3nHygjgPCqxZR6wz/ZqqX08w8ZFqsURdN81NXSDqpVTtlrYmDfTRPN330ALd8b2PheDgg9LNOKc/oT9oYtda3ahWbIcRdl1iT0XkZpG5/TVnMD3ZuOJH77MWQ8nw+VSHtRGVLBi5gOVlvKag9Jp9WOB6fT65yV7jDIJBHnmgmXLOU8/8ZeR/P7GjkHQrJW29jWU7xFI1gWn6dQ8mbRVHB+3Rw8rV/h71Bp5JKiB AhmVRwWs oz8CUkRTiB0cLARsZPBEuaZXH3NLML4lS1XA0yVC5aoY+kLugzrTI5vv8oreAOaytwNAfXDSZtvN8JrvGaYuv0xiHcNpgDO2G/F0cCSvETE9nMYDyNCXvJHSLeSyQ2oHjxoTy6EqQLxNxgLrQyGF1j48b1CwMkj87osdLsevvFu3B18mXjieDR6ny07eZ73Py0BsK/HwHMnSPjWhilsm9WCp9saMQeKb5o/Tph1lrKtVP7pFKLIVOFKKw7NYtmInNg36IctaNXetqfjjbwgBdPbovsvtmsmDyVWO9Bra0fYVKaXNDVyVd2ifROLT/h7AbpoMgNByWVY50GkgDlAVvWil0ZfQVPtWcPXTc/lv7/aH/Ka5fjKql725ifUB8xM69hnTudgwYuO/QN2JUk6MiVBSGsAOU/6V0AdmCE0I6NmK3RRBUiFPEIjdLr/RvFhsIawYefGsqAby6lMi4a+DayTsbQLVvGnC6cchQm0ezgeh/I3u/1wevgZy1OKpJE88waODbhoaylsxhEIVtcm//OfXcDw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) --- arch/sparc/mm/init_64.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 04f9db0c3111..eedb3e03b1fe 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -2893,14 +2893,15 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm) pgtable_t pte_alloc_one(struct mm_struct *mm) { - struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO); - if (!page) + struct ptdesc *ptdesc = ptdesc_alloc(GFP_KERNEL | __GFP_ZERO, 0); + + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!ptdesc_pte_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - return (pte_t *) page_address(page); + return (pte_t *) ptdesc_address(ptdesc); } void pte_free_kernel(struct mm_struct *mm, pte_t *pte) @@ -2910,10 +2911,10 @@ void pte_free_kernel(struct mm_struct *mm, pte_t *pte) static void __pte_free(pgtable_t pte) { - struct page *page = virt_to_page(pte); + struct ptdesc *ptdesc = virt_to_ptdesc(pte); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } void pte_free(struct mm_struct *mm, pgtable_t pte) From patchwork Mon May 1 19:28:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13228033 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 E5F9CC87FE2 for ; Mon, 1 May 2023 19:29:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2AB81280011; Mon, 1 May 2023 15:29:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2354B280002; Mon, 1 May 2023 15:29:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 039D1280011; Mon, 1 May 2023 15:29:23 -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 E1B81280002 for ; Mon, 1 May 2023 15:29:23 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BDF26A0415 for ; Mon, 1 May 2023 19:29:23 +0000 (UTC) X-FDA: 80742675006.26.2D0F965 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf24.hostedemail.com (Postfix) with ESMTP id 02668180016 for ; Mon, 1 May 2023 19:29:21 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="YCg1YMo/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.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=1682969362; 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=CSVYEUhM0zGHlDR1yqa5KIpwwPynV1rh1Z3AvIT239o=; b=mBzSQjTmxk6N46qmflcDKFcAMo+1SGLigKmNpKm+yNDQgQn5xZRW2bqOe1q7gd8Gt2Iy0d OT3imXzkRXyMBVTboWeWd2GpAAnQ0mWgWlp/aOprdF9xHq5wiSJ37gNmkLFDP+ZeOv+6RI KAHW/UBEhnaNLFX7p/boeRDme841wSs= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="YCg1YMo/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969362; a=rsa-sha256; cv=none; b=PoHGqjPvBHNMzrTmcvt75NnmsesAVJAD+vmQgH74pF112X0Sk/Im/I1wq5IseNLQr3EikB aALETGvT/Y/pjdrpLGYlZzYyjmcI/n3/6W9dyq5mMt15g+LpO8ttJ3GB0WcpYuJeUfeiIE 5vRHPTgMmHuhouK8+/I+KTBxa7VXovs= Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1aaf70676b6so9595045ad.3 for ; Mon, 01 May 2023 12:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969361; x=1685561361; 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=CSVYEUhM0zGHlDR1yqa5KIpwwPynV1rh1Z3AvIT239o=; b=YCg1YMo/xitXPr8EH+7i7/M0wYddD4PRgw+Xim9LG20m92WUdC9kOQT3fMeSkFJ8bz 2xW9Qv874by/73QMdHiVk+wqz4B7HUYL6Uj2zbe5cOYZkoH3JAXPoFdQlYFWToTwzHn7 dFfF9W+SZdFlY3dKNimMml0EcpIP5K8qP91gmqtjuJ3sBzpu94RZheVZlyc0ZtXP5Kh9 Ho0HyuApLfDJnfV0KIWHGVL4xeGycAgKdLMplPIR2oWrmLtc//uxDTAq/yAuqmVSMzMJ fvK8MGrkhlBYA+kuhjIoxK7FCwuGLTfgfMGFdrbgTVFBoKNwWCi+6p4VuuSzDnIOEdqU o3Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969361; x=1685561361; 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=CSVYEUhM0zGHlDR1yqa5KIpwwPynV1rh1Z3AvIT239o=; b=XOaiJLqCHdXU/T2ZgIhEflj6pFnSPS95blzjq4euYg6WZR1Jsto5fvnwT3OJufLV40 1rKFOSo524VHvBNCASKwo3mfuGTNe+bDXgIOhLM5H48MljkXv//jfv1h5dBEJdz2FAk8 bKIZ8gwMgnVrf+8b3fW4B5MYquY3a/utNChRSHpMuti25zeVDIH3EEJQKTbBmutlmUm9 cK3Yprm4EcYBaLTd3/aanrit22LAvFApwN5xUVyQMmlEoCCitb/x7dJRnlw30BJ3kB9x LgBptZC85wrVdqpiJ4LEbbh+0/cHoNqUp3MV7GGSg8IS95QBLMKOxyeEqbnU4yM0vEA2 PwEg== X-Gm-Message-State: AC+VfDyuwGHTx0RN+7kpxJNQxYGH+4JvGBhaBGicYs9JZ36TVG/gc/ji WYI3pJTNPv8MUGBW0M4XBxY= X-Google-Smtp-Source: ACHHUZ6yreaxJl7mf5rX62OpE7ktDECZCzzaxE5NqOb8jR7RBUIdxZHYmi631H3wh4Z5BZGAmm3BhA== X-Received: by 2002:a17:902:c712:b0:1ab:3ba:d2c1 with SMTP id p18-20020a170902c71200b001ab03bad2c1mr1428915plp.44.1682969360924; Mon, 01 May 2023 12:29:20 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29: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, "Vishal Moola (Oracle)" , "David S. Miller" Subject: [PATCH v2 32/34] sparc: Convert pgtable_pte_page_{ctor, dtor}() to ptdesc equivalents Date: Mon, 1 May 2023 12:28:27 -0700 Message-Id: <20230501192829.17086-33-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 02668180016 X-Stat-Signature: ru5fz199n5jg8n6tm66nizmca8u7yrb1 X-HE-Tag: 1682969361-71813 X-HE-Meta: U2FsdGVkX1/0agYjxFp7VNfl5E8nfkmfKEiryvERon5HOTEyyO6LY6MsbJwE63c/HKGCeBd8p4U0qY96pkaURnjt6TK4oHuf4tUuUOwo9VA0dqKWf4KVBVpC9pkBYwS0aDkuWE9e7QSVU+FCsV/gwRGpU3ldcI65GHCr1Cjd2zLiYe5WbPalsWVoc4fsr5Z6iF3/4V1hagqkFureEsMo85+4ew3G3es7B5+K6UHKgZqpHEBgBTmif4m3/Mjd2Ds2wOQ8VfRKBBSo1Cl8SwmN2xWXo5cQdcXPCaCi8GCEZrHsG0gKKegoo1uSvhXnN2bvi9VNqe8by788IcW2kOrw2CAzPibR57v3fNl6U6jjMJzb9G2te2jRSa73NDCSuPGcAHT9ZqPj9eJ/ikGiLqD0B2BqLSNHMVNB2vbQnqAflMhZpbIzRo1bObTytdEIrckrTTPyZETFg999XGwekLHwd0iB4L6BbVHNnP/kxZ9ye7+1hOcBvfydvEamUMFLpN/qiuVOyij0uW4fFPdVnnH7Zw+J98mj39dyKivkqLbiT7GdFhTXmYGj1em7upU7cybLTCnsRHL63yhXDm6jr3sbLks8MIKVApo+fbUu8A18nBMjK3Oz8NYlzZPOnM/9rDhGTYhlO21atFuNOjH83EfkroJIHAF9HZdwR3uorLLQvKFDuaDekZvnIoGJmCUTX2ITQdwcP94xq/zJT2VhzgwOFKv9aggBlPBFvh/ps+WijpAD4bUnZbVqUPhsFflokPmuxiz14QLSfODfCKvPiXOEDgaiISHRleQ3ySGIdtMle9ZvjLg8wE7GR30nEK/GgQq9aMyrJqsB9x9tCVxWaO4kOv9ip+5Q2kjDTBKrE1ZifpZDYZ2iCdMWgL5VBfJXDOv9MgKt4dPR8UaqJtxjo8totfqYgMSVBu6DwhP69/amtutnCLk+eL+6w+U/9qQxVmsaZX9mE0Vkyk4o8dsRl3t OBugfaMC RHkxgSBFQcU6mhgRJPhSX2PAUyWbUYVLZTfnv1iXzMA3S11UCMAj6lppOO0wlh9rv5kLWMP9taNI/0ub0o0Ky4MKe0z5j4KsSefXk2lewTcjDMn6EE1Utpdcx/c+Z5vO3GqUpHNOHDefAZHYx9u4hIh9rMtBFRHfVBY/cEP6XbtvFOtuP0qKTqpqJinjtyHovEfolZADFKlwTd7LyIuodfCVQiTiT6wkGShaBvbvE0EAn4BJprW72hQ30gIr8Ecy73OlQGrcvEMfKAmlGY0OJ93E0kPzwmJdK/YzLdbodOU74Z9EJZRD5bm6JrINvaDxgHQ3M6TtIClfepBLA6Hv52fdSIPs0JNTrYTqlWxqvZp4+sGJ5eA433IZ3fh7mt/v7PNAq49egLzQ6nY0gzTmzv0I9S7DxSREHQA/eDnW1/h2XCwoFgO0kXpBQZOru0bHGzi5BEw1TdOBWMtAw0Xs8kw1nWAHeq62etqYW83Q5mia1r2KtLB0YdXC++i/hcZQlQ31/mDkbAXVgHXfYc0wCma9xFiBPd6cukp0GR8tn6ReTGuQ6DsBAW4dczL/8laRcEHaJtrkKFY6Ewqs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable pte constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) --- 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..964938aa7b88 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 && + !ptdesc_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); + ptdesc_pte_dtor(page_ptdesc(page)); spin_unlock(&mm->page_table_lock); srmmu_free_nocache(ptep, SRMMU_PTE_TABLE_SIZE); From patchwork Mon May 1 19:28:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13228034 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 9A535C77B73 for ; Mon, 1 May 2023 19:29:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BFB3F28001E; Mon, 1 May 2023 15:29:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B837F280002; Mon, 1 May 2023 15:29:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D55728001E; Mon, 1 May 2023 15:29:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 7FA72280002 for ; Mon, 1 May 2023 15:29:25 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5CA78160729 for ; Mon, 1 May 2023 19:29:25 +0000 (UTC) X-FDA: 80742675090.17.983300D Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf26.hostedemail.com (Postfix) with ESMTP id 7D46C14001D for ; Mon, 1 May 2023 19:29:23 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Q3jl6Ytt; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969363; 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=m8/b+eKq2obnq3wrn4AaChyOhPXbZKipyE2UTOB7XHg=; b=LQgnJdt31lZzDP9hqmUHLM7lbbOAzeTB7tO0MRzeMH7uP9DKnT7mUl0NPuWV9dlitEZzAF N3edXotqmm9RTIOoOTazP7yBBN9YRIXSFm1VZ3iPJ8Zh1f4ZSW2EyQ7EgjZvyY7fkYNWZ8 /qXPjX9qrTwq0av6GiAxhtVyESYSIeo= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Q3jl6Ytt; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969363; a=rsa-sha256; cv=none; b=MgaVmjxoLcc997piaEB3Hz2AIYD+KbayVgtYfhl+xXsb1Ai8zHr+wl7Mbny5cz7a9zUZUT NVwCM5i8LcvgNA9yeDvemEhJyG9QHF+puU3IVJo/DXtjMR1AYA0cZZkSk8IXFkw8Gv2VeJ Xjt3dq7yAOgSHkdTmyJCwTJ0gvOzjBc= Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1aaff9c93a5so6146005ad.2 for ; Mon, 01 May 2023 12:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969362; x=1685561362; 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=m8/b+eKq2obnq3wrn4AaChyOhPXbZKipyE2UTOB7XHg=; b=Q3jl6YttJDwUuWKyn1dVs6I8W94SFWxxciTJdLpT/LELBYCeGyev+ExIC9w29x2Yt1 zXHIDz5du52vN2frCHR+hIpcwuJ6c3WNhfC/Gsy1nS14RuXHFXtXj5G9xq8KbaH8upCB hoZ+KR9ZQITjkQA540sZmLX6PX4iGNe7NpnWG1G2AsO+NZdypSRuEfFuzqh0wPvQQaGw 4XpO3Q1D/iCtA92s97XY1Or0L7GqG2SHJxpwKx0yuxfIbjPslNXarskrtkCCtU8UwW5x DSxt7iwfG4oFpxWasaAVqe2jz7cH5xxqomQxklMjhuQacqvGLIa7+5cde3ROrtfKL2NP oDNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969362; x=1685561362; 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=m8/b+eKq2obnq3wrn4AaChyOhPXbZKipyE2UTOB7XHg=; b=UAo2uWhTaJoPqs3SR5Xw7+7+pRkz37X0r3Nl67YV28rE0aG6pbZdzyABlshU2e4qkh LESx4P7PfSu0v4ij9/BJ2ZCQ+unHfSXUrx7fdK4JOK/aYnzvHH3UE4jV3pKGjs/x9huy /jAfkrmHDzPsksoohy+cpCluUIJS/TR1qii7noHIjRsjSv1j87lseei7/g6dZcSEHJyw iVdt3z/r0xlN5uQ6UGy0yCrLzW7dNO3/KnpIFadxIsir65fTI4ZV4BKJD4VwLDlr4TvZ 3BFkckOuWYuR84EP7+G9VZ1rr3QtJzXP+QUnQW6CjFTF2xrdGDNllbZl4VHrEhK+sLLe f6GQ== X-Gm-Message-State: AC+VfDx/JvTo+kcsNvrKyyuU75e90lGkmtRrWR0oe5P0l1uEdvYeLFyK nG5QYBoRHEj+EbYS2CKMsw4= X-Google-Smtp-Source: ACHHUZ7SACaylL3/aSyKhkx7S2g1HYBvFG08B1pme9nPnu6u4pSNBbJS188a/Kq3fbmOV3eKOsv72w== X-Received: by 2002:a17:902:db0b:b0:1aa:e5cd:647a with SMTP id m11-20020a170902db0b00b001aae5cd647amr7875588plx.23.1682969362180; Mon, 01 May 2023 12:29:22 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29:21 -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, "Vishal Moola (Oracle)" , Richard Weinberger Subject: [PATCH v2 33/34] um: Convert {pmd, pte}_free_tlb() to use ptdescs Date: Mon, 1 May 2023 12:28:28 -0700 Message-Id: <20230501192829.17086-34-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: bnkyw8r4ium3o6xufgqbnp79wg1hxhip X-Rspam-User: X-Rspamd-Queue-Id: 7D46C14001D X-Rspamd-Server: rspam06 X-HE-Tag: 1682969363-797980 X-HE-Meta: U2FsdGVkX1+lH2c2Odtz6cCqwiuKv66wm+45786LtBdwDdrJGL+lcArFKNZIBUZbI5E0vZriMbQFNNl2fHeaGmyi7Qxamo9WdIJIBSVPfigujrciB2IWHZy7tYAcZlzIxUT3J4NdTUBeEEV+iIBdf6mh3316BQ8T7SVIaVOxHV3k3gcKUqwLHcXjbpwDtyZHrHq0aniTFk+4R60MOWJJxqh7baFpdKG/rR1WKhgB+yfgErFDnxL/06SnL5hFpbh6EgYd5VezhjraPUjVWXJLq37khp4rEauO1yZ6o6ySUgB5YzyrzgmN+nq42UH73lg2KO3f9dcQ9eiRbZ2uhnYZolR3uWFSCV+aWNON7zVdq/bExv/QEMIfUwdq2gWYj6YgJJGeWq9yOArDqNHBMJTNNY823iswKHQSc9tDxl+ylET+7RmP9yA4ZwfDh6xY88RY3aL0gS7EnpwDzBHlUu48rhGOeQhvuONir8Wl4LRcu+jyGZOu1e49r9tDouN7m+BYe7YiuAovpN91x1PK2pazDmPndriCv7/1deMX+I5V06IyVdJTha9fVvs7y4juj5fXoaIcnBebiltLkHX9DHYbq4yJ6d8Yl3AEbCF2Km/MXVD3omiex2esdYW+d4HADygI+9bW6XmcQe2UqfM0e2BGwP8RsAxLkooxIaPLrd9EUEoEYCsj/ufzt68uR3dhTv2RoSHJPflzZ/aZrTNr1N9xfQa9XgXk20hPS6nc5d7FktU3BlxPjgyyNM3lu4tHuJkC5N28V/LYcQlqW+AUtE7JSo6lVpMqM+PDa5iCMs87S4zXm16Xe1IieGwDWtkYBd3/LZia4z6FBoQ1NPLsZXfs/AQvRsAD6Ku4rjXME6TMxVOMsxy3ad3kdwBKeJ71yQqsFM8WoXvIDs4srLpeSI++hRNWUKriOh7It3QTnj96MEtmkA1b0e/Kjk0kLCEdHhJb4zBYOUlptf1NsNgzFUS TY/fWqm7 GkAmyoMSw2lA3lwCFhSvDui7trdn3QNE4upOOsQKFJ8iOsnrWjV2iodyfDLpOm8xQxQP6FYxaciCJm+MTkPYtYbanBqI4W9P6gg8vFYd/XR2PXG+ywGJdMACvSst/2UAy1QhjZY5yUCBOGIMMelPr+zffq1XZKAf8349rLb9ZefEhtwevVT3tcz9nFu59ZUH6y8QqPg4vUZ7YzftvOnQz3dTQK26LlIX+X5wjv4XEjwRRAq88rCEmwPsvNKoRmwTA6S0m8+54gzFuG8ndGv1bu+SFxu8MzWkOQ3ALtbad2bYLGoowYA2cnjgQF13h3MGfwvQLxF5vev41U2M+5EQgoY7z6IXLklgJHOsK6nTD2EnOJgjEr32ny9YI+P4DHiJrE6OJyRWVi3bpnDT0BkgTTE9/DslULuVQLCx7BomXDDPBUEQMhP1bi+Luz56ZPQtvVYr6jZaKnvOlxX6yODmWbjnibdKkG3t3QZwYSikVys+5avBm5G7o7sNz1ie8alyeUvVFGytPD+aJkDztq/pT2susp7VpzBfZJlSiucRZv8m5+6sA346Ow276aEyIH7mXm381dOeerauOT5s= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Also cleans up some spacing issues. Signed-off-by: Vishal Moola (Oracle) --- 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..760b029505c1 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 { \ + ptdesc_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 { \ + ptdesc_pmd_dtor(virt_to_ptdesc(pmd)); \ + tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pmd)); \ +} while (0) #endif From patchwork Mon May 1 19:28:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13228035 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 7446FC77B7C for ; Mon, 1 May 2023 19:29:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 54335280010; Mon, 1 May 2023 15:29:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4CB7A280002; Mon, 1 May 2023 15:29:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39403280010; Mon, 1 May 2023 15:29:27 -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 2A3DB280002 for ; Mon, 1 May 2023 15:29:27 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D0626AD89F for ; Mon, 1 May 2023 19:29:26 +0000 (UTC) X-FDA: 80742675132.08.673B55D Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf15.hostedemail.com (Postfix) with ESMTP id E510EA001D for ; Mon, 1 May 2023 19:29:24 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=l3gNIC84; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969365; 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=tVP5uHyitpWmGyZGGmBmuGVwAuiqA5RrNeRETZrKFQk=; b=YhhOABemCeB/eCVA+Ncenv80U+/FCnWoSbGewGNzSvtge12Kn6J511Ln4zddTN/FQ8GI5y Lvvi9sfvhGdn+Qgjq/oRy3xxqS9eI47SUOn9N9McOd9Aq4QZf26otavAKkYQY/XyRH9/fC pY+ffBD/p1OWJn71q/Gq2q3gaPfeTrE= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=l3gNIC84; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969365; a=rsa-sha256; cv=none; b=NyZSNWM5C5FWVgirLGoK/R/ALcqwlHsK1ISTxqkBnwKU76TptacRxi2V2rWnRh0nQeO7we FAs9N7SdaH5v8MQab/+1TWmRc+t91+981+IWmayX9MC8Xvjk0AEZBOheo1jrBM/b8UAAAY OBTH+3+Ykt8xdLmKnNMx2nHoSYzDE9U= Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1aae46e62e9so14580925ad.2 for ; Mon, 01 May 2023 12:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969364; x=1685561364; 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=tVP5uHyitpWmGyZGGmBmuGVwAuiqA5RrNeRETZrKFQk=; b=l3gNIC841LsuGqQQ2UpVF+XnHjZ+kiBXZeZy4GTzDMbWbXaEiG5ArSl/ydDvotE01/ fGJ2+A5T8Q0iCPtlIlo1cxl3Uf1AxNVghNXp2wCgxamPWRN0f7NM89uS/eqg02SKiRak np/AOUUvT9Iq32lA1ArHNRu1TUuWBGP97diP1cbyLES/I8a8uq904CtHM5VcyBKmIx8g ULh11nFUApu/c5GfuUXZpzFhh6lYLhMsU4hm7q2aFdXWAxNpZKe/ScDOD1gC9EPME0aI 4wA9wQgJ9NzOXeiB1g9JMqcyyqFI/8Wvj0CTUQfo5zcTDuOrG/ytNAkFcETgxxSn2sbl hW5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969364; x=1685561364; 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=tVP5uHyitpWmGyZGGmBmuGVwAuiqA5RrNeRETZrKFQk=; b=BQqIK+0DGiyRObyIbOX9OARuNanhOjJF/FNIv9Ws5WR8aUCX9BwTr550qpKe+2kKC7 hUbmGpQLdKS+f2IJPpUYU2kwM2rbuQXArp5sQrl05JHwqD7pyrArKcvcl0fYaFwEvjPA TiwpjZkzwDU0xknnat9pHztjTv/nqewBsegy9f7wm4yPYnRfWHUREzi2yzW1RhPqclgs qiIuiA3GMSyDKB+v5S1KiyDI/7Stwn+F+63NVj+vmJZDRxCDz2A9a4IkAe7jbJxq+E4C duN2HBaQGNZZR98D6bNpLF5EcRnDlyBY4lClKDqWwF6fwv/8mjjt1v7FV+/xAudmAk22 74pg== X-Gm-Message-State: AC+VfDzyjSNPNHDQ+TsUeve32DF2pXXTu/vDuE0zO7LMdUmac/tV3Dau 03HMyhyS0Lt7osd9qKPi99g= X-Google-Smtp-Source: ACHHUZ4QjkMy1fp/+Rin9A48k0WWuHM3fOzsdnkuixAb5bcQScYzyO713qNNM5COHanOuLDMosv4jg== X-Received: by 2002:a17:902:db07:b0:1aa:f203:781c with SMTP id m7-20020a170902db0700b001aaf203781cmr5844122plx.44.1682969363711; Mon, 01 May 2023 12:29:23 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29:23 -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, "Vishal Moola (Oracle)" Subject: [PATCH v2 34/34] mm: Remove pgtable_{pmd, pte}_page_{ctor, dtor}() wrappers Date: Mon, 1 May 2023 12:28:29 -0700 Message-Id: <20230501192829.17086-35-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: E510EA001D X-Stat-Signature: rpn1bixxpufgqb9zoyemxcdb5enhuoiy X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1682969364-300507 X-HE-Meta: U2FsdGVkX18sJImESa6wun3pvvSuiLBqOlI2HumTAt0REZ7FNcvtfd6m42UjLSJCXEvGtMnOghUzMnTymkE/x3RIj0l3uiSIyoeuATx7HSxhidDEC4VMmSeu2GQd6zqPAfclUERmrAMBOOKlXeWjehScBZ5qyeXIW/6odDCYkp8ruQfMTg/M9D0dL3rzCO2fNTZAY/kAAcjPF+nklc75gQ2MkKgUjErpXiavb++C8I6VGFTJWBIusa01lC5JY0eiA6Cc4OYjgHyQit8cDhGF0DdeZ9selkDB1snaA7QpKBhu6FGAzak31xFBwbVdUntOf6steEfhpOZELbf13SC4gS536TZPT9YUbbwHtOyjnhFIFNC2SSo8qlBbkNpmD1vAEOKoTb5aTv4ACyLJIgT/21UMcVHTwWEVgAm2v2wewmbwmVhr9rbFEVmp5jzXJY3JC6fH7CAn3PBGRWNXuPubLNJqGjiTQeqbNI5nYG/LG1Aemxo+XlXCCDrLJzMNRAM5eyuPb1gReh4qZBSqMrgw5CNudL22qcwISps/jOBC2jacC7b3APAOPzwbp2q8Vr8ZkXHmhmhHd/4Y2IGV6/abBu0r/a/nO7TiPPxxO60F0Uy11t6F/heMmrZVnAT5a6k0s91TV4LzdESv4V2L/e2R1PooAFJ1oT+hS3Ae9jmK/07CBB3wlOiEnkwGUbgx26dEAxSvKtnmDQtiWyUuiNAuB1k5hU1uGS8SX6Y0L8UC7s9r+WzCAzo9P7XXYnNyg+wlveYeu4Aij2PpIokgNS+yYwFGZrwl3sltH7zM34USEREwV++/SLa8TUNMdRkdfvenyUnORJ2npa4JgB10svy+39JRhabH+I1vxy91yS+KhnWmXDM2hVs2veVB+2gJqRdaBfltUHM0IMnf7n3nNkUYBduoygh/2PnlOjUh2jnI4K0Mq1NSJtlYI5s8TkF0B5mTahuhE76kE/T3g3PhIeX zYxFMIkn pSUgx5Zqlh8EG5IEXteKaD/tdIVDMgW7qooiHyKY0CSbNHAvH1Nl45aa/pe9qB8x+hzRioplz9YH3ArbWrOCHPLuNNRWBR6ZhVeGQhYaPRjq1LV6BAnkCJuifF+wkuTtZtwr1Ohg+FtVJTw/3RpWylWf4erOeHofPTpbtkmUs/x7iQEPIEOHxr7TcqkNg+iHAk/vCEvFQ6KyhOiCd5t38GX2DEtq3ER9rNmU0sm79JnUGpcrJYSKjdHmRfs7n7/Rz0vPcFHeqdFyGgebQqHfKPd0g3cAUU1RtzLteeZ3grh+o/ToNO0e2n7DD8Bm53/F11+u/98v0rJyL8UiCQ4YTOKPDDDD8TMqckE/wd9R2wkwg3qxh0NGi4f0U/gvEN5RbeGHGKiVkfEMvByUEvI1IiIZmd3Xhe7n/BM7wbTon/CEwmXpvuZGFRG3dmE7I3fRJwlrOtuzPTcP+w1h0s5MlcpTENUc1tvlbodtwHn3vC4qDXKTYwO2IvSE1oq4ceKpEnKnr8vAeH/R7M3K67jAFWcH0e9arOxndtMXJu9GJqYqXBPZRYM/Jqlpvmz2O7Du9IYSxKGo42OI5D3miGvRNMaxmqQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: These functions are no longer necessary. Remove them and cleanup Documentation referencing them. Signed-off-by: Vishal Moola (Oracle) --- 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 50ee0dfc95be..b3c612183135 100644 --- a/Documentation/mm/split_page_table_lock.rst +++ b/Documentation/mm/split_page_table_lock.rst @@ -53,7 +53,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 ptdesc_pte_ctor() and ptdesc_pte_dtor(), which must be called on PTE table allocation / freeing. Make sure the architecture doesn't use slab allocator for page table @@ -63,8 +63,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 ptdesc_pmd_ctor() call on PMD table +allocation and ptdesc_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 @@ -72,7 +72,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: ptdesc_pte_ctor() and ptdesc_pmd_ctor() can fail -- it must be handled properly. page->ptl @@ -92,7 +92,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 ptdesc_pte_ctor() for PTE table and in +ptdesc_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..a3323eb9dc40 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分页表锁:所有需要的东西都由ptdesc_pte_ctor() +和ptdesc_pte_dtor()完成,它们必须在PTE表分配/释放时被调用。 确保架构不使用slab分配器来分配页表:slab使用page->slab_cache来分配其页 面。这个区域与page->ptl共享存储。 PMD分页锁只有在你有两个以上的页表级别时才有意义。 -启用PMD分页锁需要在PMD表分配时调用pgtable_pmd_page_ctor(),在释放时调 -用pgtable_pmd_page_dtor()。 +启用PMD分页锁需要在PMD表分配时调用ptdesc_pmd_ctor(),在释放时调 +用ptdesc_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()可能失败--必 +注意:ptdesc_pte_ctor()和ptdesc_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分配在ptdesc_pte_ctor()中,PMD表的spinlock_t +分配在ptdesc_pmd_ctor()中。 请不要直接访问page->ptl - -使用适当的辅助函数。 diff --git a/include/linux/mm.h b/include/linux/mm.h index dc61aeca9077..dfa3e202099a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2858,11 +2858,6 @@ static inline bool ptdesc_pte_ctor(struct ptdesc *ptdesc) return true; } -static inline bool pgtable_pte_page_ctor(struct page *page) -{ - return ptdesc_pte_ctor(page_ptdesc(page)); -} - static inline void ptdesc_pte_dtor(struct ptdesc *ptdesc) { struct folio *folio = ptdesc_folio(ptdesc); @@ -2872,11 +2867,6 @@ static inline void ptdesc_pte_dtor(struct ptdesc *ptdesc) lruvec_stat_sub_folio(folio, NR_PAGETABLE); } -static inline void pgtable_pte_page_dtor(struct page *page) -{ - ptdesc_pte_dtor(page_ptdesc(page)); -} - #define pte_offset_map_lock(mm, pmd, address, ptlp) \ ({ \ spinlock_t *__ptl = pte_lockptr(mm, pmd); \ @@ -2967,11 +2957,6 @@ static inline bool ptdesc_pmd_ctor(struct ptdesc *ptdesc) return true; } -static inline bool pgtable_pmd_page_ctor(struct page *page) -{ - return ptdesc_pmd_ctor(page_ptdesc(page)); -} - static inline void ptdesc_pmd_dtor(struct ptdesc *ptdesc) { struct folio *folio = ptdesc_folio(ptdesc); @@ -2981,11 +2966,6 @@ static inline void ptdesc_pmd_dtor(struct ptdesc *ptdesc) lruvec_stat_sub_folio(folio, NR_PAGETABLE); } -static inline void pgtable_pmd_page_dtor(struct page *page) -{ - ptdesc_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