From patchwork Mon Jul 31 17:03: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: 13335102 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 596ABC001DC for ; Mon, 31 Jul 2023 17:03:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E918B6B0166; Mon, 31 Jul 2023 13:03:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E42D16B0167; Mon, 31 Jul 2023 13:03:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE32028006F; Mon, 31 Jul 2023 13:03:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id BA4286B0166 for ; Mon, 31 Jul 2023 13:03:47 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6E47B120BBF for ; Mon, 31 Jul 2023 17:03:47 +0000 (UTC) X-FDA: 81072528894.04.1A4BB3B Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf30.hostedemail.com (Postfix) with ESMTP id F2B178003B for ; Mon, 31 Jul 2023 17:03:40 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=R8qXZOyV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823021; a=rsa-sha256; cv=none; b=myFhg5tbspG4WcJIdne60OeYxoiTrbWy9e/Ki/MS7HMtEx/KyPuv+2PJOFpqkc/74no6Nb PtVtC3oN0uTrC7GJZhz0Qj80P798vBpYSoG+sZgAwCtTxpWMIl442REmxqOlYEYUMsZMA0 4ldxPss8G/Q2aNx3u2zXj6N1L6w0950= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=R8qXZOyV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823021; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=DXYENedStYVsFXpaqy8X3+wmlabVR1q8JHyD5+dxFj0=; b=M7wiLLYIteoLh+idRtlBIak5S/TpZa50soZhyUrsjPFm4rcZ2pu89uew+LOA/bxJlpmpUp qyZhfYC77yYayx/Xnj8eJ4JGsr8KS1H1dlRce0dgIIFxbhn+1rHIX5XNOk4JqdSDbocIJ6 UvYzLe0D8VnByAQxGKS88r0r9OpbKds= Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-d05a63946e0so4859559276.1 for ; Mon, 31 Jul 2023 10:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823020; x=1691427820; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DXYENedStYVsFXpaqy8X3+wmlabVR1q8JHyD5+dxFj0=; b=R8qXZOyVQEehD2hSCsZpjQT5/Xf4F/brzByoll1mkB6kHNfXhJ+RcuKFwjYgA2X3Sk +7iApdQo4Cg5rRr+JdIoFqDPegtGDiAGRb35thEkDI1bUQUjq4aw+LSTgzrTpSIcmWfL bJsnhuf8GiZRZhIc6fFdHQySZ/IskewEUKqkNZ8aYCG1nKX4deKA2DfN9abSC9BVfmNb sjmF+khX55fBUw2Vqk+TxqOS6BA3VaGbAlziGVokfw/bjXQRn/YvIXdekpuhXXQ/VglV zbi9hIBXyZbJADitdtmejGR4UrX429LImbE9yX5FhLBTl4AmxfHwzr7gnLpRW2zU3ngh Rejg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823020; x=1691427820; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DXYENedStYVsFXpaqy8X3+wmlabVR1q8JHyD5+dxFj0=; b=elqyj5GQfHw57mw/KaslTh5OKnzmcxK14NcLBtm5fuxtUObwoWc47PXCJ/sSEm01iS Y/cx05Y2nWtAOkeKT8CkHlqbs2hMXP/+LmPVv6MRyWaXD+yvQ1wnq5Q4DQnACwJZggIw bBXuode8i6C3wR1CgcWFxBHxUItZ3+eo2fP49SQnvz2u4mLFlav3cUsjA68SiaamljwY RqPjCJIJlDtwN67ZRRz6yF+/2aUHHs3FGiF6LVC8zdY6hnSa1hv4gBb5Q8Efm7MgSa6C ffUPb/NWyLCuDqN7kFEe2AjbSw/yeH7DT77Z/u7ZA8fWs/6mD58TcXRF51umhBi441fe +Qkw== X-Gm-Message-State: ABy/qLYkVv0NlSMFRudvXSrUvBYmHrj7p7VdXTPC1Mn7FTFbKXAYzNU/ sRUrZpuGhOMz73t2/1lyXB0= X-Google-Smtp-Source: APBJJlG+a23ZkNAOXVkZypjt9XfAMSGYibV34A8tZ1fqqbfsROXiDspwRbZtJgVYmae4gyEjzVzU0Q== X-Received: by 2002:a05:6902:18d6:b0:c15:c55d:c26e with SMTP id ck22-20020a05690218d600b00c15c55dc26emr12586459ybb.54.1690823019726; Mon, 31 Jul 2023 10:03:39 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:39 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 01/31] mm: Add PAGE_TYPE_OP folio functions Date: Mon, 31 Jul 2023 10:03:02 -0700 Message-Id: <20230731170332.69404-2-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: F2B178003B X-Stat-Signature: nsr9fqzrtm5x11okhonwo13h5d8a8rmo X-HE-Tag: 1690823020-962300 X-HE-Meta: U2FsdGVkX186FaZ93gnc7imod/y2ONVrh0c98OtqpSXq3E2HNNKUYGx6lOqEenJjJdtD1ynnujOdyk+gTYtrXf1XgLmYZMNDoBONx9AR2H4F848WdgAwOcLluwa7cwhoJwFuVjB4ogk4Gm+GPlE5PYuaVA4D7T3JrWsdLP+fUcT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H4woNtAfiqhfrl/1LWF0COPtDjJoXNTrQjL0vF6w2105z56n2BsiNx8YxX4aTCa0xlP4sYiP5Po1PvCQfBBtrk0zTcJ3biAS2XwjjvHuPOqNNM+1G2y1DTpKgTBaj3/1OzPn/0+Nahqeompz1zisf6GCAefcwereodUI86+j5dLd0e4Ih56nQsre5erKqurB6RKlQe7lrYLFEasatflId/lchHVSlptw4IQ1xHwgHMB9juq7tAiuFtE6oCOoifNzS3y45m0fRTkcKgVKY8xluZp7YlgYGd6Wwk1nq4rhArehmkZ4Oa41pX4AtR5HdOD2vVxdKVvMrKjpZnAW7ETCOaxjOxwr1i6SD+xvW1lNdkmKOLDqBjnpa5IwAdlNoecg4/pVT1BwA0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: No folio equivalents for page type operations have been defined, so define them for later folio conversions. Also changes the Page##uname macros to take in const struct page* since we only read the memory here. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/page-flags.h | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 92a2063a0a23..9218028caf33 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -908,6 +908,8 @@ static inline bool is_page_hwpoison(struct page *page) #define PageType(page, flag) \ ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) +#define folio_test_type(folio, flag) \ + ((folio->page.page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) static inline int page_type_has_type(unsigned int page_type) { @@ -919,27 +921,41 @@ static inline int page_has_type(struct page *page) return page_type_has_type(page->page_type); } -#define PAGE_TYPE_OPS(uname, lname) \ -static __always_inline int Page##uname(struct page *page) \ +#define PAGE_TYPE_OPS(uname, lname, fname) \ +static __always_inline int Page##uname(const struct page *page) \ { \ return PageType(page, PG_##lname); \ } \ +static __always_inline int folio_test_##fname(const struct folio *folio)\ +{ \ + return folio_test_type(folio, PG_##lname); \ +} \ static __always_inline void __SetPage##uname(struct page *page) \ { \ VM_BUG_ON_PAGE(!PageType(page, 0), page); \ page->page_type &= ~PG_##lname; \ } \ +static __always_inline void __folio_set_##fname(struct folio *folio) \ +{ \ + VM_BUG_ON_FOLIO(!folio_test_type(folio, 0), folio); \ + folio->page.page_type &= ~PG_##lname; \ +} \ static __always_inline void __ClearPage##uname(struct page *page) \ { \ VM_BUG_ON_PAGE(!Page##uname(page), page); \ page->page_type |= PG_##lname; \ -} +} \ +static __always_inline void __folio_clear_##fname(struct folio *folio) \ +{ \ + VM_BUG_ON_FOLIO(!folio_test_##fname(folio), folio); \ + folio->page.page_type |= PG_##lname; \ +} \ /* * PageBuddy() indicates that the page is free and in the buddy system * (see mm/page_alloc.c). */ -PAGE_TYPE_OPS(Buddy, buddy) +PAGE_TYPE_OPS(Buddy, buddy, buddy) /* * PageOffline() indicates that the page is logically offline although the @@ -963,7 +979,7 @@ PAGE_TYPE_OPS(Buddy, buddy) * pages should check PageOffline() and synchronize with such drivers using * page_offline_freeze()/page_offline_thaw(). */ -PAGE_TYPE_OPS(Offline, offline) +PAGE_TYPE_OPS(Offline, offline, offline) extern void page_offline_freeze(void); extern void page_offline_thaw(void); @@ -973,12 +989,12 @@ extern void page_offline_end(void); /* * Marks pages in use as page tables. */ -PAGE_TYPE_OPS(Table, table) +PAGE_TYPE_OPS(Table, table, pgtable) /* * Marks guardpages used with debug_pagealloc. */ -PAGE_TYPE_OPS(Guard, guard) +PAGE_TYPE_OPS(Guard, guard, guard) extern bool is_free_buddy_page(struct page *page); From patchwork Mon Jul 31 17:03: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: 13335104 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 B3924C001DE for ; Mon, 31 Jul 2023 17:03:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F4D26B0168; Mon, 31 Jul 2023 13:03:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 47E656B0169; Mon, 31 Jul 2023 13:03:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2AAA66B016A; Mon, 31 Jul 2023 13:03:51 -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 181C26B0168 for ; Mon, 31 Jul 2023 13:03:51 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CB55A1C8C55 for ; Mon, 31 Jul 2023 17:03:50 +0000 (UTC) X-FDA: 81072529020.29.DFF0997 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) by imf05.hostedemail.com (Postfix) with ESMTP id 04786100014 for ; Mon, 31 Jul 2023 17:03:42 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=U7jETlvh; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823023; a=rsa-sha256; cv=none; b=ET6N0DalW/g2We2n220UXRy17SVQXtwSISRFAHYZEoLfkumkSvWLvoHW47R5s51iPEwWcD RtBGAMWXOvmyK6QzhHeG99zbPinNPd3qtwHQcl7JGcvTRowZGXLKx9K4px/2rI7IZrF8EW mYWCZ4jBq2vs3t2SI03JwdJw0fjO4tQ= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=U7jETlvh; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823023; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Z39OytypuZQhWkFCV+z6u8l5O5ZgTP/vsQXKA5JsO6g=; b=OHfApBJdJ3RZ+6dMbSmrTM3YtUyJSBkLSW0qBzq/c4UF6JiY2v8u6MWq4aINx1IiCWhWqe KU+EAQExlwL60gkSrmWSl6PIB2XxQLlbE5a+LXjYSINTs+4NtHS5JHRj2mjS7M96IS1doy 37WO1P4srhb6f9NUsY8acMvxdWYijH0= Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3a426e70575so2742159b6e.0 for ; Mon, 31 Jul 2023 10:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823022; x=1691427822; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z39OytypuZQhWkFCV+z6u8l5O5ZgTP/vsQXKA5JsO6g=; b=U7jETlvh8mqc3055+tBC6M+9Gy8R7REEMm1ZwKGc87m0rGDIJvgZcQ22vsmsinFtgt YTQlnuPzwi5zjdD+hLDWvxB/bmYZ8keXNmrVzrv6YRz6eCv0CI9nx19KksxH7KprzagR irj90f/wH/tTIxD8sQn1Ka9sOZ4dPOYQtK8h3N0b0riSaIJ2B+2YXCtlZtVEkrPg3Bbm Ojw5AwhfC3mD3DUjG5dFAv5YKIY2ngXsFAsSD6uydkdJ8uV+q2q9uUnnFZIrFIqfANGz oTPiE5dBvTDG/Pv3tzLP875t1DoqUqRhJ+2aPTfRbOK8xixubum5W0ZiIgU8cUKgztEJ 6Kvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823022; x=1691427822; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z39OytypuZQhWkFCV+z6u8l5O5ZgTP/vsQXKA5JsO6g=; b=G/tct7LcoySVSkjYYj5lxP8j1HVHSLgdYgHj22wBNueh9R6shDB04F58L/MD/8bGWC giiRWke5zejx3ARicOU86hrsbkhWKlPVi3FixmENcCQkbv7fFkbT0k/EP+WOHzK/cJ2H jvpXNgxgyB8FMEedpAA5k7ko7PhqN8Jv9QnHIYQ4hGOczNbBsnQ1YvA+QxQ94JB2O4l/ ZoeMaxVR3X72GYhzE75NbGxor2eo8N2z3T1VEDvuW5xYA69hOi/gjZvj5/w7m+7IRYNk lMHuaxGwFfiDgAnTgqokb4wIKJ4D2Gg7uI4kl3mKwEwRl5PxVP/afEhsJO9uK4novp/q 8JdA== X-Gm-Message-State: ABy/qLY2+SjUjYzkScClOjR6ykHSyQSEIpjFxIiR+64zaB/JhYiVF59u FM/ryk1vpDKYJXe9NYoqFc8= X-Google-Smtp-Source: APBJJlHO94ah80UzwDXxBX9kkXsVAL3mPuWGcSVwu/SHGxcgeWhtI+EazxMnc09xov2z5IkvLaxhhA== X-Received: by 2002:a05:6808:13c1:b0:3a3:7612:28cd with SMTP id d1-20020a05680813c100b003a3761228cdmr11096736oiw.28.1690823021788; Mon, 31 Jul 2023 10:03:41 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:41 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 02/31] pgtable: Create struct ptdesc Date: Mon, 31 Jul 2023 10:03:03 -0700 Message-Id: <20230731170332.69404-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 04786100014 X-Stat-Signature: uzjuratfzh6ferfn7rbq1gieo6y87k8t X-Rspam-User: X-HE-Tag: 1690823022-550384 X-HE-Meta: U2FsdGVkX1940Id+HQvMOqFyp9ITBXXvXevPfgCPiOluhGJBavLaJPNEcJBQc459aHw56JEqpdPbirrZUTaNwYythOeja87C3wbLFVjkCYLPsGd88B6FB8W/GUF/LrGA8p0D1t2rF4pm2o+LsAT2a2NxGzoDMNX6/9LPdZIpR7dXGq6QF7NXgEYwVpvdQRQZa4jWk1546Ja/Hynm4+qDIjiw+L2VF2sWLmjse7jp9xSstFplQPv5nKLwSf/EpthCMeFLhoALE3mk+0+Mzr5vFo/LOND02AtGO4QLXDJibJkeftBme2os8CqIyIkF98It1DIKM1dAQritFHuBSmy8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xdVmr7Mi/Jw9N5fcDH3dJYZFPywzB6fsYB0K+pBoypDCAh7LvxmHpoCY+aj0IS+xUuHgoITTzi3Bk7k3M2htB5squMPpvkYlg9QN/iu9PsFaDHmo6LYqz371sGMtp15zCkpsqn5J+Byca9bLGmUFRMjIXQMTPtrspEDbWzMg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Currently, page table information is stored within struct page. As part of simplifying struct page, create struct ptdesc for page table information. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/pgtable.h | 71 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 5f36c055794b..1f92514d54b0 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -993,6 +993,77 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma, #endif /* __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION */ #endif /* CONFIG_MMU */ + +/** + * struct ptdesc - Memory descriptor for page tables. + * @__page_flags: Same as page flags. Unused for page tables. + * @pt_rcu_head: For freeing page table pages. + * @pt_list: List of used page tables. Used for s390 and x86. + * @_pt_pad_1: Padding that aliases with page's compound head. + * @pmd_huge_pte: Protected by ptdesc->ptl, used for THPs. + * @__page_mapping: Aliases with page->mapping. Unused for page tables. + * @pt_mm: Used for x86 pgds. + * @pt_frag_refcount: For fragmented page table tracking. Powerpc and s390 only. + * @_pt_pad_2: Padding to ensure proper alignment. + * @ptl: Lock for the page table. + * @__page_type: Same as page->page_type. Unused for page tables. + * @_refcount: Same as page refcount. Used for s390 page tables. + * @pt_memcg_data: Memcg data. Tracked for page tables here. + * + * This struct overlays struct page for now. Do not modify without a good + * understanding of the issues. + */ +struct ptdesc { + unsigned long __page_flags; + + union { + struct rcu_head pt_rcu_head; + struct list_head pt_list; + struct { + unsigned long _pt_pad_1; + pgtable_t pmd_huge_pte; + }; + }; + unsigned long __page_mapping; + + union { + struct mm_struct *pt_mm; + atomic_t pt_frag_refcount; + }; + + union { + unsigned long _pt_pad_2; +#if ALLOC_SPLIT_PTLOCKS + spinlock_t *ptl; +#else + spinlock_t ptl; +#endif + }; + unsigned int __page_type; + atomic_t _refcount; +#ifdef CONFIG_MEMCG + unsigned long pt_memcg_data; +#endif +}; + +#define TABLE_MATCH(pg, pt) \ + static_assert(offsetof(struct page, pg) == offsetof(struct ptdesc, pt)) +TABLE_MATCH(flags, __page_flags); +TABLE_MATCH(compound_head, pt_list); +TABLE_MATCH(compound_head, _pt_pad_1); +TABLE_MATCH(pmd_huge_pte, pmd_huge_pte); +TABLE_MATCH(mapping, __page_mapping); +TABLE_MATCH(pt_mm, pt_mm); +TABLE_MATCH(ptl, ptl); +TABLE_MATCH(rcu_head, pt_rcu_head); +TABLE_MATCH(page_type, __page_type); +TABLE_MATCH(_refcount, _refcount); +#ifdef CONFIG_MEMCG +TABLE_MATCH(memcg_data, pt_memcg_data); +#endif +#undef TABLE_MATCH +static_assert(sizeof(struct ptdesc) <= sizeof(struct page)); + /* * No-op macros that just return the current protection value. Defined here * because these macros can be used even if CONFIG_MMU is not defined. From patchwork Mon Jul 31 17:03: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: 13335105 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 79A76C04A94 for ; Mon, 31 Jul 2023 17:03:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 013B76B016A; Mon, 31 Jul 2023 13:03:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F073C6B016B; Mon, 31 Jul 2023 13:03:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE51628006F; Mon, 31 Jul 2023 13:03:52 -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 B9A7F6B016A for ; Mon, 31 Jul 2023 13:03:52 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2431D160BA5 for ; Mon, 31 Jul 2023 17:03:52 +0000 (UTC) X-FDA: 81072529104.02.D7E6EC1 Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) by imf23.hostedemail.com (Postfix) with ESMTP id E8B0714005E for ; Mon, 31 Jul 2023 17:03:44 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=qbkWgPPi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823024; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VFdcrIV5fIYEpRddOkWey4lp7uyipkLol3FVSysO4BI=; b=mQwCfLv031+ucjdm4s9x//+Lk7G1PROpyw7OmD5Yc9ShJZK/9PsKODesBEet4/xtiYEygW BFHAiozHo5FbXiqdyyjOwk8Gr7Ugw88VgUMgtnvcNmfga+gYIOn8oakf6QbMAUEKQBMh6d XdZsuN9XfGOhCqjiz7e1shcwioIihAc= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=qbkWgPPi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823025; a=rsa-sha256; cv=none; b=Z1QsU6pfyglgKjLzk7ObnkpvARBPDkngtXK89kWgKzUNC63vjbMkz/T5Yl8Phq57GYRu4Z nK+wnbhs9qMzS5YR2Qgnt9h1oiVAKNa4Qd8t1P6ziuXdXvf+10Naz0sasFJ0gKjIhmTTog 3Hk+3UvfHP5tI+1bGTIErQ8ENGcssDo= Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3a412653352so3268562b6e.0 for ; Mon, 31 Jul 2023 10:03:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823024; x=1691427824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VFdcrIV5fIYEpRddOkWey4lp7uyipkLol3FVSysO4BI=; b=qbkWgPPid91ZIqftmFBBmjJpzv1I3nAFAPBn0iBZaDKWe1uvfhJ+1U6gJ1dsLe9k8G l7DrOCf7gRM2soqiMO44q+s7bgylkU1tiwFZ3vQhRvXR3+IrbpHWwADlXg073Kn29aGv 6jR4zaER3rVUUYb82D2jgMMbIjrJfkA8xcbPoOTkfTIUXCyNCW6341Yv7mTjWmt8YXjX DVSekNPLiQ7ZuAQU0alRNEN5s2nYABPtXl7psWq2PhJX4A2iw0iBhsPbgh2IFaJwQPd6 Ps6PTryX22bfzx7R3yw/niv4PjS3JpDK+9o8KFnsL0mYZ8+z5MK8XDbxFsJbw1tC6wxV bU+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823024; x=1691427824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VFdcrIV5fIYEpRddOkWey4lp7uyipkLol3FVSysO4BI=; b=UNEkhbEOjfWWxxu2EiV0XOjY6k2BQ9tdmMeDhDZ1s6afmeBOBoPmV7vzqQ1pKcrXyL lazvk5mME8i9NSqVaDy10pLazmE6AIJl5lrk4Ow5rv4tEQopAaobtBGJCXlIHv4wNJFJ yR5HjCxwvF2c8JIYtrkSD6YLuDQSzoVoUVwR3RSinack1Th7hf7thP3WXjYH0OOW/bQx Czz+tnv35/N8phlCeB4007tdGbkBXOqj1MnRBqLbfeqVXr3/0+tinTmV0wdWkjBC8pwh ksrd+eIB0EzrxFzz7ptDfdHAL7GB3Rk99W5X8DFbPEYmzuOgkBBfXuxQBm3Phaij5UC7 3vVg== X-Gm-Message-State: ABy/qLYH3s/jpjdCLgIHxPeMfqjsANLHgdmqX6o8zB5prufunOvm8qbC WUOywK62Qfe/Kf9hdwj0J+w= X-Google-Smtp-Source: APBJJlEPdsci4ZilX3NjM/t6a027bxaAHpHiS1b7Xz7FAoJRqjVPugqaYGEb4Qj9r/gbUH4WVN8xpQ== X-Received: by 2002:a54:4d8b:0:b0:3a6:f876:148d with SMTP id y11-20020a544d8b000000b003a6f876148dmr9790509oix.8.1690823023801; Mon, 31 Jul 2023 10:03:43 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:43 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" Subject: [PATCH mm-unstable v8 03/31] mm: add utility functions for ptdesc Date: Mon, 31 Jul 2023 10:03:04 -0700 Message-Id: <20230731170332.69404-4-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: faasbegaroy48ky6oe8g5y1kdwmhxyo5 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E8B0714005E X-HE-Tag: 1690823024-496550 X-HE-Meta: U2FsdGVkX19SAdhK9V37LE4XvZScBtPTD8y4NNrDiKxf71kdIUa+2TKXzT9YlN70Hk6quNmZN06QeoRMreTYM6tTG/LLAfmz8PnuH7sEhUn8dolwrN6czYWEUu8h0iIOfBCS+arCw8BBEP+V/tS8fN25sRYMgyVA3Z95d/S+aKoe4OTnrX69KErwrQM5CtKEBXUlokceaN0WYj8Il5TmQ5pI/68cr4jA8XCmnoV6DGrsh8D/T0ObxMPg/3UYI3a8w0CGjXut6A9jDaV/Y3dfCGpp36wAKB2sG+96nbaHkAQajombDXexjztIbcuERoSKRkdL8J/YNSPyHpdC4a3GZAwyYBBNG0BrdFJLs7Hxxh444yqIJWwYXhAlUWP5A74rM5R81JB1aPW3C5NpAxXy1yXwVG77sn9b4z7eQQe+43R5dRtakUgnJck6pVN2CUpXOxqSjjnWjnVwzGsxJL1lxm32CshNAgG8I7bphw6u+ubrpdVFmpyAwZATnC+6ufwFGgpbKiyp2gJKJO3Ak3lUAzkGNBBv8Cdn5o5dxp0KHlvcputUIPvekhh7Ya4/JYWCAxpDmoyZ2WUtynQmXXMKY07b+n1bPwKTFErNw8ugeaxoGeE8Olf2FkOQwfXZSecB2DzrWfywWi5TqaGpMnEjxAfws3U9pNKXWqrlL34RXObf45T/gM0Vd0Ypm7IHHjfnhgkxhojRB20n9I39lgT2Gpij6cwJcm4s+rAcW/VkRZuLfVLanlROFg1h9Zd8E7VKZrlQMXfRq02GyBQuN4nLTyR+wIpcXaBicouJX0/S8vy3kZbNz8sGv0AmxngrKZ46fi08AItOMGMGDqExSD4BpJL2SK7pw4Le7y5t9fK4094Z2KDzRby2Jcpcelhm5n4nZwO3gt13G7+2iFyK5zeGMBSoJfDAx0unHUYry/UyD+q5GfvjyWmylTMPnEnFKgoih1lsa/FRIeR72Qn3D81 hjB34pvx vFxhbwBCOseD0o6CJDRpmZHXX1vecJZ7wZByR5pxYwqtuDSCyz3r7sZ8gP4Nyy3fqb/XhuLgUimAN+BtMnF5WWaoUzp3xhkhWqL0VhWJIMd+q/nUupQlyBwqGJ8y2iBXBwIjRPcdL0bYWmnJzf0t6pjPmVfAetMZBLc0+Np/tjDYqc4/z2wIMWkKdfHESlC2zns6uFxZMOxJNPnOjjEeui05LgVCfcHR5pq4BYlua2g8POYzNV2rZsF0VRr0xO9GiZ9HlbqQoTgBDYzjWVyzFGgwVkH9o6tgHD4VDEdQK/iOfsJNb97b00b0wI0BH2GO0s0IWiHceRg6RUBK2jmQkT0TeyHHnjQX7qRhbxsC69xVKVzh84bnPVlXclToBWtw/gZMV7I1oSPm2KOPEBnlzXcWLmWYBVY5/RuhD9cQMt84k1/wf0hIAbScIQeXYmqYa8mRbpsYKWI+nkI5qOut6L9Ah7PCQzR52Z+cuiMDo2rg7pJ79BeFdRyd29sRcz2yRLXJ+JB/YVdukgxPNWqr+HE3YeQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Introduce utility functions setting the foundation for ptdescs. These will also assist in the splitting out of ptdesc from struct page. Functions that focus on the descriptor are prefixed with ptdesc_* while functions that focus on the pagetable are prefixed with pagetable_*. pagetable_alloc() is defined to allocate new ptdesc pages as compound pages. This is to standardize ptdescs by allowing for one allocation and one free function, in contrast to 2 allocation and 2 free functions. Signed-off-by: Vishal Moola (Oracle) --- include/asm-generic/tlb.h | 11 +++++++ include/linux/mm.h | 61 +++++++++++++++++++++++++++++++++++++++ include/linux/pgtable.h | 12 ++++++++ 3 files changed, 84 insertions(+) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index bc32a2284c56..129a3a759976 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -480,6 +480,17 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) return tlb_remove_page_size(tlb, page, PAGE_SIZE); } +static inline void tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt) +{ + tlb_remove_table(tlb, pt); +} + +/* Like tlb_remove_ptdesc, but for page-like page directories. */ +static inline void tlb_remove_page_ptdesc(struct mmu_gather *tlb, struct ptdesc *pt) +{ + tlb_remove_page(tlb, ptdesc_page(pt)); +} + static inline void tlb_change_page_size(struct mmu_gather *tlb, unsigned int page_size) { diff --git a/include/linux/mm.h b/include/linux/mm.h index 2ba73f09ae4a..3fda0ad41cf2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2787,6 +2787,57 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a } #endif /* CONFIG_MMU */ +static inline struct ptdesc *virt_to_ptdesc(const void *x) +{ + return page_ptdesc(virt_to_page(x)); +} + +static inline void *ptdesc_to_virt(const struct ptdesc *pt) +{ + return page_to_virt(ptdesc_page(pt)); +} + +static inline void *ptdesc_address(const struct ptdesc *pt) +{ + return folio_address(ptdesc_folio(pt)); +} + +static inline bool pagetable_is_reserved(struct ptdesc *pt) +{ + return folio_test_reserved(ptdesc_folio(pt)); +} + +/** + * pagetable_alloc - Allocate pagetables + * @gfp: GFP flags + * @order: desired pagetable order + * + * pagetable_alloc allocates memory for page tables as well as a page table + * descriptor to describe that memory. + * + * Return: The ptdesc describing the allocated page tables. + */ +static inline struct ptdesc *pagetable_alloc(gfp_t gfp, unsigned int order) +{ + struct page *page = alloc_pages(gfp | __GFP_COMP, order); + + return page_ptdesc(page); +} + +/** + * pagetable_free - Free pagetables + * @pt: The page table descriptor + * + * pagetable_free frees the memory of all page tables described by a page + * table descriptor and the memory for the descriptor itself. + */ +static inline void pagetable_free(struct ptdesc *pt) +{ + struct page *page = ptdesc_page(pt); + + __free_pages(page, compound_order(page)); +} + #if USE_SPLIT_PTE_PTLOCKS #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); @@ -2913,6 +2964,11 @@ static inline struct page *pmd_pgtable_page(pmd_t *pmd) return virt_to_page((void *)((unsigned long) pmd & mask)); } +static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) +{ + return page_ptdesc(pmd_pgtable_page(pmd)); +} + static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { return ptlock_ptr(pmd_pgtable_page(pmd)); @@ -3025,6 +3081,11 @@ static inline void mark_page_reserved(struct page *page) adjust_managed_page_count(page, -1); } +static inline void free_reserved_ptdesc(struct ptdesc *pt) +{ + free_reserved_page(ptdesc_page(pt)); +} + /* * Default method to free all the __init memory into the buddy system. * The freed pages will be poisoned with pattern "poison" if it's within diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 1f92514d54b0..250fdeba68f3 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1064,6 +1064,18 @@ TABLE_MATCH(memcg_data, pt_memcg_data); #undef TABLE_MATCH static_assert(sizeof(struct ptdesc) <= sizeof(struct page)); +#define ptdesc_page(pt) (_Generic((pt), \ + const struct ptdesc *: (const struct page *)(pt), \ + struct ptdesc *: (struct page *)(pt))) + +#define ptdesc_folio(pt) (_Generic((pt), \ + const struct ptdesc *: (const struct folio *)(pt), \ + struct ptdesc *: (struct folio *)(pt))) + +#define page_ptdesc(p) (_Generic((p), \ + const struct page *: (const struct ptdesc *)(p), \ + struct page *: (struct ptdesc *)(p))) + /* * No-op macros that just return the current protection value. Defined here * because these macros can be used even if CONFIG_MMU is not defined. From patchwork Mon Jul 31 17:03: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: 13335103 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 1CC70C04A94 for ; Mon, 31 Jul 2023 17:03:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC18E6B0167; Mon, 31 Jul 2023 13:03:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A739228006F; Mon, 31 Jul 2023 13:03:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 939716B0169; Mon, 31 Jul 2023 13:03:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 81FE36B0167 for ; Mon, 31 Jul 2023 13:03:49 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4CA45120291 for ; Mon, 31 Jul 2023 17:03:49 +0000 (UTC) X-FDA: 81072528978.26.92B569C Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by imf30.hostedemail.com (Postfix) with ESMTP id D864980032 for ; Mon, 31 Jul 2023 17:03:46 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=LO7IgtMf; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.166.45 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=1690823026; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IUMUqbW/uAIHfn0G4toP3JCuPKsaNgXF+JjYaBSaBaw=; b=x773zQ3sBY9zn4606VKWW7rc0lGR6KP3F3Mv9k3nmEckgTF5HpPOEP/U93RmY6Euo/V2Yf 31CknRDJAXioSTkNV4cS/JKFEBAtuA75XTNQodHUHvCApYlpyDU9C9+oUKuTpL9BG9PMIx YSO899i89NV1seBWdw7ItBVOGAN09HA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823026; a=rsa-sha256; cv=none; b=nfje7MO0qalNkuym167ybgzClnDDCt2/m+HY/kddRB75hGINB0JjE6d4K5ehE3KURCF+is M1mAhkixs1cw6O4n+AoxTX0P9/gl5NdDtBuVfGRmzRi4JjMJglvHyw9M9vYeEQQrsIJ8xe /esgNoyTxNt5lMw1lZinPNi2+JzYB/s= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=LO7IgtMf; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.166.45 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-78bb7b89cabso253100339f.1 for ; Mon, 31 Jul 2023 10:03:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823026; x=1691427826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IUMUqbW/uAIHfn0G4toP3JCuPKsaNgXF+JjYaBSaBaw=; b=LO7IgtMfV7D/5pieeNhzhX7jbefImFR1TuQgjSMNALZjO7jWhqLJ0NYlGohhp9vNEp P7qjRmM9tu3EiZV8IpnwyOsR5oR0G2xN8+6lkb99Xp3Pq2LKGQ1pnDBT3xTub9FDUFeD NiuludkMelWGqpPq5Si9scPBohunGQ7wjCbjn1MG6IHkoKqu0G6KIfhUmk1zbCODarzf JF+LluYmZmW6+nXXKHPD8kZWEQzzXdWA4gTgt31gpJPirIvHnT+QXlpNT9xuTR/Ob7I2 6KYVvpK8cyw965ouTwB0qJzxRQ+l2kkvuwks4w7hfsZgPcLfFUXNyqFPQAdsNQn7UH4p LAXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823026; x=1691427826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IUMUqbW/uAIHfn0G4toP3JCuPKsaNgXF+JjYaBSaBaw=; b=gU0z6MDEmI24YMO7qPHUCJqo/CBGgXtlfdQgAb+BSIYe0J4lDYTTlpHlOc4rbCpAna M3+RSH1HuzjazpUMmBXS7L9mhj9/itpOdzslFJx1uWUkyeeMk7MpErAPc/eUXE+JQBDC jcZPbQeE4Se7JwC2YWC+h5gWMrU6pYYQvK4ITKDeIC+QEaGrW0ZdCTK+NFap7NSFvXRE NdBv4kttQNUccIHCCLHCuQHbnUeQcGJu05Tc1v82lVA1/n+xrGE8ERIl1aZVK9Coy/Vh 2SRJJkw6dj29i8JYEw6os19nfAHal2tyiUoq6/4NP8zDxPa6Cvt7bChIUJYjYS2rk5JE 2icQ== X-Gm-Message-State: ABy/qLYF2MrQvySWPRiB/7D/qG00zONSzeCoxzmXmyq7HOsnhVQlvHru f6SkpZvRDejTpwuPUN10ji0= X-Google-Smtp-Source: APBJJlEWqZXE1sICWadhT2wO43hXTa2FHUgzTzYXN3XbSpmzVLjVyMFNIil8bQaSo4X4bLn1gewpKQ== X-Received: by 2002:a05:6e02:924:b0:349:2498:ed90 with SMTP id o4-20020a056e02092400b003492498ed90mr1956382ilt.30.1690823025849; Mon, 31 Jul 2023 10:03:45 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:45 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 04/31] mm: Convert pmd_pgtable_page() callers to use pmd_ptdesc() Date: Mon, 31 Jul 2023 10:03:05 -0700 Message-Id: <20230731170332.69404-5-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: D864980032 X-Rspam-User: X-Stat-Signature: 1ui8df8pj5jrm3okntowcsn56mxftfbd X-Rspamd-Server: rspam03 X-HE-Tag: 1690823026-760041 X-HE-Meta: U2FsdGVkX1/d4Q10xEslSj8u6CdZp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QS/Fy+kG1HDrUzFjm37aPPx+59Zz6RptijZPb67W43QrUhFuLK8Iuuj28+/065ctvMhpPrXnEMr6ud15CytvVdrSmQvRIvfOKT91frI89NMwfHgil68dL45ZYQzod9HwWdFRbJZj7Fp2gbZVCegzGk1rWvR8Qd9Mu9vquCvC/9pMqtmKrejuZASFIBTQIO4uEoj5i60ImYiHOdllBLhhl2d/JQ9qk4yfU4rcykIVOADIMxSz80p0GhYgoiPv/1ybzT/qWFbChuWPMzYRbh46d63VpxsN+05WpMPQj9RDxfe2Jgk5fcJgzAkASGy0iI+TWrQTmeSzZvX2mwZKvYGCq7YiEOBGdk1BEW6wXbFNCdcW1zpUW8r3sQvbJHmG3Fb7RdrOYr18f+5NDtSma4i1LdKLCBP8yMa3RMHL1/VDcLhnn4Jrv223Z5+iRIBVZXn1YSDISx4/p5SAa82mjYI/yHP6d43zJE3n3QvrOPkhbIWHkF+IWIx8lJUd7jFtjBaoIwp5qUgCC4YWt9/p971O6FdRLVf X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Converts internal pmd_pgtable_page() callers to use pmd_ptdesc(). This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 3fda0ad41cf2..bf552a106e4a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2971,7 +2971,7 @@ static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(pmd_pgtable_page(pmd)); + return ptlock_ptr(ptdesc_page(pmd_ptdesc(pmd))); } static inline bool pmd_ptlock_init(struct page *page) @@ -2990,7 +2990,7 @@ static inline void pmd_ptlock_free(struct page *page) ptlock_free(page); } -#define pmd_huge_pte(mm, pmd) (pmd_pgtable_page(pmd)->pmd_huge_pte) +#define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) #else From patchwork Mon Jul 31 17:03: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: 13335106 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 DB58DC001DC for ; Mon, 31 Jul 2023 17:03:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7407C6B016C; Mon, 31 Jul 2023 13:03:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A19F28006F; Mon, 31 Jul 2023 13:03:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 51B406B016E; Mon, 31 Jul 2023 13:03:55 -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 3D09C6B016C for ; Mon, 31 Jul 2023 13:03:55 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A55B9A0345 for ; Mon, 31 Jul 2023 17:03:54 +0000 (UTC) X-FDA: 81072529188.12.E1443B8 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by imf18.hostedemail.com (Postfix) with ESMTP id B61531C0025 for ; Mon, 31 Jul 2023 17:03:48 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=XxfUVCtc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823028; a=rsa-sha256; cv=none; b=2IUls45invT3KtxagcsoDjgxIDYPh+xa8V0iJkjHZBkZPf4CmwGpKFsKWfT+pPsp/KZRMg I8JksPggu3opk7R7d1zhIQgayIzBzf8Bgt7YNWxf+zOgAnDoKf7VMuIQXfUZXW04AZGIZo mCz650XeSOJo/faF4BbrRNmeAu9gWCU= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=XxfUVCtc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823028; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hLtCJBysrabsGyMeKlbK2lKTjEzHhmjaMpElw0hOQuQ=; b=uOdutrLiG/dqjh/SaTAzPRdXq20NA/2OUpE+o/D6vjDT12nn4zlZnfrNaV11TBlzJungHD SQX1Mdg+BrMWHGdvBCv6x1Jiew2+2HeNxsJFReKP2zu/vAAjO74TRz2z5dFQ9KQg4nBjVC C4mgQK+k3mbmYTD9O5RKX3+E/EdFJMA= Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-d0548cf861aso4902361276.3 for ; Mon, 31 Jul 2023 10:03:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823028; x=1691427828; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hLtCJBysrabsGyMeKlbK2lKTjEzHhmjaMpElw0hOQuQ=; b=XxfUVCtc+QbMuKLsIQZYFotQjD1uPn39bJPNzHnLSpRxaT3fJeSLcUYSJwnJQ3Db/g leWI/21K6KvWZhIzEH7DHukGj5D7XdCtwzeO763ZUH4LeT7PuPE1GzPcQcYVnv/vf13j n79Pu8SKl7LjDKW1vidx9U3g5HX3hsbCLIInKKKoydsrph/bfVYnRh1jLyq8obFjpp4I 8/fNfhvrK0O+QQmUluanQgTc5DFDNrxKYjhdFJW8WfDVLkfAQZABhu93QV+IfN33Z8yL iOGQEq8tdk7NtoCkxwkrl9w2lNi5iRHnhmaZ+oTac0bEezCH6FvgLddmkBsJ59So10Oj RPOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823028; x=1691427828; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hLtCJBysrabsGyMeKlbK2lKTjEzHhmjaMpElw0hOQuQ=; b=OgsTtBNh+ojdzbUEJJcVVObuyACp0cZKbvG7pf9bU1zNTZVTuyOfPLSgE6KAQH6ggv 4gqasunS4eIrtQ666seb3izOrfejKYMB6Nrz+yxbElub/U+iNn31pdRyuIy4TFtU+A/J A8yVTPQEg+P2Ryt4QsfBU34xPD6yva9l9mn86DNmNCWppvyttU2JdAT220fnWGBMaCcz l7ufVZFmM22sog3fjjBTl5uUpIsrytnB/WqjcXERHbnX/Yh5yTmwyAgteDlEgIfLzagO pbO0Xp8p+PpSqyBHpZwDTw6s1xafL9DYAWNaQhYXbWCE/tNLJfcZSs1+F7lmhddAfAU3 eN+Q== X-Gm-Message-State: ABy/qLbNqoB1nvQ8unCSd9y6Ku5flEfagrnQueW0citOMQcYRgOLvDPU QORMcXjmrxb4bAzAbXc2CTQ= X-Google-Smtp-Source: APBJJlGaLQRI5Q0HqdaC/SmgbvgNuoyQchTQtq0hJYQ2S7wch31RC4bpLlQZjYY1DDyT4+2cD/rUkg== X-Received: by 2002:a25:9bc8:0:b0:c91:cc0e:1aef with SMTP id w8-20020a259bc8000000b00c91cc0e1aefmr8613166ybo.58.1690823027825; Mon, 31 Jul 2023 10:03:47 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:47 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 05/31] mm: Convert ptlock_alloc() to use ptdescs Date: Mon, 31 Jul 2023 10:03:06 -0700 Message-Id: <20230731170332.69404-6-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: B61531C0025 X-Stat-Signature: j5o93met8j848wb66fac8s1zft8554m1 X-HE-Tag: 1690823028-548253 X-HE-Meta: U2FsdGVkX19gK/F+LoIa3Me3d93ecJ14yCseVrcRC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BQIq8akDYKoNyfj4MGf5F+pmgu62NC2czeuy2HG9GUPVEewkqzElpddQ2pG+WwtsH/w5MJpvMS73FsYiDv7UGXBevay9FX/PlgQEyNYXG8M5clLfS1e+5yFqiSlgbC7SWxJRlSFfkGP0iyrlUYGzD0KKYyjNXKP7q3ip/LCfSNbStE7qJm9l3ku8es5x0iN+oxH6PXjJU/YbzxcsTZxUkJfPzg+8RMSYZUnT7pRm98zZxVwkbSBt6enJcRLdJ25qQwfFm/LSWggd4RzvytXuOh1opyishSFt9GPaPCf5NDEcvqpZqMr/apnv9aSYmyDFtsLNRr8lad/O/mxy5NWUvJUf+c5XgkrkCmdKTRGWgX/hdXp6a2MWmZu5nMWvHwWa8ZW9Z6/Zx2PJ50FpAwA3lrhudL3ddL3sEVWvLUe+3kCjgstWjtYmaSH4zsdSLTAgoW6Fekzbtt8gGdvCA2Vw2PdqrQi0A5eHGMTs9DJaSa8ReFPVx7R/JVT3ff3pTsihHtlprYEIlVpgKWGZf4G/GfBGJGukII= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 6 +++--- mm/memory.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index bf552a106e4a..b3fce0bfe201 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2841,7 +2841,7 @@ static inline void pagetable_free(struct ptdesc *pt) #if USE_SPLIT_PTE_PTLOCKS #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); -extern bool ptlock_alloc(struct page *page); +bool ptlock_alloc(struct ptdesc *ptdesc); extern void ptlock_free(struct page *page); static inline spinlock_t *ptlock_ptr(struct page *page) @@ -2853,7 +2853,7 @@ static inline void ptlock_cache_init(void) { } -static inline bool ptlock_alloc(struct page *page) +static inline bool ptlock_alloc(struct ptdesc *ptdesc) { return true; } @@ -2883,7 +2883,7 @@ static inline bool ptlock_init(struct page *page) * slab code uses page->slab_cache, which share storage with page->ptl. */ VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); - if (!ptlock_alloc(page)) + if (!ptlock_alloc(page_ptdesc(page))) return false; spin_lock_init(ptlock_ptr(page)); return true; diff --git a/mm/memory.c b/mm/memory.c index 2130bad76eb1..4fee273595e2 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -6231,14 +6231,14 @@ void __init ptlock_cache_init(void) SLAB_PANIC, NULL); } -bool ptlock_alloc(struct page *page) +bool ptlock_alloc(struct ptdesc *ptdesc) { spinlock_t *ptl; ptl = kmem_cache_alloc(page_ptl_cachep, GFP_KERNEL); if (!ptl) return false; - page->ptl = ptl; + ptdesc->ptl = ptl; return true; } From patchwork Mon Jul 31 17:03: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: 13335118 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 A61BCC001DC for ; Mon, 31 Jul 2023 17:04:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8686280070; Mon, 31 Jul 2023 13:04:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D0ABA6B0180; Mon, 31 Jul 2023 13:04:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA9FC6B0181; Mon, 31 Jul 2023 13:04:16 -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 A7BF36B017F for ; Mon, 31 Jul 2023 13:04:16 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5D4F540645 for ; Mon, 31 Jul 2023 17:04:16 +0000 (UTC) X-FDA: 81072530112.11.9DB790C Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by imf22.hostedemail.com (Postfix) with ESMTP id 03ADBC00B8 for ; Mon, 31 Jul 2023 17:03:50 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=HGhOeQ1T; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823031; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uNVCmnQN0ufsotHop6mLPsVoSXSsgvYy2QMaIqEOqi4=; b=LRX6nkS7BWsepdnLDNkmZpE1Rr//3xMWvJrGDhxaLEZXBNpUL0qp0GjPAkuT7dptN9udZR o87hal9F1eAajArKgsUfnVJ7xapBuMqtDZJoPKqsCNS7Z+WluZUz+fu31ZbslHGL/fSLKp rAgYT36CydWzHWUIJuaztXKpET3WpOk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823031; a=rsa-sha256; cv=none; b=Uc8cYWFMXto4nO3OwernkS+S+odcc3pZEKHXvumDm2ViNRfXghbBbmblwMicZr8Tx3/zew oZ6gyqZhWhl3vj4GxwEQNduRvMay/OqIUZHxzjvWMGEQLOYvd1BYW5gbvPbqrtaYkioiD1 UM/Fq3J63297jgZudWgG3rJs/Lcjx/g= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=HGhOeQ1T; spf=pass (imf22.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-cfcebc33d04so4865293276.2 for ; Mon, 31 Jul 2023 10:03:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823030; x=1691427830; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uNVCmnQN0ufsotHop6mLPsVoSXSsgvYy2QMaIqEOqi4=; b=HGhOeQ1TmAKeV2HnCN1WTfuLUUGtIM4rPFVA9FLFfXc9y1teMeCMXYfLrn52VreEZa +8fuD8Eo9GHKIiGXji1nVJr6hJp1UgozAoPycNtpjPeWKRtcHWia112SYBPlfjErevM1 f1KBsm+b9biDP/8hsnmQLIxx1WqbIsap7/B5vxAAg5UayZGm1/xCMe4ANNoVXkXqO5f9 zYPLJX2R/yJdpXd33yeHG335BLgfWD5asDdFJsvc7qa94OZvu247hqr11p/tySJkF1N3 XZqqjnjnJwS4MTyfAeLK5z9Se8l+uTUdMKVbakuD0ppwzC8LFvwdJ3Q2bHVnQ+Hr6zUD fqZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823030; x=1691427830; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uNVCmnQN0ufsotHop6mLPsVoSXSsgvYy2QMaIqEOqi4=; b=Qr4axqqB3k0cpVmbJP7Hi2VxLzHMBM/T0Sn0G42zL8wTl3ctmH7PCSbRNm/UIOVHdK 8aguTvND82unmix4jiHATtCpV0H2MYlb0S0n3+4tTTun1BhCFuN8zC2aKOh0FurvkDzC FKkUxdAUQWWvBuX6bOcuPIFyYGG6zpgW+vrxqirNKIJ52yFWExmN/Faut7gPJ7gkk1C7 NGWwFrqm/E9NsU4Rg0S0pilxxPfJ0mHE/NqZoC7ePacmY2QuHCY2auJJVjxR45UjIadp qPfl0dL3YJRav4N7T1SBDH6ipKvOp4WHtJyajizxL5DPDx4f8pIFCNjiFHbTHlHyV8Mr Fptw== X-Gm-Message-State: ABy/qLa+iEsuXSCqVuA2I/PqkM6LxFD+lZJO+2iir/GqOF+j8t2fou2M /dS2nbw0pF3ieeOqem/ZpV4= X-Google-Smtp-Source: APBJJlEF5eMDgJhVfaLglGwfP9JkFsRVPWZwav0NLe508KhOsIkmqr6LHjKMWH59Isg1gKZnQYYAJw== X-Received: by 2002:a25:ae5c:0:b0:c73:9f38:2b3a with SMTP id g28-20020a25ae5c000000b00c739f382b3amr9095220ybe.48.1690823029862; Mon, 31 Jul 2023 10:03:49 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:49 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 06/31] mm: Convert ptlock_ptr() to use ptdescs Date: Mon, 31 Jul 2023 10:03:07 -0700 Message-Id: <20230731170332.69404-7-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 03ADBC00B8 X-Rspam-User: X-Stat-Signature: 1spurfc4i3wd3qkyepiiqso7br7op3c1 X-Rspamd-Server: rspam03 X-HE-Tag: 1690823030-595889 X-HE-Meta: U2FsdGVkX19iwmalQjVCesQI0mMTzfDvHkkI86MF5c2jGRnBVrUpZvJtAf8evR7zzTwj+PbeoQbsl9vwyOPw+TScO2fpHd5w/TiT9AN0nWFPAl+luwfybICPqaMK0esgZ8yu4S0j6J2HiBV6LgAnBrJVzpkiWqQTwdJCX2CT4vT804h5Dxcr0VGAelbFN57U/gwuZnd10yGF/nrIxwSQqku3M0acNpa3uZ8NVZMQeHtEabfBST1YFl0ULBB2QVO90LHLtibCZnkEzp2OIhydVc8heCYCaJ8R92ljmxGofrWUKS7TyBfM740A6o0ab89fSl18crWnXoi9bNLIi/D7IOBFHOdSTzf1WRbInsN53QTYk3eCmk+6FkL1tC8KEEFw8R7OA2Qz08m48i3jG/hquYazjKT7KrM2HCTQaeJJO2NBG7FXEy6vAk4DpYjKe3UAotxWd0/K/CbEk62MriadRNgVLxW2y/LF/VVTusfg10ilUxmhbAIDhd9Qj+V7AAo8zw8DPLvwXkQDJb74FdxdXoihJ5blMcAIN8lEXedKRd03VBZVZnSHksQFXieSGt07MhTXpOpi6tHXnvAuPZrIYWLuCsqXNkggFmLeQVcCW5YIrwgLkPAPEUtpCnjI+15qUirNuhBJthx62CmJx3CxIKVW9Qm2lIgGMpmzUQa9XZcztK4JU1GSU93fUDn+ZbaEx+JovA3vVG7ltSdfm5zjrLbdAyutvdqbZZk9Nr6Vwdfn5fUVK3jn2Gzlm4zTFy8tG2qMThiDOxXJaQOyffBNruZXm8YWB7yWwk4ihaG/9dUpPcK8UCTNR9QkboHVumlGaZaLf6CV7/5z0UtYNRrr+U4XL2AY4U1cLZSEsNrnPfaXOPy+MXIax52pNkvdaVgrqIepH4rutSq6as0vq2FTnB3L6U29g1Hb8hnj6X5dpCggEC0Int+p5naAGkHUdqmJy6Ap0HNu6wjk6Z0jN3g wVYzcc4N Dw4w/qypt/cWuV3aJBqBDdF3xU0SOLXSf9iYDYX5tzji8pzVlU5jk9kh3qIMeKQ/h2RjYb25VfFwNxKAqjYfhJmm+scHATPIvllWXf3hoEXpPjIElM6tOBTChbwQZ/Hcg4J7X63n5lY5S06I5m+Aszzu4xWWJfv1KpKWD+RTlLc/lWCVFeo77PMVNCV6vQGQ5zwirWKvZTQuWGevUI/D+9RUREM3wXayCVplS0bDDHsbFxBtXqTib4CtY815gimULZG9XAxASZ+0uRj3F1MNebgmdNZiNbBe841mDBFPlzNdfDBe5EPQX4GZ4xPtJGfSGOpSY7SNRA501lr65kkQLypbqXTy7NoF1wj9hojnxYXxidM86R9ZERLKv3xwlTIkuRnvcV3JXmhqiIoFGBxevPZVapBvhonD74w9Qm6w2dylRAcQ3X+QH2IB90PnJV6Q9qO9Ap9pySOiaMSDgfra6rgPl2DGVpQ0vnDQyh7ook59VWxo4EYDbgaxlmej42jayAvvVOEVvRSJkUij5xo59gXdC80TP8ee3NbN7RJdGKy2HsYoItJO2WdFY6v5MCKkSAbC3AGbY240HXuPSlp/u8vRV+JA7mvHvBJFJdITCv1avS9WEK2kEtBYZh3qk5wdMHU+uSRsECa7xYpo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/x86/xen/mmu_pv.c | 2 +- include/linux/mm.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index e0a975165de7..8796ec310483 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -667,7 +667,7 @@ static spinlock_t *xen_pte_lock(struct page *page, struct mm_struct *mm) spinlock_t *ptl = NULL; #if USE_SPLIT_PTE_PTLOCKS - ptl = ptlock_ptr(page); + ptl = ptlock_ptr(page_ptdesc(page)); spin_lock_nest_lock(ptl, &mm->page_table_lock); #endif diff --git a/include/linux/mm.h b/include/linux/mm.h index b3fce0bfe201..c155f82dd2cc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2844,9 +2844,9 @@ void __init ptlock_cache_init(void); bool ptlock_alloc(struct ptdesc *ptdesc); extern void ptlock_free(struct page *page); -static inline spinlock_t *ptlock_ptr(struct page *page) +static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { - return page->ptl; + return ptdesc->ptl; } #else /* ALLOC_SPLIT_PTLOCKS */ static inline void ptlock_cache_init(void) @@ -2862,15 +2862,15 @@ static inline void ptlock_free(struct page *page) { } -static inline spinlock_t *ptlock_ptr(struct page *page) +static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { - return &page->ptl; + return &ptdesc->ptl; } #endif /* ALLOC_SPLIT_PTLOCKS */ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(pmd_page(*pmd)); + return ptlock_ptr(page_ptdesc(pmd_page(*pmd))); } static inline bool ptlock_init(struct page *page) @@ -2885,7 +2885,7 @@ static inline bool ptlock_init(struct page *page) VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); if (!ptlock_alloc(page_ptdesc(page))) return false; - spin_lock_init(ptlock_ptr(page)); + spin_lock_init(ptlock_ptr(page_ptdesc(page))); return true; } @@ -2971,7 +2971,7 @@ static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(ptdesc_page(pmd_ptdesc(pmd))); + return ptlock_ptr(pmd_ptdesc(pmd)); } static inline bool pmd_ptlock_init(struct page *page) From patchwork Mon Jul 31 17:03: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: 13335107 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 11AEFC04FE0 for ; Mon, 31 Jul 2023 17:03:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 348636B016E; Mon, 31 Jul 2023 13:03:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D06C6B016F; Mon, 31 Jul 2023 13:03:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 122F06B0170; Mon, 31 Jul 2023 13:03:57 -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 F15896B016E for ; Mon, 31 Jul 2023 13:03:56 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3D8C91A0AF6 for ; Mon, 31 Jul 2023 17:03:56 +0000 (UTC) X-FDA: 81072529272.16.F633BD6 Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) by imf24.hostedemail.com (Postfix) with ESMTP id DB28D18002C for ; Mon, 31 Jul 2023 17:03:52 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YUReldkg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823032; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=d0E0BACLvXh2vpBt6imfUOZqEuzu1odD4oW+AaIJCus=; b=XyGMUkk6KZOhyc0tzOX04gqiphUgXhEDTXOwRbR0u8lEYodTnFzlAZ9jo2AorxJLDMUylZ ImkchmZ4YfNjbbghJyqlchGLSszuPwV+dpvkf/V08mbMaaW/z7XCvjGhL4IE71fNkGbmgd r2f4f2VkdKitu7ZwIXADYrZnEkeGVMw= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YUReldkg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823032; a=rsa-sha256; cv=none; b=tl+yjrYbAto3h0TSfSH1KrxVGNU0hH1WS6RAE1qgc8tpXGn0/vkfOade2PczwL2TLUfUD+ 6qV/1mTJH5sS303ZB6kzgS3IgAYmTYtDeY/ucf8eDUpZYzoDjcWZJPXwyzlHTFNYu9xVx+ TgFVNCiG7oGUIAObLPfJkR6U2zClXps= Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-d08658c7713so5042696276.3 for ; Mon, 31 Jul 2023 10:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823032; x=1691427832; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=d0E0BACLvXh2vpBt6imfUOZqEuzu1odD4oW+AaIJCus=; b=YUReldkgnetLqvGL1NS71WdWnAzNWWYQnltnVm2rTkEUcOO9WrPWjz/VupfwLsV4R5 O5U+HAQBX2TEiL7rUmM64hTiM4qIIq6sg/drG9M/BGuBJ33Wydz1s/G+0U+eMZJumoRB f1161HPnuyBRb78dTfpgaCSHu9Qo0gegUmxh0kC4FT9lRFkm1YwjVBx9HbpfTIAYT8q1 zvd8Be582ZnNdhPs3i3IT6jC/uh09at7IMfH8Z/47sZBuFG6ajCrrTeAaD1eGKL98sQ4 Picd2DUZ0mNQhUFLQyvKhXnHde4rCRB/z+5yBj02B6B5K38q9rbIBp+H/OlzOyaGOHuW 1Lvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823032; x=1691427832; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d0E0BACLvXh2vpBt6imfUOZqEuzu1odD4oW+AaIJCus=; b=c2zxEDz6DMiDJaTaqwtnjvqL/lWoAeh5oQsjNgPSFMoBWWGU5OWdlvcAXcZqFJ2CnH mYNmIhhAkl/RVO7CMl5X0wWT1TRin6tofv7405p8k4gcvNzlCjgSjPkfqQHMNh5Hc9Lf 0sML6Xj2dyE6RvvsE3uHjKWjJWwHXUg9mIk2MSkKJ6fl0aSMrujBKtbaKVF4gODahn81 EHkFLgn1bOOUUC+5wUrjwKw1mzBr7M86LOy6lkfHy/8+45oN1BTCx0L4dwlsp0sK2zVw o1SdpGEeVoLp6wU2r8V2R/9uKZbV4hY5ANgrpwdbnoowsaIoOcWghznZ4pe41VZCFqVk 4wLg== X-Gm-Message-State: ABy/qLYUOFzpj1jW+mT44DAHl4lWfauoBDM1MRfx3xRZqjFIC6yMKCwf Ia4d5t6i9PJKP2dtybkrMU38I03Fc/mNeg== X-Google-Smtp-Source: APBJJlHh2ZxIPqvNCWcG3uzKtYIqmu+SYBCgcUqQThaKL5dLb97zd0arq7kj2mXQ9GbTc2zqN8ZRqQ== X-Received: by 2002:a25:84:0:b0:c67:5adb:36fc with SMTP id 126-20020a250084000000b00c675adb36fcmr11678833yba.38.1690823031787; Mon, 31 Jul 2023 10:03:51 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:51 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 07/31] mm: Convert pmd_ptlock_init() to use ptdescs Date: Mon, 31 Jul 2023 10:03:08 -0700 Message-Id: <20230731170332.69404-8-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: DB28D18002C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ietjkmqgq4q3nuekp8w3et6y51e4uq76 X-HE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R++Nk3KRYTedh1cNWLmjXrWebJnlt/Dp/Q/5PSjF0hFtoAqqYdOVzhoWNzpSGO0zcG9YcT3uq6HW8wFWCigjLmxo4s3LqcUY2Tjd+52nZ/vPy/zI48yDUO+rBWDyeOxkMVFRFnVndEltNsT95bjhVtfNP5gD8UaryWUeKVE3Kn6BT+G580Und0IGDcVy8vMXXas8JYpWozB0olWMGXAsFzQfoseOjcItY8/pQC2GNDE5GES0iCGk61hDuyqpesUKdDcqczceuVFT2RF1uVZnzXx5AlX8Rt4zDGHZArZ3bMgpij4JW0v1b+bxajqBsZD/jxVtFdzLTjhGAt64os/AVgAsPc+7YcYk8W71JhBnYUno4RtFSjfPaQ/bAxPPZwKm2HkmifkSF4NM5kzMwt82PzpktNINE6v7YNRmopS9BjLTGFna4JrZUwPN1p8bL49DvcsGZuxTWDQeSO95XBJ+aHy0MtvwMLq9R+UQUhq0a4g33j5VPYalf0vJ10clcE6LBC5ZFnlzbJqNxea8w9xUjF8GM2j/ZsjTdZxtZ09i/21Jx+G+OgwrnsjxI0bTued6hQzcOeV8qdsQuHzm/QRIAXg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index c155f82dd2cc..52ef09c100a2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2974,12 +2974,12 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) return ptlock_ptr(pmd_ptdesc(pmd)); } -static inline bool pmd_ptlock_init(struct page *page) +static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE - page->pmd_huge_pte = NULL; + ptdesc->pmd_huge_pte = NULL; #endif - return ptlock_init(page); + return ptlock_init(ptdesc_page(ptdesc)); } static inline void pmd_ptlock_free(struct page *page) @@ -2999,7 +2999,7 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) return &mm->page_table_lock; } -static inline bool pmd_ptlock_init(struct page *page) { return true; } +static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) { return true; } static inline void pmd_ptlock_free(struct page *page) {} #define pmd_huge_pte(mm, pmd) ((mm)->pmd_huge_pte) @@ -3015,7 +3015,7 @@ static inline spinlock_t *pmd_lock(struct mm_struct *mm, pmd_t *pmd) static inline bool pgtable_pmd_page_ctor(struct page *page) { - if (!pmd_ptlock_init(page)) + if (!pmd_ptlock_init(page_ptdesc(page))) return false; __SetPageTable(page); inc_lruvec_page_state(page, NR_PAGETABLE); From patchwork Mon Jul 31 17:03: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: 13335113 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 44277C41513 for ; Mon, 31 Jul 2023 17:04:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC4846B0178; Mon, 31 Jul 2023 13:04:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A71DF6B0179; Mon, 31 Jul 2023 13:04:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EAE36B017A; Mon, 31 Jul 2023 13:04:09 -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 7EE166B0178 for ; Mon, 31 Jul 2023 13:04:09 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5A962160A4F for ; Mon, 31 Jul 2023 17:04:09 +0000 (UTC) X-FDA: 81072529818.20.7549D20 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf11.hostedemail.com (Postfix) with ESMTP id 01F234005D for ; Mon, 31 Jul 2023 17:03:54 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="V/96hykn"; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823035; a=rsa-sha256; cv=none; b=T+CBVQonvKP+SNY/P3Zj09JX3Az/gx+awTnio0FoP5nlfLoWNgBGqB68XZh98L2F7trnsy z9xfhs3o+QxkKyYrO0GmyTybb7aaT2r2SZEpB7jJZuRi2W3Rd3J74tun7J3dbDJVRr0eJL o33/wZHYPf5mt54HZ2bcrb/jhMndoRg= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="V/96hykn"; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823035; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iy/rMhqpUcv/05FOZn+4srvOxwPFLEA5us+pK4Rb6lw=; b=6fLQEtJIyZPFJJ9s/wNawuNwvC8a74GT+zeAjXkVLj42lOZPD8T2cTbJwzjMIJEpmmsg1Z GkvhgqQu7JTmnQc/VuggIfqjXL80chyW7aPSwIptMMvn5bX9QzCKH5fswKJBPMUR6o16Np 1vyZ2g+hxQjbLzts53dVb7TXaySHtUU= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-bff89873d34so3787007276.2 for ; Mon, 31 Jul 2023 10:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823034; x=1691427834; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iy/rMhqpUcv/05FOZn+4srvOxwPFLEA5us+pK4Rb6lw=; b=V/96hykns8XVM5vLmRXG/u4xSypUgGiGwrOyC+rZQj+rcZ/GpgCOArv+BLqwnK6ndI s6FLSAxMDlFyUBDNQE2VhRek5g328y+/ccd+AsCeEjwXU0hVeTp7lQbn+jR0/Talq7yP X53eA6P253fr2h0Co5LkgUqrydVRI6I/ApD8z89cYAQIEmQbjgDCE+0t6nBNrgVReKu1 hKceHGETSaBcw+wqVyp5iupRKeJkqfupmvumPfxkbIwnP/D5j0bL4ZMnmoLVvjw3thur HGuYrC1zSSdz4NYzQoV0QVVrCZG7E5Ll8cUs/PSqUH3UyhbWaZjmYOzvlOZrxF4wqCJv qIEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823034; x=1691427834; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iy/rMhqpUcv/05FOZn+4srvOxwPFLEA5us+pK4Rb6lw=; b=E1dppH+h7H1LPStPmn/RnH2gUMSpuTe0OKwZrPviU2rwHd6pw27PQdbb0mTiFM33gm 6yZQM6+zcT5YKG3PD/00VL200tbe5Hf6U9/RIdQUTzdlanBTZugkhOUne8xF8YxVEzr2 BZyx4SzkmIBY7P3rMPe7AFgc5gx9ZrR5XkQ9GEfFiV3OHnKLaIOt7u2frc7QYmsUklQA TptKlQCq4BvE51c10BRUrRZuWOU85LHyMZUC2uoOvIdIoG0knx6CtsYuE6gQIcx8FRu1 wzfC20q4eGsGIIx9EY/temhMGssnPAMQnX6jOIMTPWa0pNekIzTUNfBC/fzE7MtYGsT+ 0nIA== X-Gm-Message-State: ABy/qLZ7NKddjscModK0V8mGNEpaN9FNYaiOVFG8fHMaF3WvZpDX+UrR azuKFtMNT4B/4Jf9eU6+ywc= X-Google-Smtp-Source: APBJJlFl3cMRdcyGTSqylTcgbFymQPUIeV+vjMCwSs3kC0GtKDKYI1e8i0USnYA5QForqJcTrXzM0w== X-Received: by 2002:a25:908d:0:b0:c67:5aea:97ba with SMTP id t13-20020a25908d000000b00c675aea97bamr7117064ybl.50.1690823033777; Mon, 31 Jul 2023 10:03:53 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:53 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 08/31] mm: Convert ptlock_init() to use ptdescs Date: Mon, 31 Jul 2023 10:03:09 -0700 Message-Id: <20230731170332.69404-9-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 01F234005D X-Stat-Signature: xnjmcmfr57idrpwep3he78ytm6ke9r8k X-Rspam-User: X-HE-Tag: 1690823034-874908 X-HE-Meta: U2FsdGVkX19SsyJi9C9PWeyoq1C+Uy2G33SkXSBme4nwmq2kQEy02cTs3TB/zuWfY2y2e66rSGcFzKis1ieQ2IAQxwmTUCyrijAifQXJjXq5GJeUnA90kqzuJUyOuPGmNxAWxiKrYD6zmronvfgvsPiTucnKaZW3cB6IvGSjgnuNpwwLrSy6vpo8sau/7Z3pAuM6QmgwlsdH0OABlfC8rvDsra7SIPBnsG3b0mBVWDPEVAXdX3VG9bOqFw49D/usiqpzE2qv4WvDZgP1a3GTg5ri2eslkli5Ia07Twmqk/tnEP6dxm401ESfg0F7sNxCP+IDM+gX/unIg9GPy1jMuO1Vf437LAWB9rUDRsCHgzLfDeJ9l5nzDffbb9yJCPVp+EjtQk2+D5NQ7+YoArYukg8ILySfypPM4IfFlcYKCPUAq5rLEQgf/8RTZHMLfL9+AWaFMJN4ZkJ8Qp5h+wsxt6jSh9Mxyd1A8pqUNXwVa7MMSU0rQnAgytoADBpGOEVShAz6BCj23USM9x7tsK7MD45zMdIxRne0f2r/w+wK4GIxYdF/5PAN/3Y6GM8H+h0/wLlN0p03N/JWu+DzF8yZ6DJUJ1J3AGNMLmu4O9dylbxyXSOur+xEbhvjTRDonSKbCxFQgvidqDHqap9E+gfxnmJwI23Slr+pqOr5O+83xq6z8k5FMxPhte+Qf//i1NgsfEc0c8OO5iQiJ0R7im08RCR5ed5GzepB0+1mLysDXbVQI6CUgFD/KAAm7IwitYTHHVhpU/leqT8yvpU3gTP9dWtHylAZsKc5PQG9AVMTX9j9NtrUOS97TyCz2YGD6GnxrcHvpGRj83J6CPX5UwkWLDSb+58xyt5CxvtkW3T3gX4Uk0kcJ59Q7Ww/dIEu3cOrL8pPGc6rzCA9k0fFS0GpbuwM24gspFPvlL0hsbaLf76lrd9GvdYHt17dAmtGrApqUEY4yBTKmBy8l9zXs6U 0nBCo1rd +8Cm4lc7RTwZqm5TT39uFIylOR5m1G91J83B32i282QOiVUZDRHsWCfVOd7iDRNJUTzP3szPcdUn5L52AWfRZQMJXSOPVwt5jUzmX3jp/Hpb9uFjfW9QkYjXHdkjK6MmL13oaAXOgIp6k7xMvo6xHS/8MkBXOtS6OtevyRf5tMe94MiCjH0BHo9BrJWQeCzssrd0czSB294xDQs76Ydlb155S3YrOI/qYc2eW/u7plSlXWpx5X3UuWQvJAkSfjV5wAh5TWEnAFINYiS5dQvARxmhlONMeK5zDcGM/AtRNEX9/MP7qtGFfPSMK1uuA96I7LV36xHzREhKdi+B7sgyxDC5MKZPxNfA+2t5RhkZfGfnL/amZgMD2fkhUdQ+MrCVTETX1HqLs0z+41TPLISB0EZH0OJEnTKUOmPqYMoSlYytoIsTE9NnxbYBsCQNKpfT0RmjK5h32BXHoKFGGRXyfAii+gLeBVztngrP20gmddGiksHAXwHmnpSRXihU+jR8tLjoc+sP2K7JCtsKSWK2z1Br989tuwol7RYNua3JcX2vfLMGbnL+6F71WvortcxnrI6D//lVpvyD8dVcOvs/UZf4g7Bm3eaVYNfbWo3u8iRhsA6KI0G6gbNpXhsoZrrRHqE7vWXpWgjwEirU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 52ef09c100a2..675972d3f7e4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2873,7 +2873,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) return ptlock_ptr(page_ptdesc(pmd_page(*pmd))); } -static inline bool ptlock_init(struct page *page) +static inline bool ptlock_init(struct ptdesc *ptdesc) { /* * prep_new_page() initialize page->private (and therefore page->ptl) @@ -2882,10 +2882,10 @@ static inline bool ptlock_init(struct page *page) * It can happen if arch try to use slab for page table allocation: * slab code uses page->slab_cache, which share storage with page->ptl. */ - VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); - if (!ptlock_alloc(page_ptdesc(page))) + VM_BUG_ON_PAGE(*(unsigned long *)&ptdesc->ptl, ptdesc_page(ptdesc)); + if (!ptlock_alloc(ptdesc)) return false; - spin_lock_init(ptlock_ptr(page_ptdesc(page))); + spin_lock_init(ptlock_ptr(ptdesc)); return true; } @@ -2898,13 +2898,13 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) return &mm->page_table_lock; } static inline void ptlock_cache_init(void) {} -static inline bool ptlock_init(struct page *page) { return true; } +static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } static inline void ptlock_free(struct page *page) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ static inline bool pgtable_pte_page_ctor(struct page *page) { - if (!ptlock_init(page)) + if (!ptlock_init(page_ptdesc(page))) return false; __SetPageTable(page); inc_lruvec_page_state(page, NR_PAGETABLE); @@ -2979,7 +2979,7 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) #ifdef CONFIG_TRANSPARENT_HUGEPAGE ptdesc->pmd_huge_pte = NULL; #endif - return ptlock_init(ptdesc_page(ptdesc)); + return ptlock_init(ptdesc); } static inline void pmd_ptlock_free(struct page *page) From patchwork Mon Jul 31 17:03: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: 13335108 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 82B20C001DE for ; Mon, 31 Jul 2023 17:04:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14E4D6B016F; Mon, 31 Jul 2023 13:03:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0FCBA6B0170; Mon, 31 Jul 2023 13:03:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E1C816B0171; Mon, 31 Jul 2023 13:03:58 -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 CEC686B016F for ; Mon, 31 Jul 2023 13:03:58 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 9A1EA1C8C55 for ; Mon, 31 Jul 2023 17:03:58 +0000 (UTC) X-FDA: 81072529356.30.D11B02A Received: from mail-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) by imf23.hostedemail.com (Postfix) with ESMTP id A4CC714002B for ; Mon, 31 Jul 2023 17:03:56 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YpVyYPxP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.166.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823036; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iZ7ozcISUSGoixC5UzzNE5tJz0+L18C1Imj6XmV/DYM=; b=0y/W+IhGRByFRPPh4A51a1ZnNkNrfEfJt9sTMD5rMbt0tRsXE12oWcR71UyxDW0Zss9P/C kAXzWDhrCvB6uf/vQmON8lhaIeSXyvuhVFLa+tMN4JJw2NTio712lwnwfXW9IqSus+GXPd A/DEsFjSzq9V9mdHS9Z/N3LlnvGH2Ug= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=YpVyYPxP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.166.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823036; a=rsa-sha256; cv=none; b=7DoV5vK9Og2wheyD6cugDbbji7jjnzTZ+R0lqsXQMrMyEefE9rX/DCAF92vKpq/mPoGqZs PMvOz08Iiv1eSWbpWpbLTLRx5K10ChvIvXP565zvgWLj0sis4DOBm49eAJ8YcJJb7b/FzS ROiV0Fku0h85Xm2ZvVYY9pagimqvhRY= Received: by mail-il1-f170.google.com with SMTP id e9e14a558f8ab-3491516c4aeso4949465ab.1 for ; Mon, 31 Jul 2023 10:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823036; x=1691427836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iZ7ozcISUSGoixC5UzzNE5tJz0+L18C1Imj6XmV/DYM=; b=YpVyYPxPRtPTKHT9+tyvzqfvzCuhkFnhsMCX6nJF7RWviYaDE6pxTcvqFICRytHQ3F mk3OEWmycmo6ouKKcTZJZ/J9GI0O0U+IOIhkq6cf5NcWzs3F3Ep7I9wPm/bnxo3IbGbP 5A5D1El9yg833uJSmp138hZ30DYMCVkIUWUYXAVHfkbTx4hT6PxevukL8QnCpSiv14Rw Ab1JsXOoVAvxWjOf0Fsk8pxufrrxg62ZUs/sWVYn8yXcxdG4Ij3aN3bFcjr1GQQkDcpq XCDoC5WGNDUaZUPNMTX8kXKJ799hVc0z6s0hq6YfOkQjqMhJ1aFCFD+uKI8XA047G16z xszQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823036; x=1691427836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iZ7ozcISUSGoixC5UzzNE5tJz0+L18C1Imj6XmV/DYM=; b=M0zIVsKgIGwDL7UdvL0LiRybMBesWICIdt147Ns5G8WYe3ZwLibwaAQZUwo6SjG+Al dC2BuPoLsaOOA04SAraw/lrNPKRSs7q1d1/axD6gI8GrRFmRG4PFU5xvLLu7DsQc3NXD HadKgZUdnzIu1/riDA+l7pZlYhVVMjCeKDW1wV2wjy0s0sTGm9yNGQpL3nJDGi3i0ajx N76aK7PysEv2wv8sXvhGkPHfjkhG1Z+N1Bite2afXJg8wDaDvlRmfoaRSEdi4taYRQ7z ujdcP2P36haRi1myRNtHxXoXrufvEQLct3IePAjOgTLsLOFn3KWXee+u3fJnYhXaU+Jf FRNw== X-Gm-Message-State: ABy/qLZsq6bUJ7cfTUJmzWGsFGnxC9sKIOrpYv0oFwXPuU8aLxdAeUTl saGFcKXWOLw9/u48YItehKw= X-Google-Smtp-Source: APBJJlHoVkOsri9H/NdsUsto2q+Ey0kzzV9aD886+MBagBeourqVjWpbCtZ0aJitRhXpadhn4PaeZQ== X-Received: by 2002:a05:6e02:1c26:b0:348:b910:313d with SMTP id m6-20020a056e021c2600b00348b910313dmr9675086ilh.14.1690823035707; Mon, 31 Jul 2023 10:03:55 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:55 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 09/31] mm: Convert pmd_ptlock_free() to use ptdescs Date: Mon, 31 Jul 2023 10:03:10 -0700 Message-Id: <20230731170332.69404-10-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A4CC714002B X-Stat-Signature: zofytdabrigjzdad43gwugimbr5u94gs X-HE-Tag: 1690823036-867390 X-HE-Meta: U2FsdGVkX1/pEG22+4F9BGcLws03TcuKwqgIYXIqgo8OxtXDpYNMu74RQkxKg/dbx5IdWLx0ECkcR5jsa7U/uKIYdEG7v8yC2l+GzT4y2n+1qAtICSC+R6Cm6Ig6HElqRKypvnCFOqx5TWKL2OveE92/iWe4w2jKlU7prWFmmvYEyJHKrLxlYexEbMhYihZmGPC9rBxR2gzZbJYlN2t+jRaQ1rB7F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TCy7gn6jZOBJGbjmZ9WOYsfymnaLM3Uy1ocerUTORPMyRKi1VMP//JSj43/fk799aIFj8asd87pruPP6YjwMe+SubvPmU+iN9LsZDMrtkuqqyOi1y7kpDwT6T+RF2AV00ic6feg/F40v0utPxXHSIa3/lFApdM5CiWc9UWrJveAtZhTO483qVmoEI3zcC7nNGGt7IracaMszYCof3cMP7vYqsjd20Sk00mu9qm7LJ4daZ1DWcfAZIY+iTsnylIDJD6nnGFiK3nG47lHP86i71u2WH/AbtZmP5LB4Rr0RyGym2Lqsh+5QjK2sb/Ydf9EwhHD2ZxU0GXbMZh6iu6s4QjQkBwz+gE0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 675972d3f7e4..774fe83c0c16 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2982,12 +2982,12 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) return ptlock_init(ptdesc); } -static inline void pmd_ptlock_free(struct page *page) +static inline void pmd_ptlock_free(struct ptdesc *ptdesc) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE - VM_BUG_ON_PAGE(page->pmd_huge_pte, page); + VM_BUG_ON_PAGE(ptdesc->pmd_huge_pte, ptdesc_page(ptdesc)); #endif - ptlock_free(page); + ptlock_free(ptdesc_page(ptdesc)); } #define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) @@ -3000,7 +3000,7 @@ static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) } static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) { return true; } -static inline void pmd_ptlock_free(struct page *page) {} +static inline void pmd_ptlock_free(struct ptdesc *ptdesc) {} #define pmd_huge_pte(mm, pmd) ((mm)->pmd_huge_pte) @@ -3024,7 +3024,7 @@ static inline bool pgtable_pmd_page_ctor(struct page *page) static inline void pgtable_pmd_page_dtor(struct page *page) { - pmd_ptlock_free(page); + pmd_ptlock_free(page_ptdesc(page)); __ClearPageTable(page); dec_lruvec_page_state(page, NR_PAGETABLE); } From patchwork Mon Jul 31 17:03: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: 13335109 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 ABD90C001DE for ; Mon, 31 Jul 2023 17:04:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47FD36B0172; Mon, 31 Jul 2023 13:04:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4303428006F; Mon, 31 Jul 2023 13:04:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F88B6B0174; Mon, 31 Jul 2023 13:04:03 -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 1C82B6B0172 for ; Mon, 31 Jul 2023 13:04:03 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3F1F8402F0 for ; Mon, 31 Jul 2023 17:04:01 +0000 (UTC) X-FDA: 81072529482.09.7CCAA2E Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf19.hostedemail.com (Postfix) with ESMTP id E44701A001E for ; Mon, 31 Jul 2023 17:03:58 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=TvM6DExj; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823038; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7EZnRhm4Fj3KaK4sFjI+P1mIVDNOtVXSgVauozi7/LE=; b=U9TTpzElUxRWeki3MwlreWi6vbJ/eaC74IYvtoEtE+9mOfPxf8F2+3VoNqyIdpwGAD4SDh aZqUdNsd8uzNRGbINn0UBUhnhVgeT1JYHiHiyq69e9zPWaBd1tb9fKqLnSk6vDQKZKe6MU De0+fHx6vmi3CLgqpTsf8TfMBIB4iXQ= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=TvM6DExj; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823038; a=rsa-sha256; cv=none; b=kR/h5YCoAxkVXPxy670ogKXcgcu04DRT0Z6Nl5fp1MGfXMZOHi/VjivDrmOb08o+yb67JJ pSiwOD7hxygwW1g4hY4pDreO/9QpDf/i/0jzaYs20vmYx3Hu90CccnTxSYYNYzk2gfzaJO uNq8kTQEQoXzX4/w9RwiycnyZPTTjHU= Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-d1c988afebfso5035284276.2 for ; Mon, 31 Jul 2023 10:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823038; x=1691427838; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7EZnRhm4Fj3KaK4sFjI+P1mIVDNOtVXSgVauozi7/LE=; b=TvM6DExj/MTq0Jm70GY7llkizJv0Xrt3jOhv1061u2jelnUc+8n8NrIEW+BAV0minS 1tyB2hh96LoZso6xWTQsTKE9iOzQkPYOcn2oO7CJPClzabUQT8JEbqLe1hGOluEbesF4 LKkTfn07m+I0Vuueep3IFUQUJltM6JJHBDBn8n653IK02ME5fuHReejoNwtCex5xQyzn Y1wOj8DVfr6r9eQ6TYR15inSR6hHDxry08oKRDaKIhjxxmp2hbT5OuHr1D1+R6xelNHE JPdzrcJvaKmiiybVsDU25/RyZDaqIgMV6uxOUr6sp0q3qR3F0X4P6bOEInakDYMw/wf5 mu/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823038; x=1691427838; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7EZnRhm4Fj3KaK4sFjI+P1mIVDNOtVXSgVauozi7/LE=; b=SMLKUwBeSeLoDkJrVCqmqbAnRyN/WJlz+E79X9In8NVAnZjdnIzoGAJmrz116pnefj HztaN8H3XX212M6R/iQr2fFD4tDkX9hb6AIR1+WRoArzM4+eotHOsrUJM15/PAGNhSCf m3iYwie8iae6a+tiirb7Hhm6OXfHqSn8JXHl6UhBj0/o73Z0EV5oXlnxx/S0nYESdi0+ iTb2qpvuM7PVH3l1R1TdBNE5wVPeEDdiqT5gwgYOBq3aUFPVqjXpIy/gsBjiMcMSKZpz otbGvAMB7yuWsxteOftM34F2dehvLDeEVd96FoTsVYmA1xTkQpqnTRrcUkG1UzAd+LQw uRxw== X-Gm-Message-State: ABy/qLaWs+x6xzlzsK/mUbxvfBUs5HPsUz3j9Y4Y66+AwOCm1TYR/Y0a xKs26FlX2QDRDs5HtcfeDLg= X-Google-Smtp-Source: APBJJlH90WRLRIm5YDV2YMBRfelNi7WH7+bbsrmY7NpvynPWnsTYJfLOq9UWydp0DqF9z3jWR7ijAw== X-Received: by 2002:a25:e08b:0:b0:d18:e435:bdc0 with SMTP id x133-20020a25e08b000000b00d18e435bdc0mr11858543ybg.57.1690823037763; Mon, 31 Jul 2023 10:03:57 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:57 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 10/31] mm: Convert ptlock_free() to use ptdescs Date: Mon, 31 Jul 2023 10:03:11 -0700 Message-Id: <20230731170332.69404-11-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: E44701A001E X-Rspam-User: X-Rspamd-Server: rspam02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9YSTzmg7iXdmqpNqcAO366LvSSRFwZPp9Yp9qnHJVq7tjRkUe0ad56CKOERJSSel/d3Ib5WYf/pkVyaJXKI5Hgs7ijLWvS8+ss2GpkhXCRiTK6VOhbBL4t7NhbdIi8VZONl+vd01curcN8rquL60JE5Dsh4dP6tx/pqHvHJtO1WqZEYDj9QavU+qv62L8JVxQQldbbB685E9On3jldVsCmXJyK86WgmeawAUTTFIODFF1LGmgBcQ6rct8fVUUQjoKLRXukvIeMtk/rg6ykw7y57aINV059Vv1FLjd7qZkgJckax7DdQeQEzob9CP6rm1KPGxStlaemant7GTQ4GbQ00cBZl9eWMK4WeVGfe2s7VQwrFCcai6tBdTP6SD8bXaUUFXLZaVTq1Pc+HZHmpTV5A3luPhLT8vFa77NCeu4pXfY6dAgoLIIVAkxiISEktdF9vkCozEffugEMW+2vEOIXKPxnqDFHe1WJXZMajcZ780CyCuznEWbE5a/wkYsN13BZcDUpDFGCPt3nTSQIjIRkLrO+IDVk+tjsLjzmZ6kKcML6nAcsIqC23z35QMVfY5YgwMgLr8JsxUMmEuS8CIZoq581UFFn3uHLdloFopVMiNzTuVf3NIZZFOw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 10 +++++----- mm/memory.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 774fe83c0c16..ffddae95af78 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2842,7 +2842,7 @@ static inline void pagetable_free(struct ptdesc *pt) #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); bool ptlock_alloc(struct ptdesc *ptdesc); -extern void ptlock_free(struct page *page); +void ptlock_free(struct ptdesc *ptdesc); static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { @@ -2858,7 +2858,7 @@ static inline bool ptlock_alloc(struct ptdesc *ptdesc) return true; } -static inline void ptlock_free(struct page *page) +static inline void ptlock_free(struct ptdesc *ptdesc) { } @@ -2899,7 +2899,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) } static inline void ptlock_cache_init(void) {} static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } -static inline void ptlock_free(struct page *page) {} +static inline void ptlock_free(struct ptdesc *ptdesc) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ static inline bool pgtable_pte_page_ctor(struct page *page) @@ -2913,7 +2913,7 @@ static inline bool pgtable_pte_page_ctor(struct page *page) static inline void pgtable_pte_page_dtor(struct page *page) { - ptlock_free(page); + ptlock_free(page_ptdesc(page)); __ClearPageTable(page); dec_lruvec_page_state(page, NR_PAGETABLE); } @@ -2987,7 +2987,7 @@ static inline void pmd_ptlock_free(struct ptdesc *ptdesc) #ifdef CONFIG_TRANSPARENT_HUGEPAGE VM_BUG_ON_PAGE(ptdesc->pmd_huge_pte, ptdesc_page(ptdesc)); #endif - ptlock_free(ptdesc_page(ptdesc)); + ptlock_free(ptdesc); } #define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) diff --git a/mm/memory.c b/mm/memory.c index 4fee273595e2..e5e370cdac23 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -6242,8 +6242,8 @@ bool ptlock_alloc(struct ptdesc *ptdesc) return true; } -void ptlock_free(struct page *page) +void ptlock_free(struct ptdesc *ptdesc) { - kmem_cache_free(page_ptl_cachep, page->ptl); + kmem_cache_free(page_ptl_cachep, ptdesc->ptl); } #endif From patchwork Mon Jul 31 17:03: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: 13335112 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 96FFFC07E8D for ; Mon, 31 Jul 2023 17:04:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5BA4B6B0177; Mon, 31 Jul 2023 13:04:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F47D6B0178; Mon, 31 Jul 2023 13:04:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D11228006F; Mon, 31 Jul 2023 13:04:09 -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 1B32C6B0177 for ; Mon, 31 Jul 2023 13:04:09 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0783340BBD for ; Mon, 31 Jul 2023 17:04:08 +0000 (UTC) X-FDA: 81072529776.14.2DBBD08 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by imf06.hostedemail.com (Postfix) with ESMTP id 209B4180046 for ; Mon, 31 Jul 2023 17:04:00 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WsnCjEuF; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823041; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GM8s3dDlKIn9bcZ3Rv1fAyQJ11tvy15JiujAITQGQIU=; b=mXdFupG8SUDeui69kLZ3ZWdycMRh8Uu+H7QZkdqsDzKkpgi2FDn7wMQDwfPLlhvAVLxMQF 6BfvlPQUpWgt96KpFxS5FpU5RDzYBfmZ8AGbMmhDLJ2jKGhvek6Y2FDMTyMCGkcBuuTEMi /6Tc1/qj/miaeumKdaVPNv/zvv64eh0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823041; a=rsa-sha256; cv=none; b=ExMwWJnV1h/r1qW2c++nqbJ6WD/kukUEkZpR/rGuVVyi5JWZPK34vRfuq6I8g5+QOq+IiL N9erHhhf6u2XTyxnO6+jKtPM1o6maXgCgjgO+1VAxNnW4bYsnT4ujrl7QPv6BpRyP+35TX WylGv3kZu16DyczbGOys8F1IFdY48KA= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WsnCjEuF; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-ca4a6e11f55so3743643276.1 for ; Mon, 31 Jul 2023 10:04:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823040; x=1691427840; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GM8s3dDlKIn9bcZ3Rv1fAyQJ11tvy15JiujAITQGQIU=; b=WsnCjEuFun6IuHpPh6Ck/rBg4AZLbVHEs2jk+7TEc5kPbUlyDbLU82vMQ8hYNiUbEV KmukkQXHlnalx2MRwxX9OA1ED5qQ+cRzMsv/rlYCU41nnUNJeib6/uXFu8sMt236/2Ud yhZAMNcebKfkSv6mc59ZybiKh0RsfAPQpPnm2pft2DHqmzXA9/C0fNB/u3wlBocoiSJC LtpkvTvVemtPOevOsyRiBPGxBKIgXaumZpQx0YFqajcNPkaTnpsizZKv1A3XIPWZnK5y p/CzUaAjAQ1JZb9e9DygJrxewNU/aZAjuX8qYUs6cV2yG2QRoeh00nb4O3A983HwtiRJ fbTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823040; x=1691427840; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GM8s3dDlKIn9bcZ3Rv1fAyQJ11tvy15JiujAITQGQIU=; b=dgmL5FBzLuARR//HiUcrKpGdWax9IDJ1Fy+Lmfmau43atSo9EpvJI5HGzVPjF4aPAe SdFw0dgMVq9Njuso+OpvtCsyzOkijRPuAF6A4fWpfzZi4KhOlAnMggTU+e1Og9zwvfbo yEsl+JvRuI2CmZJ5f/0XljAZoW8PJT5cmXNLzzCzrUbKBRNu22R+4EyE62Mh0rVhNa+o 70vSNGHoKuHJTgo4PCXCzZcKTTEBxLMM1JcKSZ2llADsiYsw8RVuGSdqx96lpU55eRkY YcyzQh34A60ov+ZFunBw134k4+H3p5rkrmzwez2L8ldjeeUoB6yfGOoVo22GekPgvJm6 LcfA== X-Gm-Message-State: ABy/qLZOobf0XoTqD32JRHPE+X46ZT5Yrxtu7wMhZI/x96MUWVI1LAy+ wFHreF0WQHH6LHg9J1R8fNo= X-Google-Smtp-Source: APBJJlHch/jSJCdVVtDWb1WClZ5gGKwbX6GY1zRRfwmE6xAtgRg67mCRvfprsxzmmxwehzomhr3VNg== X-Received: by 2002:a25:c7d1:0:b0:d08:20f1:f7cd with SMTP id w200-20020a25c7d1000000b00d0820f1f7cdmr8274869ybe.16.1690823039767; Mon, 31 Jul 2023 10:03:59 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:59 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 11/31] mm: Create ptdesc equivalents for pgtable_{pte,pmd}_page_{ctor,dtor} Date: Mon, 31 Jul 2023 10:03:12 -0700 Message-Id: <20230731170332.69404-12-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: 56tzsnrg4zigxnezi7mk546b6xisz3bu X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 209B4180046 X-Rspam-User: X-HE-Tag: 1690823040-124469 X-HE-Meta: U2FsdGVkX18WF7G7RN2nlqDhSzqPce/FwYReH65H2lZRNUgHLKgFJ8KwxGXgGAR/nG2EevHsxItIt8oYHyeLiVao6mQmMEqHVbJjRV+L9P2zROJfjtejjGd/8sjuZiOzvhI1ugB2v45kRwvpxvPu3NMe1JW4FWW7LdQAUDV2EpQzIMN9KMvS5BIyW6mQ+nvt974gBKWCNIOib1de9d1uEa0F6J2gEdLBi9Ic/2/mXMlT20aPOl/psm5ETkf4Jg9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3cjVbAx+a4cbCAh9F6UKA2n30AapiP4wuKJw1cu78a1mNA+TY91wqqYgL3Aud+Iffk62jRKD1z/iEbMa4TwbKtbJj8Oe3Tm1+ANq6Kdp+hluR1qWOLP7NUr0M/Eu5KHxik8/QDPTYUnt1IaiwJWEQ1l738k/q64/AUPU2gV2IJIfWZdUoX9txq2Ng/TjSSMuxItpgGuxavqmd7IHkopJRy0ZidkpjQHHHFdVrQAmCCqPhVZjb+z394PgKZLU51hpg5ZrH2/RVN9XTiNTeQCTtLOvHKEI2MICYT17lHNMNzg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Create pagetable_pte_ctor(), pagetable_pmd_ctor(), pagetable_pte_dtor(), and pagetable_pmd_dtor() and make the original pgtable constructor/destructors wrappers. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm.h | 56 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ffddae95af78..bd3d99d81984 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2902,20 +2902,34 @@ static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } static inline void ptlock_free(struct ptdesc *ptdesc) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ -static inline bool pgtable_pte_page_ctor(struct page *page) +static inline bool pagetable_pte_ctor(struct ptdesc *ptdesc) { - if (!ptlock_init(page_ptdesc(page))) + struct folio *folio = ptdesc_folio(ptdesc); + + if (!ptlock_init(ptdesc)) return false; - __SetPageTable(page); - inc_lruvec_page_state(page, NR_PAGETABLE); + __folio_set_pgtable(folio); + lruvec_stat_add_folio(folio, NR_PAGETABLE); return true; } +static inline bool pgtable_pte_page_ctor(struct page *page) +{ + return pagetable_pte_ctor(page_ptdesc(page)); +} + +static inline void pagetable_pte_dtor(struct ptdesc *ptdesc) +{ + struct folio *folio = ptdesc_folio(ptdesc); + + ptlock_free(ptdesc); + __folio_clear_pgtable(folio); + lruvec_stat_sub_folio(folio, NR_PAGETABLE); +} + static inline void pgtable_pte_page_dtor(struct page *page) { - ptlock_free(page_ptdesc(page)); - __ClearPageTable(page); - dec_lruvec_page_state(page, NR_PAGETABLE); + pagetable_pte_dtor(page_ptdesc(page)); } pte_t *__pte_offset_map(pmd_t *pmd, unsigned long addr, pmd_t *pmdvalp); @@ -3013,20 +3027,34 @@ static inline spinlock_t *pmd_lock(struct mm_struct *mm, pmd_t *pmd) return ptl; } -static inline bool pgtable_pmd_page_ctor(struct page *page) +static inline bool pagetable_pmd_ctor(struct ptdesc *ptdesc) { - if (!pmd_ptlock_init(page_ptdesc(page))) + struct folio *folio = ptdesc_folio(ptdesc); + + if (!pmd_ptlock_init(ptdesc)) return false; - __SetPageTable(page); - inc_lruvec_page_state(page, NR_PAGETABLE); + __folio_set_pgtable(folio); + lruvec_stat_add_folio(folio, NR_PAGETABLE); return true; } +static inline bool pgtable_pmd_page_ctor(struct page *page) +{ + return pagetable_pmd_ctor(page_ptdesc(page)); +} + +static inline void pagetable_pmd_dtor(struct ptdesc *ptdesc) +{ + struct folio *folio = ptdesc_folio(ptdesc); + + pmd_ptlock_free(ptdesc); + __folio_clear_pgtable(folio); + lruvec_stat_sub_folio(folio, NR_PAGETABLE); +} + static inline void pgtable_pmd_page_dtor(struct page *page) { - pmd_ptlock_free(page_ptdesc(page)); - __ClearPageTable(page); - dec_lruvec_page_state(page, NR_PAGETABLE); + pagetable_pmd_dtor(page_ptdesc(page)); } /* From patchwork Mon Jul 31 17:03: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: 13335117 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 D0354C0729B for ; Mon, 31 Jul 2023 17:04:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B54E28006F; Mon, 31 Jul 2023 13:04:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 764FD6B0180; Mon, 31 Jul 2023 13:04:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5698328006F; Mon, 31 Jul 2023 13:04:16 -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 41CC86B0180 for ; Mon, 31 Jul 2023 13:04:16 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id F1B03C01AD for ; Mon, 31 Jul 2023 17:04:15 +0000 (UTC) X-FDA: 81072530112.20.052CCA8 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) by imf03.hostedemail.com (Postfix) with ESMTP id 0DBDB20085 for ; Mon, 31 Jul 2023 17:04:02 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=b+RH2hQL; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823043; a=rsa-sha256; cv=none; b=qJ/QV2W6ltKFOtRk80o4cf4WXZ9Ds6w2FLDzm1qRLb2sqtg8NGCLDKw49e2RqiE1mWCq/C q6JTWNyOX/sUyRNP15CGck5258JUdA2lqxkTmJx2hwxb1Ke9eXK9xxaP2eqgMpNQAgVc2N murHY3fCJyuZmYgy4aEvavFBsX+d590= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=b+RH2hQL; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823043; 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=9sW6ZvuXfbFTHYep83+z5KceXKUDE808r1Cv8/pw/I4=; b=7NlhrIGiexe0SCFoerkE8iHwVW/tIOQsX+qZ4PsPFW3BrR7LqLDhxpWHtW90PkO2q4/LG7 VcwVoGqXuINzcrERvadC5lFWD8ZxpY7XWa0G5U+cEGsstzPY0J4pQ1TtoqkUR3jFbHaelB vMqjv3f9R54+7WnotDz6/PaTG3av7dw= Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3a6f87b2993so2241813b6e.3 for ; Mon, 31 Jul 2023 10:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823042; x=1691427842; 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=9sW6ZvuXfbFTHYep83+z5KceXKUDE808r1Cv8/pw/I4=; b=b+RH2hQLs0PrVwmTtZEtfUeHXjshu4ts0OsC/tTRMBNL2mI6FVIeJ+HO2sJc9CHbAN CYuYEUlC05IcPjkCqLxNke2EK1ijZ05jv63DReY0r2tPeNGvUBJekr+gcoNL1dz8PJ26 /cA4AkNpz6v8HN3tbVp4xFy5RCmhWYIIra7v2cEeHbXn3sfQnBhgAc2yuX2m6lE/+9mA 9y/jmAUWLmB4o1mWve3z/4oUJYIlqq3nVkrOrqW86WuABmDsL4jvWbVffSny/K6W7B5Z rXA6KtaxPm6aezMEUN+nLjZwW5J7C1GsPuTnmHV2MzYNOQ2wNdnkfwDaXHstMJLOGYKi Q3BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823042; x=1691427842; 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=9sW6ZvuXfbFTHYep83+z5KceXKUDE808r1Cv8/pw/I4=; b=aFA1XV6HyeqbabZ2TkG7cC4Oxjets1yJpeD9+fyvTSYmHmxV6w7tGvht9wzYiEAUKE DSDu2B/+llduMfvzVxxA+ici+E71JauRW38QnBNpXwjmrBQ5uJH5It3whJRYJlAJ1J68 qY9rT9MIuq0a7I4GgrNfxjO3toHMVSjAcQD7Ji+GxexJCpVUQeRkHSPBBM0CJuitk/OK 05nBFhDD5FffgClqSQJmEARRw/1GC/0j7gikCfjZsShi7qA6P84gMayDBJMpb7KkAQZr 5NUvkKmmVBUe//Yanlk8YL/4UTvVyNXv6ulcaZs+LSTIoiJX53T5z099PsV0or+QObd0 So8A== X-Gm-Message-State: ABy/qLY3roVgG6z14RjPvQWElWHS1lUvbIzys2YJ4mjWT47lpMfqrz2S x9i0YAecn+/PiYMBGD82Wew= X-Google-Smtp-Source: APBJJlEBdh+xsvh+Bo5hWO3RkW2wDNeEPqSCLaQ2ijqegBPt3AxvxjSwU8QAdn957rZPqKKKWtbDqg== X-Received: by 2002:a05:6808:b26:b0:3a3:aedd:6b21 with SMTP id t6-20020a0568080b2600b003a3aedd6b21mr10745132oij.39.1690823041847; Mon, 31 Jul 2023 10:04:01 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:01 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Christophe Leroy , Mike Rapoport Subject: [PATCH mm-unstable v8 12/31] powerpc: Convert various functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:13 -0700 Message-Id: <20230731170332.69404-13-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0DBDB20085 X-Stat-Signature: btbxfwoyrjoxa5a5hu1pgf6p6wubf3bf X-HE-Tag: 1690823042-471348 X-HE-Meta: U2FsdGVkX1+JOTPKTBMDAF9GKsZR2eCvT7J5b8twJ4SSKErLHRNj3Qa4PnGClCs7sktZYy+usPuoE1siOcM1wWr8FgSuUmMiw81lVldsBeJ2CTjf2puwm86DuSdmxuqCK0rbsxHM5aLc0viKqJ6DRQ/Pnxr5RRTp143YbLBloY39sIUoBHuesbw/59xqSf6x+hY19xPGg17jTjtO+pOOpcupWYTsgNlC3vLKJdsUSfRPmd0JzNpSlrVHHUcy+bRILG4Fok0gpNJV3bcZByRdV6trWuV3T7cXEtZp92JnBZj023CJrYzCZ3p7aoFFydVMb5e5M9ZAwe6Ysi7Che5HPLa//j9b0w4ek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bjYPErDD8Zj1vhkV+960xSrwntwbLpkz3BVFxI1EizWEDbAOHzgYrOgupfp5Y+Mt2GVhwrg3gMscNCzqrpUsp004V2dAaz0WdngLK00ebjN3+xmGUctSLM7OObP1TOe0YMSgSqtWpiFK4Z67vnhU6orkwIUL+Hqrktg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: In order to split struct ptdesc from struct page, convert various functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/powerpc/mm/book3s64/mmu_context.c | 10 ++--- arch/powerpc/mm/book3s64/pgtable.c | 32 +++++++------- arch/powerpc/mm/pgtable-frag.c | 58 +++++++++++++------------- 3 files changed, 50 insertions(+), 50 deletions(-) diff --git a/arch/powerpc/mm/book3s64/mmu_context.c b/arch/powerpc/mm/book3s64/mmu_context.c index c766e4c26e42..1715b07c630c 100644 --- a/arch/powerpc/mm/book3s64/mmu_context.c +++ b/arch/powerpc/mm/book3s64/mmu_context.c @@ -246,15 +246,15 @@ static void destroy_contexts(mm_context_t *ctx) static void pmd_frag_destroy(void *pmd_frag) { int count; - struct page *page; + struct ptdesc *ptdesc; - page = virt_to_page(pmd_frag); + ptdesc = virt_to_ptdesc(pmd_frag); /* drop all the pending references */ count = ((unsigned long)pmd_frag & ~PAGE_MASK) >> PMD_FRAG_SIZE_SHIFT; /* We allow PTE_FRAG_NR fragments from a PTE page */ - if (atomic_sub_and_test(PMD_FRAG_NR - count, &page->pt_frag_refcount)) { - pgtable_pmd_page_dtor(page); - __free_page(page); + if (atomic_sub_and_test(PMD_FRAG_NR - count, &ptdesc->pt_frag_refcount)) { + pagetable_pmd_dtor(ptdesc); + pagetable_free(ptdesc); } } diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c index 85c84e89e3ea..1212deeabe15 100644 --- a/arch/powerpc/mm/book3s64/pgtable.c +++ b/arch/powerpc/mm/book3s64/pgtable.c @@ -306,22 +306,22 @@ static pmd_t *get_pmd_from_cache(struct mm_struct *mm) static pmd_t *__alloc_for_pmdcache(struct mm_struct *mm) { void *ret = NULL; - struct page *page; + struct ptdesc *ptdesc; gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_ZERO; if (mm == &init_mm) gfp &= ~__GFP_ACCOUNT; - page = alloc_page(gfp); - if (!page) + ptdesc = pagetable_alloc(gfp, 0); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(page)) { - __free_pages(page, 0); + if (!pagetable_pmd_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - atomic_set(&page->pt_frag_refcount, 1); + atomic_set(&ptdesc->pt_frag_refcount, 1); - ret = page_address(page); + ret = ptdesc_address(ptdesc); /* * if we support only one fragment just return the * allocated page. @@ -331,12 +331,12 @@ static pmd_t *__alloc_for_pmdcache(struct mm_struct *mm) spin_lock(&mm->page_table_lock); /* - * If we find pgtable_page set, we return + * If we find ptdesc_page set, we return * the allocated page with single fragment * count. */ if (likely(!mm->context.pmd_frag)) { - atomic_set(&page->pt_frag_refcount, PMD_FRAG_NR); + atomic_set(&ptdesc->pt_frag_refcount, PMD_FRAG_NR); mm->context.pmd_frag = ret + PMD_FRAG_SIZE; } spin_unlock(&mm->page_table_lock); @@ -357,15 +357,15 @@ pmd_t *pmd_fragment_alloc(struct mm_struct *mm, unsigned long vmaddr) void pmd_fragment_free(unsigned long *pmd) { - struct page *page = virt_to_page(pmd); + struct ptdesc *ptdesc = virt_to_ptdesc(pmd); - if (PageReserved(page)) - return free_reserved_page(page); + if (pagetable_is_reserved(ptdesc)) + return free_reserved_ptdesc(ptdesc); - BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0); - if (atomic_dec_and_test(&page->pt_frag_refcount)) { - pgtable_pmd_page_dtor(page); - __free_page(page); + BUG_ON(atomic_read(&ptdesc->pt_frag_refcount) <= 0); + if (atomic_dec_and_test(&ptdesc->pt_frag_refcount)) { + pagetable_pmd_dtor(ptdesc); + pagetable_free(ptdesc); } } diff --git a/arch/powerpc/mm/pgtable-frag.c b/arch/powerpc/mm/pgtable-frag.c index 0c6b68130025..8c31802f97e8 100644 --- a/arch/powerpc/mm/pgtable-frag.c +++ b/arch/powerpc/mm/pgtable-frag.c @@ -18,15 +18,15 @@ void pte_frag_destroy(void *pte_frag) { int count; - struct page *page; + struct ptdesc *ptdesc; - page = virt_to_page(pte_frag); + ptdesc = virt_to_ptdesc(pte_frag); /* drop all the pending references */ count = ((unsigned long)pte_frag & ~PAGE_MASK) >> PTE_FRAG_SIZE_SHIFT; /* We allow PTE_FRAG_NR fragments from a PTE page */ - if (atomic_sub_and_test(PTE_FRAG_NR - count, &page->pt_frag_refcount)) { - pgtable_pte_page_dtor(page); - __free_page(page); + if (atomic_sub_and_test(PTE_FRAG_NR - count, &ptdesc->pt_frag_refcount)) { + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } } @@ -55,25 +55,25 @@ static pte_t *get_pte_from_cache(struct mm_struct *mm) static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel) { void *ret = NULL; - struct page *page; + struct ptdesc *ptdesc; if (!kernel) { - page = alloc_page(PGALLOC_GFP | __GFP_ACCOUNT); - if (!page) + ptdesc = pagetable_alloc(PGALLOC_GFP | __GFP_ACCOUNT, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } } else { - page = alloc_page(PGALLOC_GFP); - if (!page) + ptdesc = pagetable_alloc(PGALLOC_GFP, 0); + if (!ptdesc) return NULL; } - atomic_set(&page->pt_frag_refcount, 1); + atomic_set(&ptdesc->pt_frag_refcount, 1); - ret = page_address(page); + ret = ptdesc_address(ptdesc); /* * if we support only one fragment just return the * allocated page. @@ -82,12 +82,12 @@ static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel) return ret; spin_lock(&mm->page_table_lock); /* - * If we find pgtable_page set, we return + * If we find ptdesc_page set, we return * the allocated page with single fragment * count. */ if (likely(!pte_frag_get(&mm->context))) { - atomic_set(&page->pt_frag_refcount, PTE_FRAG_NR); + atomic_set(&ptdesc->pt_frag_refcount, PTE_FRAG_NR); pte_frag_set(&mm->context, ret + PTE_FRAG_SIZE); } spin_unlock(&mm->page_table_lock); @@ -108,28 +108,28 @@ pte_t *pte_fragment_alloc(struct mm_struct *mm, int kernel) static void pte_free_now(struct rcu_head *head) { - struct page *page; + struct ptdesc *ptdesc; - page = container_of(head, struct page, rcu_head); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc = container_of(head, struct ptdesc, pt_rcu_head); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } void pte_fragment_free(unsigned long *table, int kernel) { - struct page *page = virt_to_page(table); + struct ptdesc *ptdesc = virt_to_ptdesc(table); - if (PageReserved(page)) - return free_reserved_page(page); + if (pagetable_is_reserved(ptdesc)) + return free_reserved_ptdesc(ptdesc); - BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0); - if (atomic_dec_and_test(&page->pt_frag_refcount)) { + BUG_ON(atomic_read(&ptdesc->pt_frag_refcount) <= 0); + if (atomic_dec_and_test(&ptdesc->pt_frag_refcount)) { if (kernel) - __free_page(page); - else if (TestClearPageActive(page)) - call_rcu(&page->rcu_head, pte_free_now); + pagetable_free(ptdesc); + else if (folio_test_clear_active(ptdesc_folio(ptdesc))) + call_rcu(&ptdesc->pt_rcu_head, pte_free_now); else - pte_free_now(&page->rcu_head); + pte_free_now(&ptdesc->pt_rcu_head); } } From patchwork Mon Jul 31 17:03: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: 13335111 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 C495CC05052 for ; Mon, 31 Jul 2023 17:04:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA91C6B0176; Mon, 31 Jul 2023 13:04:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D30FF6B0177; Mon, 31 Jul 2023 13:04:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B83B36B0178; Mon, 31 Jul 2023 13:04:07 -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 A5DF26B0176 for ; Mon, 31 Jul 2023 13:04:07 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 648A1160B20 for ; Mon, 31 Jul 2023 17:04:07 +0000 (UTC) X-FDA: 81072529734.23.0B4908E Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) by imf19.hostedemail.com (Postfix) with ESMTP id 25F8A1A0008 for ; Mon, 31 Jul 2023 17:04:04 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DDv4TKtr; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.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=1690823045; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sltDOqqNfHEtvz8jLXUjW/r74sJCuRKUMVTEbSHBWCo=; b=QkLzEW8qaNCGUaLzSKRbEmg1y3AN/ON4nv/QBCS7DvIBF8C3k6X3S4Yn6C/QWHMVE1tk9c j8GQOuuAd1sE0ZPwFMRGRb73CnkC9x0M8Z7Ek8jEjCpA8jcZd+KigR32yUUI6HH6MBmLob khmWtY+Ghc0oieaYBHTP5Kvtz3OHJF0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823045; a=rsa-sha256; cv=none; b=QdC+AgBCG/CyJh4wmPskj4iVI/W3YUtoqRuoHVFyxmMu0oAPD6828rDm4JHB6epyfs9grr 2KVf4EXMc/+juClh8I08geND/8JQ2hhEwgkZlQPk9l2eGoBBJjv5vjh9lsVi7mwKfgfUDe oagYPdqfyNu+I20OqCfpEgGZXoxg9RQ= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DDv4TKtr; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3a3e1152c23so3458363b6e.2 for ; Mon, 31 Jul 2023 10:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823044; x=1691427844; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sltDOqqNfHEtvz8jLXUjW/r74sJCuRKUMVTEbSHBWCo=; b=DDv4TKtr1SQu5KqZfb+k47cCUnTqa2hu0PGvOIZKT6p5w+WOigqgjt3pTCKyoVLOur PNxnRZ3jA0/RzPila/zrL9Ut0S2D7/dzdlixHctnRTEPuULJtPpCXt2sv6EdNGvihlcs y+VItng76gppkBpBjqibZpmruGV1NMM5yu9a5rLJnoNJwEeQ9JDH3AVeubSs7+9WGxCh BgihnLJKz5piH3g7XsbkueQJcQA3Z7Rp93aL/N3tU8RHXtjRG0jvHhNa9PLCdjFnI5G2 GSA2pxYIUUVv4+PcoooKpTBzs2tJHyDwSGkSOMs2tb/nCpuvSVvt1GOnIBWnaMdpcLVw tIUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823044; x=1691427844; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sltDOqqNfHEtvz8jLXUjW/r74sJCuRKUMVTEbSHBWCo=; b=HdmG0Aj6tP907lUjKoCmjLwMauiAyt2zJx7uZ5/wdgGeArTi4XfZwNCaMAIbaZkzOo 7YaEJ+xv8P2eqFQSU3E4TMiSAd3RmPpZ0CCU+lZERKuifeUc2ZHPOvr/A0Z/k67KAbpE a7FLp0jIG/XbTtA7sedWAt7/vq9L1iDV/gpJVgANBs9b/DRUigBet9mdfGEKJp1AAx5e H493cVkYKq4h6qjINQ/zTPTumxI+1xBetP+3fw4YN2kQ7NSaoyHZm8rGpM8rhSW+V7Ru MC0AwYmlM+7P11c9NJNguMAr7DLXaD6ABrouVjerK38xGaP+37rLJWBKy0lzHc0wYcio 5+Pw== X-Gm-Message-State: ABy/qLayafCyipX0NVxI3KKgtdp/6FVdZs+uAnPqKOqeua6ko5Ol0HRs y2d13c+6CbMz3bwsEvY1G3I= X-Google-Smtp-Source: APBJJlHmCcTDPCXO6u+09Bgv6vKTB5JCy6bic+/Xn7A3kI+4k4FzOgutNRH/lGvVTDd+56ojK0po+g== X-Received: by 2002:a05:6808:d4a:b0:3a3:e593:5ac1 with SMTP id w10-20020a0568080d4a00b003a3e5935ac1mr13154690oik.21.1690823043912; Mon, 31 Jul 2023 10:04:03 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:03 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Dave Hansen Subject: [PATCH mm-unstable v8 13/31] x86: Convert various functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:14 -0700 Message-Id: <20230731170332.69404-14-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 25F8A1A0008 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: s874wia9s5auguj7woxfoxz1chfum787 X-HE-Tag: 1690823044-240460 X-HE-Meta: U2FsdGVkX19PO6tuIUXuvDFrB7bcSXii4gWb8XoVjp0FuXOZNGSKgMMMMAmXopZSkW92O6ppt2EZDsg8ND/OQvOmUaZUF73g9PLDT918iPn/miC9AF7e/hcHrQobzjrH8flcl7ArF6fXsHKDSKj/pG+FU/0QNXmbPu26WL7jAnz3qeetgFllkmAM+F1GBqs8tPGMCjDRfYwbhHIkk46qIH6k0C4/LcNcqnvCKcSMo0ule3DbPvRAC/QukrxmO2wE461S76F0jTNGkiAe0IHWkBIbmXibbXOuHrfw/w2zPxFw0IVIbax+9Gw41G/Gs63itRppFTpnnTUObBatAgekTPsIrdxBMX0sl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nAXUNEM4G3EdmU1WjChus2aJy6IGrrIkKHB3MjZHm23Vtj/dnXAFIGFauotj61poBuVo2473WW7oP+ZxLUAY46OlccirKt2LulcVg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: In order to split struct ptdesc from struct page, convert various functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/x86/mm/pgtable.c | 47 ++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index 15a8009a4480..d3a93e8766ee 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -52,7 +52,7 @@ early_param("userpte", setup_userpte); void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) { - pgtable_pte_page_dtor(pte); + pagetable_pte_dtor(page_ptdesc(pte)); paravirt_release_pte(page_to_pfn(pte)); paravirt_tlb_remove_table(tlb, pte); } @@ -60,7 +60,7 @@ void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) #if CONFIG_PGTABLE_LEVELS > 2 void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) { - struct page *page = virt_to_page(pmd); + struct ptdesc *ptdesc = virt_to_ptdesc(pmd); paravirt_release_pmd(__pa(pmd) >> PAGE_SHIFT); /* * NOTE! For PAE, any changes to the top page-directory-pointer-table @@ -69,8 +69,8 @@ void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) #ifdef CONFIG_X86_PAE tlb->need_flush_all = 1; #endif - pgtable_pmd_page_dtor(page); - paravirt_tlb_remove_table(tlb, page); + pagetable_pmd_dtor(ptdesc); + paravirt_tlb_remove_table(tlb, ptdesc_page(ptdesc)); } #if CONFIG_PGTABLE_LEVELS > 3 @@ -92,16 +92,16 @@ void ___p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d) static inline void pgd_list_add(pgd_t *pgd) { - struct page *page = virt_to_page(pgd); + struct ptdesc *ptdesc = virt_to_ptdesc(pgd); - list_add(&page->lru, &pgd_list); + list_add(&ptdesc->pt_list, &pgd_list); } static inline void pgd_list_del(pgd_t *pgd) { - struct page *page = virt_to_page(pgd); + struct ptdesc *ptdesc = virt_to_ptdesc(pgd); - list_del(&page->lru); + list_del(&ptdesc->pt_list); } #define UNSHARED_PTRS_PER_PGD \ @@ -112,12 +112,12 @@ static inline void pgd_list_del(pgd_t *pgd) static void pgd_set_mm(pgd_t *pgd, struct mm_struct *mm) { - virt_to_page(pgd)->pt_mm = mm; + virt_to_ptdesc(pgd)->pt_mm = mm; } struct mm_struct *pgd_page_get_mm(struct page *page) { - return page->pt_mm; + return page_ptdesc(page)->pt_mm; } static void pgd_ctor(struct mm_struct *mm, pgd_t *pgd) @@ -213,11 +213,14 @@ void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd) static void free_pmds(struct mm_struct *mm, pmd_t *pmds[], int count) { int i; + struct ptdesc *ptdesc; for (i = 0; i < count; i++) if (pmds[i]) { - pgtable_pmd_page_dtor(virt_to_page(pmds[i])); - free_page((unsigned long)pmds[i]); + ptdesc = virt_to_ptdesc(pmds[i]); + + pagetable_pmd_dtor(ptdesc); + pagetable_free(ptdesc); mm_dec_nr_pmds(mm); } } @@ -230,18 +233,24 @@ static int preallocate_pmds(struct mm_struct *mm, pmd_t *pmds[], int count) if (mm == &init_mm) gfp &= ~__GFP_ACCOUNT; + gfp &= ~__GFP_HIGHMEM; for (i = 0; i < count; i++) { - pmd_t *pmd = (pmd_t *)__get_free_page(gfp); - if (!pmd) + pmd_t *pmd = NULL; + struct ptdesc *ptdesc = pagetable_alloc(gfp, 0); + + if (!ptdesc) failed = true; - if (pmd && !pgtable_pmd_page_ctor(virt_to_page(pmd))) { - free_page((unsigned long)pmd); - pmd = NULL; + if (ptdesc && !pagetable_pmd_ctor(ptdesc)) { + pagetable_free(ptdesc); + ptdesc = NULL; failed = true; } - if (pmd) + if (ptdesc) { mm_inc_nr_pmds(mm); + pmd = ptdesc_address(ptdesc); + } + pmds[i] = pmd; } @@ -830,7 +839,7 @@ int pud_free_pmd_page(pud_t *pud, unsigned long addr) free_page((unsigned long)pmd_sv); - pgtable_pmd_page_dtor(virt_to_page(pmd)); + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); free_page((unsigned long)pmd); return 1; From patchwork Mon Jul 31 17:03: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: 13335114 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 9FBFFC04A94 for ; Mon, 31 Jul 2023 17:04:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2FB746B0179; Mon, 31 Jul 2023 13:04:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2AAC86B017A; Mon, 31 Jul 2023 13:04:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 088DA6B017B; Mon, 31 Jul 2023 13:04:10 -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 E978B6B0179 for ; Mon, 31 Jul 2023 13:04:09 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 296A1C0B2E for ; Mon, 31 Jul 2023 17:04:09 +0000 (UTC) X-FDA: 81072529818.24.3146CF5 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by imf14.hostedemail.com (Postfix) with ESMTP id 46718100020 for ; Mon, 31 Jul 2023 17:04:06 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=cx5NSYXG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823047; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HTuFXf3k0XF+iUx9+PEFpsWUTVtSma2QbqtalFKJ0Mg=; b=6FXHrNELHIln/f+GUbgqRJUkvADVy5eGU2mNrJmJX3x/3Qod60WIXkClcF3C4+fal5B2vu 1Tm0zlFUet1KKHX8eYbrCGyb6jcglmJ9ZqRBslhp5lU9dwsbly07hVVfZKkl0ujkuZu+pG T9CaskF1D51lYYTDHnvjrkvJYt8ua8w= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=cx5NSYXG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823047; a=rsa-sha256; cv=none; b=xD6WHztQES1fFgDNHx+ILvkJpfTjozUDtUypLa7z4r56uKECLBEz6NFVXEkE7szr4jtPE3 NYB0iK666Acik7ATJcGj7LfVrD1V9vCxRS6SdKxoX6AGTSJSCufA3Zwrf5ZYcnmUxdKxTG Ewsrir2izRuPgGmXg8x2t7p2gI5a+QI= Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-d16639e16e6so3788431276.3 for ; Mon, 31 Jul 2023 10:04:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823046; x=1691427846; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HTuFXf3k0XF+iUx9+PEFpsWUTVtSma2QbqtalFKJ0Mg=; b=cx5NSYXGw/nEODo1q8IuZLwgSdQlsWmCz9Uda9Dyi8oRHSANf17EUEN0NghPTleOQ3 qRF48K8p624S98UE+sqFLMwi4qHPy4Rlsyaop6e6rdx3sJ34ygM/kCGiofbfTtRy/uWK pDN6oLN/cg8l3NaqiO7dnhksZdUYELR/ROOwzhaxflR5OfGnWor4R48XoGgh+uCnCZdF PKieR+/k4xNk2dNGBUN9dU3cy+OrLP5ZMuAIPRNDi4sUHgPh9wIPf3TDs2wmKF/PZAwQ nES3iQYw3eBJbEzMwTf0ELg/p8LacwujaaTD+K4WXJHDMBVzHT5fmzh1wilIxvkms+eF wbtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823046; x=1691427846; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HTuFXf3k0XF+iUx9+PEFpsWUTVtSma2QbqtalFKJ0Mg=; b=E1mlcOnUI1AZePP2VLVcjv0fyPH3capxfaeUADM3MvUjyDilTOZM5EdP5+KF73fAx4 Ffvk8HXv461hqwMyvMY8vrWuNJvKDGPD/mI4tynoRuGe7gHTHTL2uQJSogXB6qMz2xSB 7OF8BgOYEbb8Pbku97tpERc1p5UMpgTeylIPF+AavE0jt/it3xw0HTU3yOi6+Pa7Qgem /X5id87XQrf88UZ2u49Z/2PNWj4FWNzjNuehazySXu602DZQlRZTQyIhzIIORajt44VD K/Krti+ebhATIE69dM2+kNWXLtuOA8OisMHhGqfEV4HjPACzhQRCI3VVa8b6CZZK2HhE NA9g== X-Gm-Message-State: ABy/qLZ/GAkag9uSN9bdHzSkSpCWSesD61CqhbJ5874EbvyAbiQdOFy9 blWpV5xsFh/4YlRy5ddrz/k= X-Google-Smtp-Source: APBJJlE0pJgGb9r0Cjp+ishPbTK2US/P9OxpClMj5kb5Y2tgK3QjOUshu26VL3O5SZ94YA54YpnZpA== X-Received: by 2002:a25:8385:0:b0:d17:240c:2b40 with SMTP id t5-20020a258385000000b00d17240c2b40mr6897784ybk.63.1690823045978; Mon, 31 Jul 2023 10:04:05 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04: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, Hugh Dickins , "Vishal Moola (Oracle)" , David Hildenbrand , Claudio Imbrenda , Mike Rapoport Subject: [PATCH mm-unstable v8 14/31] s390: Convert various pgalloc functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:15 -0700 Message-Id: <20230731170332.69404-15-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.mo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uzXuGROA4rVjxvTvPTJPqzmwE1FDo8Oi60ZLzY1mzPHEjp2WP Lb1z6iWM SyNG3fslXjviYfIP9J/v5wyLKC+JH1OLV+urYsxxBUAoHWGZkvA1/rO74UtMwLLM9Z3jbm7OvQN2/LzH1Spd3R5jQStekz3ZXhZlfZYZ7ff4dkjMhZXmKsLzcvl1EKj5lOPY+zg0qoEZ7G3E9ywM0gncJRCCrxw+g61Dj4cNeUWJLBfs/CWIgPa1XM1mJ+7eKH4LkzYkI7DNgHNes4R1b8kg46SQYjH18dPT+u8AXi4R7KdLWMjs2Fm2zL7v3iHTy6MDxk60GJFu8unkttBxpMBbm0Ja/BKahDrB0gRskuPwxxpaWn2lroKNVc+YlUQa7FOICg0SoxW7b18OGEuLJtPxnNKdKKrYyip2aNOLYZREGc/47K8T6rqVfQfSTMsbnPTeJA7y4oPCGrPHZW2hJvBeXv/eYWvR7g6xTTxU1k8k5sgk+Gv2zbLUXyeGTslFClwUAJ1oNSyb3nOA6Hpf2pk1dA4M6CkJyjdjhfgP/scJ98XVn+2Wguar8H0tXl+qtw163mQdAf+zuLK+dcTcsmrIpd9ebRa7h4YoAWgXpqTJ/UVX0N4+rTIRpHO83pv2uvDJDFomReTeT0FRZACepGe+2EBOrkwELH2QVwFHH6deIXDw4zFhqJf/D9A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/s390/include/asm/pgalloc.h | 4 +- arch/s390/include/asm/tlb.h | 4 +- arch/s390/mm/pgalloc.c | 128 ++++++++++++++++---------------- 3 files changed, 69 insertions(+), 67 deletions(-) diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h index 89a9d5ef94f8..376b4b23bdaa 100644 --- a/arch/s390/include/asm/pgalloc.h +++ b/arch/s390/include/asm/pgalloc.h @@ -86,7 +86,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) if (!table) return NULL; crst_table_init(table, _SEGMENT_ENTRY_EMPTY); - if (!pgtable_pmd_page_ctor(virt_to_page(table))) { + if (!pagetable_pmd_ctor(virt_to_ptdesc(table))) { crst_table_free(mm, table); return NULL; } @@ -97,7 +97,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) { if (mm_pmd_folded(mm)) return; - pgtable_pmd_page_dtor(virt_to_page(pmd)); + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); crst_table_free(mm, (unsigned long *) pmd); } diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h index b91f4a9b044c..383b1f91442c 100644 --- a/arch/s390/include/asm/tlb.h +++ b/arch/s390/include/asm/tlb.h @@ -89,12 +89,12 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, { if (mm_pmd_folded(tlb->mm)) return; - pgtable_pmd_page_dtor(virt_to_page(pmd)); + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); __tlb_adjust_range(tlb, address, PAGE_SIZE); tlb->mm->context.flush_mm = 1; tlb->freed_tables = 1; tlb->cleared_puds = 1; - tlb_remove_table(tlb, pmd); + tlb_remove_ptdesc(tlb, pmd); } /* diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index d7374add7820..07fc660a24aa 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -43,17 +43,17 @@ __initcall(page_table_register_sysctl); unsigned long *crst_table_alloc(struct mm_struct *mm) { - struct page *page = alloc_pages(GFP_KERNEL, CRST_ALLOC_ORDER); + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL, CRST_ALLOC_ORDER); - if (!page) + if (!ptdesc) return NULL; - arch_set_page_dat(page, CRST_ALLOC_ORDER); - return (unsigned long *) page_to_virt(page); + arch_set_page_dat(ptdesc_page(ptdesc), CRST_ALLOC_ORDER); + return (unsigned long *) ptdesc_to_virt(ptdesc); } void crst_table_free(struct mm_struct *mm, unsigned long *table) { - free_pages((unsigned long)table, CRST_ALLOC_ORDER); + pagetable_free(virt_to_ptdesc(table)); } static void __crst_table_upgrade(void *arg) @@ -140,21 +140,21 @@ static inline unsigned int atomic_xor_bits(atomic_t *v, unsigned int bits) struct page *page_table_alloc_pgste(struct mm_struct *mm) { - struct page *page; + struct ptdesc *ptdesc; u64 *table; - page = alloc_page(GFP_KERNEL); - if (page) { - table = (u64 *)page_to_virt(page); + ptdesc = pagetable_alloc(GFP_KERNEL, 0); + if (ptdesc) { + table = (u64 *)ptdesc_to_virt(ptdesc); memset64(table, _PAGE_INVALID, PTRS_PER_PTE); memset64(table + PTRS_PER_PTE, 0, PTRS_PER_PTE); } - return page; + return ptdesc_page(ptdesc); } void page_table_free_pgste(struct page *page) { - __free_page(page); + pagetable_free(page_ptdesc(page)); } #endif /* CONFIG_PGSTE */ @@ -242,7 +242,7 @@ void page_table_free_pgste(struct page *page) unsigned long *page_table_alloc(struct mm_struct *mm) { unsigned long *table; - struct page *page; + struct ptdesc *ptdesc; unsigned int mask, bit; /* Try to get a fragment of a 4K page as a 2K page table */ @@ -250,9 +250,9 @@ unsigned long *page_table_alloc(struct mm_struct *mm) table = NULL; spin_lock_bh(&mm->context.lock); if (!list_empty(&mm->context.pgtable_list)) { - page = list_first_entry(&mm->context.pgtable_list, - struct page, lru); - mask = atomic_read(&page->_refcount) >> 24; + ptdesc = list_first_entry(&mm->context.pgtable_list, + struct ptdesc, pt_list); + mask = atomic_read(&ptdesc->_refcount) >> 24; /* * The pending removal bits must also be checked. * Failure to do so might lead to an impossible @@ -264,13 +264,13 @@ unsigned long *page_table_alloc(struct mm_struct *mm) */ mask = (mask | (mask >> 4)) & 0x03U; if (mask != 0x03U) { - table = (unsigned long *) page_to_virt(page); + table = (unsigned long *) ptdesc_to_virt(ptdesc); bit = mask & 1; /* =1 -> second 2K */ if (bit) table += PTRS_PER_PTE; - atomic_xor_bits(&page->_refcount, + atomic_xor_bits(&ptdesc->_refcount, 0x01U << (bit + 24)); - list_del_init(&page->lru); + list_del_init(&ptdesc->pt_list); } } spin_unlock_bh(&mm->context.lock); @@ -278,28 +278,28 @@ unsigned long *page_table_alloc(struct mm_struct *mm) return table; } /* Allocate a fresh page */ - page = alloc_page(GFP_KERNEL); - if (!page) + ptdesc = pagetable_alloc(GFP_KERNEL, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - arch_set_page_dat(page, 0); + arch_set_page_dat(ptdesc_page(ptdesc), 0); /* Initialize page table */ - table = (unsigned long *) page_to_virt(page); + table = (unsigned long *) ptdesc_to_virt(ptdesc); if (mm_alloc_pgste(mm)) { /* Return 4K page table with PGSTEs */ - INIT_LIST_HEAD(&page->lru); - atomic_xor_bits(&page->_refcount, 0x03U << 24); + INIT_LIST_HEAD(&ptdesc->pt_list); + atomic_xor_bits(&ptdesc->_refcount, 0x03U << 24); memset64((u64 *)table, _PAGE_INVALID, PTRS_PER_PTE); memset64((u64 *)table + PTRS_PER_PTE, 0, PTRS_PER_PTE); } else { /* Return the first 2K fragment of the page */ - atomic_xor_bits(&page->_refcount, 0x01U << 24); + atomic_xor_bits(&ptdesc->_refcount, 0x01U << 24); memset64((u64 *)table, _PAGE_INVALID, 2 * PTRS_PER_PTE); spin_lock_bh(&mm->context.lock); - list_add(&page->lru, &mm->context.pgtable_list); + list_add(&ptdesc->pt_list, &mm->context.pgtable_list); spin_unlock_bh(&mm->context.lock); } return table; @@ -322,19 +322,18 @@ static void page_table_release_check(struct page *page, void *table, static void pte_free_now(struct rcu_head *head) { - struct page *page; + struct ptdesc *ptdesc; - page = container_of(head, struct page, rcu_head); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc = container_of(head, struct ptdesc, pt_rcu_head); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } void page_table_free(struct mm_struct *mm, unsigned long *table) { unsigned int mask, bit, half; - struct page *page; + struct ptdesc *ptdesc = virt_to_ptdesc(table); - page = virt_to_page(table); if (!mm_alloc_pgste(mm)) { /* Free 2K page table fragment of a 4K page */ bit = ((unsigned long) table & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); @@ -344,51 +343,50 @@ void page_table_free(struct mm_struct *mm, unsigned long *table) * will happen outside of the critical section from this * function or from __tlb_remove_table() */ - mask = atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x11U << (bit + 24)); mask >>= 24; - if ((mask & 0x03U) && !PageActive(page)) { + if ((mask & 0x03U) && !folio_test_active(ptdesc_folio(ptdesc))) { /* * Other half is allocated, and neither half has had * its free deferred: add page to head of list, to make * this freed half available for immediate reuse. */ - list_add(&page->lru, &mm->context.pgtable_list); + list_add(&ptdesc->pt_list, &mm->context.pgtable_list); } else { /* If page is on list, now remove it. */ - list_del_init(&page->lru); + list_del_init(&ptdesc->pt_list); } spin_unlock_bh(&mm->context.lock); - mask = atomic_xor_bits(&page->_refcount, 0x10U << (bit + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x10U << (bit + 24)); mask >>= 24; if (mask != 0x00U) return; half = 0x01U << bit; } else { half = 0x03U; - mask = atomic_xor_bits(&page->_refcount, 0x03U << 24); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x03U << 24); mask >>= 24; } - page_table_release_check(page, table, half, mask); - if (TestClearPageActive(page)) - call_rcu(&page->rcu_head, pte_free_now); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + if (folio_test_clear_active(ptdesc_folio(ptdesc))) + call_rcu(&ptdesc->pt_rcu_head, pte_free_now); else - pte_free_now(&page->rcu_head); + pte_free_now(&ptdesc->pt_rcu_head); } void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table, unsigned long vmaddr) { struct mm_struct *mm; - struct page *page; unsigned int bit, mask; + struct ptdesc *ptdesc = virt_to_ptdesc(table); mm = tlb->mm; - page = virt_to_page(table); if (mm_alloc_pgste(mm)) { gmap_unlink(mm, table, vmaddr); table = (unsigned long *) ((unsigned long)table | 0x03U); - tlb_remove_table(tlb, table); + tlb_remove_ptdesc(tlb, table); return; } bit = ((unsigned long) table & ~PAGE_MASK) / (PTRS_PER_PTE*sizeof(pte_t)); @@ -398,19 +396,19 @@ void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table, * outside of the critical section from __tlb_remove_table() or from * page_table_free() */ - mask = atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x11U << (bit + 24)); mask >>= 24; - if ((mask & 0x03U) && !PageActive(page)) { + if ((mask & 0x03U) && !folio_test_active(ptdesc_folio(ptdesc))) { /* * Other half is allocated, and neither half has had * its free deferred: add page to end of list, to make * this freed half available for reuse once its pending * bit has been cleared by __tlb_remove_table(). */ - list_add_tail(&page->lru, &mm->context.pgtable_list); + list_add_tail(&ptdesc->pt_list, &mm->context.pgtable_list); } else { /* If page is on list, now remove it. */ - list_del_init(&page->lru); + list_del_init(&ptdesc->pt_list); } spin_unlock_bh(&mm->context.lock); table = (unsigned long *) ((unsigned long) table | (0x01U << bit)); @@ -421,30 +419,30 @@ void __tlb_remove_table(void *_table) { unsigned int mask = (unsigned long) _table & 0x03U, half = mask; void *table = (void *)((unsigned long) _table ^ mask); - struct page *page = virt_to_page(table); + struct ptdesc *ptdesc = virt_to_ptdesc(table); switch (half) { case 0x00U: /* pmd, pud, or p4d */ - free_pages((unsigned long)table, CRST_ALLOC_ORDER); + pagetable_free(ptdesc); return; case 0x01U: /* lower 2K of a 4K page table */ case 0x02U: /* higher 2K of a 4K page table */ - mask = atomic_xor_bits(&page->_refcount, mask << (4 + 24)); + mask = atomic_xor_bits(&ptdesc->_refcount, mask << (4 + 24)); mask >>= 24; if (mask != 0x00U) return; break; case 0x03U: /* 4K page table with pgstes */ - mask = atomic_xor_bits(&page->_refcount, 0x03U << 24); + mask = atomic_xor_bits(&ptdesc->_refcount, 0x03U << 24); mask >>= 24; break; } - page_table_release_check(page, table, half, mask); - if (TestClearPageActive(page)) - call_rcu(&page->rcu_head, pte_free_now); + page_table_release_check(ptdesc_page(ptdesc), table, half, mask); + if (folio_test_clear_active(ptdesc_folio(ptdesc))) + call_rcu(&ptdesc->pt_rcu_head, pte_free_now); else - pte_free_now(&page->rcu_head); + pte_free_now(&ptdesc->pt_rcu_head); } #ifdef CONFIG_TRANSPARENT_HUGEPAGE @@ -488,16 +486,20 @@ static void base_pgt_free(unsigned long *table) static unsigned long *base_crst_alloc(unsigned long val) { unsigned long *table; + struct ptdesc *ptdesc; - table = (unsigned long *)__get_free_pages(GFP_KERNEL, CRST_ALLOC_ORDER); - if (table) - crst_table_init(table, val); + ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, CRST_ALLOC_ORDER); + if (!ptdesc) + return NULL; + table = ptdesc_address(ptdesc); + + crst_table_init(table, val); return table; } static void base_crst_free(unsigned long *table) { - free_pages((unsigned long)table, CRST_ALLOC_ORDER); + pagetable_free(virt_to_ptdesc(table)); } #define BASE_ADDR_END_FUNC(NAME, SIZE) \ From patchwork Mon Jul 31 17:03: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: 13335115 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 86EAEC001DE for ; Mon, 31 Jul 2023 17:04:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D74F6B017C; Mon, 31 Jul 2023 13:04:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9878C6B017D; Mon, 31 Jul 2023 13:04:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8284728006F; Mon, 31 Jul 2023 13:04:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 65FEC6B017C for ; Mon, 31 Jul 2023 13:04:12 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2261E1C9490 for ; Mon, 31 Jul 2023 17:04:12 +0000 (UTC) X-FDA: 81072529944.01.D6D61E5 Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) by imf27.hostedemail.com (Postfix) with ESMTP id 5E0614001E for ; Mon, 31 Jul 2023 17:04:08 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OAbNNQBE; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823049; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hoPDwBR7UkDBRqaPTC6ObTEe9OrRslO4Jma44jkeaBI=; b=yj5+Cp/S4wECb6PA8GtxDdLsgs4NN/+PuZLDQx2gCPz02WP/zP6F19M/0Vkq+6TfwlujHC /bI+Q2Dna31UFCStyHz9vLYdasHYOoXiT7IXRU/0y1Tlrav6kQVJkkjLlwR5zS8wDhbtZP 7ahBEN4/sAg62ot7hfRIM5ZJ2460O1o= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=OAbNNQBE; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823049; a=rsa-sha256; cv=none; b=vEA3lUylRw2mS//v1Sp/vufQ5NoHSZ3iUEZyMuEborya9FaMZMe/pNLq9rVyPCccACaDik MvsxOXw0N1CCqA3aOqU1Ld47niSibEVSOtufK26nMKeozq0TvRGXuVvMDSrOUCVerB9SY8 msY5W3q/Qk7EAzC6yFDRWtpMmG/i6q8= Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-d09ba80fbcaso4920651276.2 for ; Mon, 31 Jul 2023 10:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823048; x=1691427848; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hoPDwBR7UkDBRqaPTC6ObTEe9OrRslO4Jma44jkeaBI=; b=OAbNNQBEQXMPsZxDdWqbwpvcbcC9brAkDdGEYZZSxmgS9fU/KaG8Vdw1eojjPxifHR dAgpTgfKnNikXik7mZu8QxravKkUxiIYGVER2PrkOqRriotSLF3T4LElpBmapph98PeJ CgANJas/sYwEcas//U7Qxkrb0B57mEkHjJFVkSuOLhuhDwIKccn09v9YrEs6kDdqLy4T Ieqhh+PAHMUzo7yeR/3qM+URoXymEQxqZDFSNR+LNsEWiMnR0aGkUyMFjyNfNubh1n44 qou+GBpn9D5SWlHqMqT15mOyIOurWshKH34ovdJcmzrKIbB8XOImOByAI5BjQB0TmzE9 Sl9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823048; x=1691427848; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hoPDwBR7UkDBRqaPTC6ObTEe9OrRslO4Jma44jkeaBI=; b=JhZsMw9KViae78Ct+QtHvmzwrYH7/GSPUbpgawAGFl7+wXElYiH8tPQ41Cm3YYWpnv l7JBiZi4mw2gbU1PJv2/nYkQVZQTw8ZKxwqnck5hQc5852V8vcirTZ/DyxZ7dUXmZevm nep6QxAMJY7rXvYxP0aQ8DaPCoMo9ydkYwcX8NMWkm/JimoEneTDdYYrH5Tf7DZoFeqA UCGsPKmxCA+bQ4owf4UhBpoVsAppbdF72lYU/EuxuF1L/gFLyXvGDQF79KPuEKaFMe/l 0xxafQjjNyaN3+iB9Dii54MIYbPfZ2PyFbJbdgcbg6vPY6sCLkF9EijogiTYa45yoKM6 apKQ== X-Gm-Message-State: ABy/qLZeIvQkdBwprOyKnSdAOqWHZHzbJlOPGEoYDS1VNyMFN4/0hlOV H1jqu1o61m3/gGVTmBnGHwM= X-Google-Smtp-Source: APBJJlFKcIKM/utvbiiE7uhCLg+4EyOcJ7OdfVdmr1i+MWfEQcViSbVO+c8ELmOI+htD8mvz1eRjLA== X-Received: by 2002:a25:f626:0:b0:d10:d237:b03d with SMTP id t38-20020a25f626000000b00d10d237b03dmr9909607ybd.53.1690823048043; Mon, 31 Jul 2023 10:04:08 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:07 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 15/31] mm: Remove page table members from struct page Date: Mon, 31 Jul 2023 10:03:16 -0700 Message-Id: <20230731170332.69404-16-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: z69cpo7mqun1mdh56qf854xxn6tskrqa X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 5E0614001E X-HE-Tag: 1690823048-443284 X-HE-Meta: U2FsdGVkX1+dnOwUkMw/SMvoI4uuMzUmGh4V2A1PP/mGAiqOxWXyhJMugD2yZTHwFPyafOyUKrh4LQgwmFNK6vtFbTmmVPjxGLb/Fu6eBpIWbKuXefSViFfGLr/da6rytk8oefVoM+1wQMTtQZWVYAeDpl1Uj8NV2LvGvBLX9AdVNO+z7nkDvvUav7frg1C9RAKzKqyZ8z/himhOF4LwvKAIInmlc0t+fk/q3s4Cb41xgbznHJh5hFIhRej7MQkP1A26Vng6J1uiBF9VmmVApYMtSp30t6noV1xL7DxCL3bbOvL5jm5EIylfhqeydksPS3DrQdZHlBmlFTwAFfcOqdthzK49avKsIMRLJLl3sYefzmkZGC1zjFcNeWwUNy75ZS9cvaH1sKY1PL0YL9PUE4ZnalCrRR+DHRitfxck89VX7hiWfazQHxo6ZLARvLiG7xMoelgegvFnMhJsLJeGAgkW8KbAXoe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fCTIPw7ev6clYCazMDXzRUhCmTn+gs8MhA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The page table members are now split out into their own ptdesc struct. Remove them from struct page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- include/linux/mm_types.h | 18 ------------------ include/linux/pgtable.h | 3 --- 2 files changed, 21 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index da538ff68953..aae6af098031 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -141,24 +141,6 @@ struct page { struct { /* Tail pages of compound page */ unsigned long compound_head; /* Bit zero is set */ }; - struct { /* Page table pages */ - unsigned long _pt_pad_1; /* compound_head */ - pgtable_t pmd_huge_pte; /* protected by page->ptl */ - /* - * A PTE page table page might be freed by use of - * rcu_head: which overlays those two fields above. - */ - unsigned long _pt_pad_2; /* mapping */ - union { - struct mm_struct *pt_mm; /* x86 pgds only */ - atomic_t pt_frag_refcount; /* powerpc */ - }; -#if ALLOC_SPLIT_PTLOCKS - spinlock_t *ptl; -#else - spinlock_t ptl; -#endif - }; struct { /* ZONE_DEVICE pages */ /** @pgmap: Points to the hosting device page map. */ struct dev_pagemap *pgmap; diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 250fdeba68f3..1a984c300d45 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1051,10 +1051,7 @@ struct ptdesc { TABLE_MATCH(flags, __page_flags); TABLE_MATCH(compound_head, pt_list); TABLE_MATCH(compound_head, _pt_pad_1); -TABLE_MATCH(pmd_huge_pte, pmd_huge_pte); TABLE_MATCH(mapping, __page_mapping); -TABLE_MATCH(pt_mm, pt_mm); -TABLE_MATCH(ptl, ptl); TABLE_MATCH(rcu_head, pt_rcu_head); TABLE_MATCH(page_type, __page_type); TABLE_MATCH(_refcount, _refcount); From patchwork Mon Jul 31 17:03: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: 13335121 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 9770AC04A94 for ; Mon, 31 Jul 2023 17:04:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 87ADC280072; Mon, 31 Jul 2023 13:04:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B3E46B0183; Mon, 31 Jul 2023 13:04:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62CEA6B0184; Mon, 31 Jul 2023 13:04: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 4F2F96B0182 for ; Mon, 31 Jul 2023 13:04:23 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1FF1C1402DA for ; Mon, 31 Jul 2023 17:04:23 +0000 (UTC) X-FDA: 81072530406.01.C5104AE Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) by imf20.hostedemail.com (Postfix) with ESMTP id F11641C0082 for ; Mon, 31 Jul 2023 17:04:10 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=LaN2Z5cA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823051; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bBkB4loM/Mt006iaxsYk7j8UnaAx8a9/NTd5FkPootg=; b=X1jMY7tDna47N9XOqocnbddCl9FeM73klU3eZtGDqz4qFImB/uUp6RdJGMWmc1s6LdrsVf yseXBBCJKdwSd1OnD4l5U4ytMJvCjoX8H+rmaT/XBIGiffsZDvBeim9zBe1dRqp0pAAmt3 nlx2OHwMbbFijSOF3MqL7qUz1v+4cDs= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=LaN2Z5cA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823051; a=rsa-sha256; cv=none; b=T8vcdo8hrcch6+9Fj0FDeNS9TpXTW2N3dgLW24YKI6qhT5/yolIgM86OpIR5bWCZpjSV7T AukeJtdpgHQpgHc0XQjQosb951dnVq9qJkPj3WFtmiA6+UiFxtsTkPWalf3MoFjq98lUTN 0/BKQpsxWW3xJTR2y2BkEKRPERj767E= Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3a5abb5e2aeso3759415b6e.0 for ; Mon, 31 Jul 2023 10:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823050; x=1691427850; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bBkB4loM/Mt006iaxsYk7j8UnaAx8a9/NTd5FkPootg=; b=LaN2Z5cA1g3QHkmu1yTAPuZ+gTgDQXRJQVZ3q2bju3+OXPPdz1JjIqLJAjDfCBEgH9 7Ttgf9+xGINvOvqPbjkBBA+kiz1r/307hJB3HQPBTO+grLv6cLtOMVUiOQ3YqTtB3VhG DR1MJfbiJ1WEF5YzFYY4ZtTmPxDuFx+JwcfSUJ/HGuVXlEGvoPiVmTgBFyMwXloIHduF XN+NqGvI2ErntPxzKW8shpaaIArfirugcPlVxrvDp/YXtjJboT3jqZnutkk3sNOVqTbe 4MBegStktcVwlYOqkBrub1drFP/tUKuFSEW2ULzr9NM6cvzKis6pkazSEIpoiDyQTv+z 2r9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823050; x=1691427850; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bBkB4loM/Mt006iaxsYk7j8UnaAx8a9/NTd5FkPootg=; b=F/PPZIBEXTsDPrf5+EupoLw/JjYVxfCBVWncflvM76AJAiuOIdLOptBG+ulZ1OjgGD MiQSd8DyhXmG2t+kjjoJgYa5iOPJKPdpak3zIkr2+mzSp6nwJGRwIajyMJ4agsCp59I/ R3St+MwdwBfFnmBko2FEakkWWTAWNweakrxiGgffSo6k3lXbwQj6jjPTljNfpa8JpvNX XveFXf0sHrH/W68iEA4i+arhEkWc4VLkEkokncYdeaxGYy1sAw3B1SrgL6yugJOVXAex 7tDI5F9E3UE40Rr+UW96kN9zE4wUMzny4/k8Tl7PCN/QLpRiFclPcDPeEwSMF7gzSSE9 HLCg== X-Gm-Message-State: ABy/qLYhSvKs7/sPa2jDeq+p/lTZOBlzY/BPVJwUrAYs+bmrwvnSxUC6 vDMxaLN9L0Qz2WFyon54uIM= X-Google-Smtp-Source: APBJJlGId6OsNROK0Rrfftpz1UcSUo2PPmBi9KGG5ymdHpGiVY5jldwYwkHVkIkpJVs885EQKvaPug== X-Received: by 2002:a05:6808:2a7a:b0:3a3:ffb7:a28 with SMTP id fu26-20020a0568082a7a00b003a3ffb70a28mr10979580oib.45.1690823050042; Mon, 31 Jul 2023 10:04:10 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:09 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" Subject: [PATCH mm-unstable v8 16/31] pgalloc: Convert various functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:17 -0700 Message-Id: <20230731170332.69404-17-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: F11641C0082 X-Stat-Signature: sqo3tsp6uts65k1q4sj5drkmoku8koat X-HE-Tag: 1690823050-174726 X-HE-Meta: U2FsdGVkX19h7w814FIYYSHRcgkL8An1xa8W4OP/WduSxFNFa7uIAlSpIQCXB/pPeFbE/Jx0eCC+f+j4WFcroBNHvYOaqovrFqmu0P7oLirLrB2N3Xp/3Y+R4njfbQsllpFZG1DoAWgvzy34riMoqwOE+bFR98BjVolrYhHRX+It7DVX4NKcfF38tyN11j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+8vE+zU8u34LfGPgG7l7uuxgo++o1AMd/heQbn2+NNdRUUV24eoL50Vs3oKmLwsXE+bh0Zpy+J6rdVC1SIs8HOqmOkyVSrPJDLZmQlIF5y1dV4bQVuNoFHEssYRcSR3Dde2E5vlqkJWPYjrog83Ln17nkvjXd0GqNDUpDsljapOmyrydqJYlkOhNmA/qvIMgfAhzRfsrbn3pR5JejoJ7ykIIm6Dwc6pwO8PvkReMDhcPZ89qDnOyf4nXK/fgePhoBQDUmwYPGX7RRnbqe5SXC4mm6muvIrF/uxig== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- include/asm-generic/pgalloc.h | 88 +++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h index a7cf825befae..c75d4a753849 100644 --- a/include/asm-generic/pgalloc.h +++ b/include/asm-generic/pgalloc.h @@ -8,7 +8,7 @@ #define GFP_PGTABLE_USER (GFP_PGTABLE_KERNEL | __GFP_ACCOUNT) /** - * __pte_alloc_one_kernel - allocate a page for PTE-level kernel page table + * __pte_alloc_one_kernel - allocate memory for a PTE-level kernel page table * @mm: the mm_struct of the current context * * This function is intended for architectures that need @@ -18,12 +18,17 @@ */ static inline pte_t *__pte_alloc_one_kernel(struct mm_struct *mm) { - return (pte_t *)__get_free_page(GFP_PGTABLE_KERNEL); + struct ptdesc *ptdesc = pagetable_alloc(GFP_PGTABLE_KERNEL & + ~__GFP_HIGHMEM, 0); + + if (!ptdesc) + return NULL; + return ptdesc_address(ptdesc); } #ifndef __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL /** - * pte_alloc_one_kernel - allocate a page for PTE-level kernel page table + * pte_alloc_one_kernel - allocate memory for a PTE-level kernel page table * @mm: the mm_struct of the current context * * Return: pointer to the allocated memory or %NULL on error @@ -35,40 +40,40 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) #endif /** - * pte_free_kernel - free PTE-level kernel page table page + * pte_free_kernel - free PTE-level kernel page table memory * @mm: the mm_struct of the current context * @pte: pointer to the memory containing the page table */ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) { - free_page((unsigned long)pte); + pagetable_free(virt_to_ptdesc(pte)); } /** - * __pte_alloc_one - allocate a page for PTE-level user page table + * __pte_alloc_one - allocate memory for a PTE-level user page table * @mm: the mm_struct of the current context * @gfp: GFP flags to use for the allocation * - * Allocates a page and runs the pgtable_pte_page_ctor(). + * Allocate memory for a page table and ptdesc and runs pagetable_pte_ctor(). * * This function is intended for architectures that need * anything beyond simple page allocation or must have custom GFP flags. * - * Return: `struct page` initialized as page table or %NULL on error + * Return: `struct page` referencing the ptdesc or %NULL on error */ static inline pgtable_t __pte_alloc_one(struct mm_struct *mm, gfp_t gfp) { - struct page *pte; + struct ptdesc *ptdesc; - pte = alloc_page(gfp); - if (!pte) + ptdesc = pagetable_alloc(gfp, 0); + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(pte)) { - __free_page(pte); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - return pte; + return ptdesc_page(ptdesc); } #ifndef __HAVE_ARCH_PTE_ALLOC_ONE @@ -76,9 +81,9 @@ static inline pgtable_t __pte_alloc_one(struct mm_struct *mm, gfp_t gfp) * pte_alloc_one - allocate a page for PTE-level user page table * @mm: the mm_struct of the current context * - * Allocates a page and runs the pgtable_pte_page_ctor(). + * Allocate memory for a page table and ptdesc and runs pagetable_pte_ctor(). * - * Return: `struct page` initialized as page table or %NULL on error + * Return: `struct page` referencing the ptdesc or %NULL on error */ static inline pgtable_t pte_alloc_one(struct mm_struct *mm) { @@ -92,14 +97,16 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm) */ /** - * pte_free - free PTE-level user page table page + * pte_free - free PTE-level user page table memory * @mm: the mm_struct of the current context - * @pte_page: the `struct page` representing the page table + * @pte_page: the `struct page` referencing the ptdesc */ static inline void pte_free(struct mm_struct *mm, struct page *pte_page) { - pgtable_pte_page_dtor(pte_page); - __free_page(pte_page); + struct ptdesc *ptdesc = page_ptdesc(pte_page); + + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } @@ -107,10 +114,11 @@ static inline void pte_free(struct mm_struct *mm, struct page *pte_page) #ifndef __HAVE_ARCH_PMD_ALLOC_ONE /** - * pmd_alloc_one - allocate a page for PMD-level page table + * pmd_alloc_one - allocate memory for a PMD-level page table * @mm: the mm_struct of the current context * - * Allocates a page and runs the pgtable_pmd_page_ctor(). + * Allocate memory for a page table and ptdesc and runs pagetable_pmd_ctor(). + * * Allocations use %GFP_PGTABLE_USER in user context and * %GFP_PGTABLE_KERNEL in kernel context. * @@ -118,28 +126,30 @@ static inline void pte_free(struct mm_struct *mm, struct page *pte_page) */ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) { - struct page *page; + struct ptdesc *ptdesc; gfp_t gfp = GFP_PGTABLE_USER; if (mm == &init_mm) gfp = GFP_PGTABLE_KERNEL; - page = alloc_page(gfp); - if (!page) + ptdesc = pagetable_alloc(gfp, 0); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(page)) { - __free_page(page); + if (!pagetable_pmd_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - return (pmd_t *)page_address(page); + return ptdesc_address(ptdesc); } #endif #ifndef __HAVE_ARCH_PMD_FREE static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) { + struct ptdesc *ptdesc = virt_to_ptdesc(pmd); + BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); - pgtable_pmd_page_dtor(virt_to_page(pmd)); - free_page((unsigned long)pmd); + pagetable_pmd_dtor(ptdesc); + pagetable_free(ptdesc); } #endif @@ -150,19 +160,25 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) static inline pud_t *__pud_alloc_one(struct mm_struct *mm, unsigned long addr) { gfp_t gfp = GFP_PGTABLE_USER; + struct ptdesc *ptdesc; if (mm == &init_mm) gfp = GFP_PGTABLE_KERNEL; - return (pud_t *)get_zeroed_page(gfp); + gfp &= ~__GFP_HIGHMEM; + + ptdesc = pagetable_alloc(gfp, 0); + if (!ptdesc) + return NULL; + return ptdesc_address(ptdesc); } #ifndef __HAVE_ARCH_PUD_ALLOC_ONE /** - * pud_alloc_one - allocate a page for PUD-level page table + * pud_alloc_one - allocate memory for a PUD-level page table * @mm: the mm_struct of the current context * - * Allocates a page using %GFP_PGTABLE_USER for user context and - * %GFP_PGTABLE_KERNEL for kernel context. + * Allocate memory for a page table using %GFP_PGTABLE_USER for user context + * and %GFP_PGTABLE_KERNEL for kernel context. * * Return: pointer to the allocated memory or %NULL on error */ @@ -175,7 +191,7 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) static inline void __pud_free(struct mm_struct *mm, pud_t *pud) { BUG_ON((unsigned long)pud & (PAGE_SIZE-1)); - free_page((unsigned long)pud); + pagetable_free(virt_to_ptdesc(pud)); } #ifndef __HAVE_ARCH_PUD_FREE @@ -190,7 +206,7 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud) #ifndef __HAVE_ARCH_PGD_FREE static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { - free_page((unsigned long)pgd); + pagetable_free(virt_to_ptdesc(pgd)); } #endif From patchwork Mon Jul 31 17:03: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: 13335116 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 60A0CC05051 for ; Mon, 31 Jul 2023 17:04:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34AA96B017E; Mon, 31 Jul 2023 13:04:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A9A56B017F; Mon, 31 Jul 2023 13:04:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 124106B0180; Mon, 31 Jul 2023 13:04:16 -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 EE44D6B017E for ; Mon, 31 Jul 2023 13:04:15 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2E1E140BBF for ; Mon, 31 Jul 2023 17:04:15 +0000 (UTC) X-FDA: 81072530070.28.EB1507F Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) by imf19.hostedemail.com (Postfix) with ESMTP id 34EA41A001C for ; Mon, 31 Jul 2023 17:04:12 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=S9WpMAU4; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; 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=1690823053; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=jHkn+4hWn6cNWfQmftBQOtWQYQb9iJJIYcRZZNmu6iY=; b=AGAtfJNy3uOtgn0O7cRVI1z+VU+jcC+dwBhgea51rKS26KlWa8F2D4ksbpXCULRB8fIZrv T6TDIJNkOGMC9savqbTpTJ8g5jHj8Soyv77IETWG57BE4JlZQV6iYR1H0Up4QkTqPFQXNL E+OivNQ5n61JmUxynHUCERO35tSe54w= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=S9WpMAU4; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823053; a=rsa-sha256; cv=none; b=60bSXfhSQml8gfzTYJiuDTWzKTrIpsnBG2VqSKvoXZqarkU39zYBQkOwdVqSnWsD3yoP4e wd4kewmz31j6w+mHr/R8gW9ormrkXkQUpa//TIX+DmZvBf9s9aSfBPKDtNvFr2iQmHGf0I JO0+5VLPq2aBLBV8fL/Xras6PMryr4M= Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-d0728058651so4980562276.1 for ; Mon, 31 Jul 2023 10:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823052; x=1691427852; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jHkn+4hWn6cNWfQmftBQOtWQYQb9iJJIYcRZZNmu6iY=; b=S9WpMAU4z7s2Ag9JtWlTuDFooWQlFyPv89tIlGGSbz0E38KMeV4JUqyRKP7B2mlsst 3/F+7yoyQbv3i3KcMwuVSsZv9i7LAi+BdMh8bqQ1OIkDFwNfq0t6pWYwMasYC2CpjBTn bovNcdPK8kmT56us8VfFMktVF9KG2tmTn5UTLjX+ZXj2DR3oFDYqVFA7hvTFAXfeR6X5 Q0VEEuNVDIcDX6dTwPvkDuk+ca9lyAO0oa7PZRgQNSWYVbj0QEi1SCUj2cu+UiTNTCrz l0MpQh+abPw7+Fj+nKTUpgwidBjEPvlqq0Mg8+dCJJ46uHZsBMSboAizdy+gmVRglE/z 7Cpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823052; x=1691427852; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jHkn+4hWn6cNWfQmftBQOtWQYQb9iJJIYcRZZNmu6iY=; b=QAm3MpD35q52zLcMKztOhE6SYvryzOjVuJYyzJekyhGlvu/jKZJEtY08sz1MtHkzFC KdN4Ygsl3Cv7ZYOg8kXxu/1/2G7y7I+Dv/YKP7OmkuyXdAEjdzXh7dPwDDDYVhQlcDA/ ugPaH2CmpP/GpD6rQBpY9XPw25sxPnoic0xq2YvRyp1dLA8fHc7/ahRUZQwX9xab2TZG EkwW9jGt099hh3lPxutXjZU3lrPY3YPt31JsAeGmVl27HpwmCicoMFLDBUn3jAAsLzN4 oWkjoJy7q30S77YdLRlmQtjIvh/+vLo6mlRh9qJ3ZL/Okswx8HDiumxxzMsFj65vdqKz 1ytQ== X-Gm-Message-State: ABy/qLaqG2LscjKKlK05gfu2EZZy6hnvUsZWCxyM26Ard1JqKBw+st4Q FVR/Xv9hva+bBpjBe7JdJp8= X-Google-Smtp-Source: APBJJlF45VM+96NADPgQk/bfcoyXe13svaytrCoN6xBKbPq7ENGGS7BXy6U+VNxQQfsm+MAmj6JoEQ== X-Received: by 2002:a25:b296:0:b0:d35:cfa3:cbde with SMTP id k22-20020a25b296000000b00d35cfa3cbdemr1080223ybj.38.1690823052039; Mon, 31 Jul 2023 10:04:12 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:11 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Catalin Marinas , Mike Rapoport Subject: [PATCH mm-unstable v8 17/31] arm: Convert various functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:18 -0700 Message-Id: <20230731170332.69404-18-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 34EA41A001C X-Rspam-User: X-Stat-Signature: 3snfnsmf7uybzi3bh1awi3zjs46rw189 X-Rspamd-Server: rspam01 X-HE-Tag: 1690823052-703556 X-HE-Meta: U2FsdGVkX1/lYAFWb3OLGRAVXpsTbG39SOsuTA2Dl/XoCYUURpTt7oKGUDgClkbjpjjppLDS2j2iAZ91L7U14b8E07Y8I7Fj3udssnR9HE1Z5iF5HBQNsQtAIe0v4AbBTq/7H8pFXukQL1NsyRxY9WYtcYn9++BhJHdB6MqwSqDIJXx0CN5tuxbFMgqPXEP1y4jHppLyuy0xwFiaL3Rby0U9pmlq90ZFy9A/dCOB8G5eDycFe7Yl9jcxE9rKPccjJAKNUBG+Ne7jeZg1+j+ZRUKuppaL4Jor1hlNfkUSpsQoPgsXYyA6kZ1FFwi+R7d82P1S2ShYbNQc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2j+5GuNBQV0xi+GQtrnFR2c4zu4F4g1P1D1fiVSg5BKeV7J/HTg8PhkN7rqe/QTSEe3q5VMSbyDTjezNFgRFGkgQcG2O7d854gTpuM8cvQ8zu8HePIzugd/nHWSTi4dd+wDsC0/Wqs2r7gh8HBBs52cFXFsP3LxvmrJT4MpGtphXx0C0yiRxw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. late_alloc() also uses the __get_free_pages() helper function. Convert this to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/arm/include/asm/tlb.h | 12 +++++++----- arch/arm/mm/mmu.c | 7 ++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h index b8cbe03ad260..f40d06ad5d2a 100644 --- a/arch/arm/include/asm/tlb.h +++ b/arch/arm/include/asm/tlb.h @@ -39,7 +39,9 @@ static inline void __tlb_remove_table(void *_table) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) { - pgtable_pte_page_dtor(pte); + struct ptdesc *ptdesc = page_ptdesc(pte); + + pagetable_pte_dtor(ptdesc); #ifndef CONFIG_ARM_LPAE /* @@ -50,17 +52,17 @@ __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) __tlb_adjust_range(tlb, addr - PAGE_SIZE, 2 * PAGE_SIZE); #endif - tlb_remove_table(tlb, pte); + tlb_remove_ptdesc(tlb, ptdesc); } static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr) { #ifdef CONFIG_ARM_LPAE - struct page *page = virt_to_page(pmdp); + struct ptdesc *ptdesc = virt_to_ptdesc(pmdp); - pgtable_pmd_page_dtor(page); - tlb_remove_table(tlb, page); + pagetable_pmd_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); #endif } diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 13fc4bb5f792..fdeaee30d167 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -737,11 +737,12 @@ static void __init *early_alloc(unsigned long sz) static void *__init late_alloc(unsigned long sz) { - void *ptr = (void *)__get_free_pages(GFP_PGTABLE_KERNEL, get_order(sz)); + void *ptdesc = pagetable_alloc(GFP_PGTABLE_KERNEL & ~__GFP_HIGHMEM, + get_order(sz)); - if (!ptr || !pgtable_pte_page_ctor(virt_to_page(ptr))) + if (!ptdesc || !pagetable_pte_ctor(ptdesc)) BUG(); - return ptr; + return ptdesc_to_virt(ptdesc); } static pte_t * __init arm_pte_alloc(pmd_t *pmd, unsigned long addr, From patchwork Mon Jul 31 17:03: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: 13335119 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 A6EA0C001DE for ; Mon, 31 Jul 2023 17:04:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 93B7E6B0180; Mon, 31 Jul 2023 13:04:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C5B7280072; Mon, 31 Jul 2023 13:04:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A200280071; Mon, 31 Jul 2023 13:04: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 572AD6B0180 for ; Mon, 31 Jul 2023 13:04:18 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 369CF16031B for ; Mon, 31 Jul 2023 17:04:18 +0000 (UTC) X-FDA: 81072530196.02.926E079 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by imf15.hostedemail.com (Postfix) with ESMTP id 4845EA0015 for ; Mon, 31 Jul 2023 17:04:14 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DoLYDaRB; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823055; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1W6z1I6yvWrQZbHmgHYBEGZZDstSbvELOPET/EcKlKw=; b=CNRNqydFQU30fHNpX1gymLK7Ztn+cMmm0w9N6c61ox72V1/ZVw+0d91XXR45/lz2DRbSzL oTyo1hpdFXFXR+uIzwe1Gv+5s1umBAdQesiq9O+pZWdATZjamq4rSE1BNPwLUTws04JQfM So6Zw4yOmF4Hv6Uz6HFji0kKMZrxw04= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DoLYDaRB; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823055; a=rsa-sha256; cv=none; b=0O8/2hweMynMmjv4uindArNkFc5qOhTWo/M/iK2A9uWiUlftBaKCtFALrdoEXMbqVjVenv LIi4HKDSA/NkHgeNd3vK5OY905rGYNuZxJUT1ANLUVuvR+L71VKRU5gqbtR7ZGG6Pi28/l tOcoBtlj2CGW7QTy6zxsMXNRGH+IXxU= Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-d29a5f7dc74so3268156276.3 for ; Mon, 31 Jul 2023 10:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823054; x=1691427854; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1W6z1I6yvWrQZbHmgHYBEGZZDstSbvELOPET/EcKlKw=; b=DoLYDaRBa41Zdh1yGELvr4mktDPzCr5wZMtfaOFQzQ5hTcfRkcfNo2gxzOD+0/ykOM euBOcnH4+UQlm104MdM8Mcd6Wd+0oXQ7r2d8C7k16OxK93xpXJQ9cxidNEnw+09+Tsgn 4MiJbaZ4azooZbJym/w2spQi4ZLNoUGyQvzF+yt3P/maH4DT1bEGYtqh5RJ+6A+RSiNZ F4VZO0F3scHf9jVdMvyffz9Y4Un+dZzmqLUFBUExZqr5BTOKTZ3vKrNuYiRkZjRgx8qM A0v2BAwmzAgXUoHV1OBdUh/BQxSYjg1Y5Vc+ifw6djIqa1GbEqCTgLRTuyk3SSeDHWhN ZcIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823054; x=1691427854; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1W6z1I6yvWrQZbHmgHYBEGZZDstSbvELOPET/EcKlKw=; b=QyXjfx661GKUFXlvS17g0Ymn4eziEZBEkRn6sOKFlLuGQXwKBqaYRXfUFUSFR3oOC5 3DvhFAXHp4HZid1QN8yMy6cWAdgw/3aQ+l53/XYFVLgGiuXEW4EjgAO0YhsUOMkdVvlW sERs5NV1UXQgzo0PyZB7sFFxILVMdrtVv1onQs1ZRHRmow7Xtb3cpPRyhPTJw97SHWPV 1WVpLniXjvsIHOosS4i4b8s/F88pnprx+cL4LV7CLMUivzcacVcorQmNdMKZnfz5Bvt7 aYvO8/6Jww8lO4TB40LcMs49m7q6R2BznTwAhW8/Cv+qgBsUKm5DvifUwZI0fmtYHLgx vZQA== X-Gm-Message-State: ABy/qLYrJ3KybSLKYpy6AWonTIN7AjQvPsT1OPHw8lgNm2rD3+CmdT1C jHhBxiCLR5+p3+VybZHBMo8= X-Google-Smtp-Source: APBJJlEdpRjJyqAaQhaJuPKqzpefz2AFbwFC7sVhDBH7lQjGs0g9KoyKRkFSzeflgvIaUwqu4lunqA== X-Received: by 2002:a25:b08d:0:b0:d11:2a52:3f35 with SMTP id f13-20020a25b08d000000b00d112a523f35mr11488364ybj.20.1690823054136; Mon, 31 Jul 2023 10:04:14 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:13 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport , Catalin Marinas Subject: [PATCH mm-unstable v8 18/31] arm64: Convert various functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:19 -0700 Message-Id: <20230731170332.69404-19-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 4845EA0015 X-Stat-Signature: xuhaifbx4k8d3aoqijyegmxcfb94kboy X-HE-Tag: 1690823054-65646 X-HE-Meta: U2FsdGVkX1+Pq3XmrTw7B6oNwNtaB4MKPUwPa+66qRKzu7nsEvZeRFLiSx5zWV5ODVBHM2Mghy2AHSaDBWS4L7Z+VHtfBEgIQVlgsoSRAJzl9DdX0IJH54ttyMooCsnhSjGwuqRkGpDwg4a3J7yjs3x7WN20fx9iNSQs8FENDh/vKZGa3x3/mArWyXsm9SP8qhWgbeC5dugRhSQ0Y0Fl0ySDOlMBLci8lxNimzngNJJRW57O/tMZvjMh7PkGVd9q8J8D6iaUn/Tm7lFNF2ncDrajEAVa0TcqptVPBvqoJXJa6umWqIGbJj3jvCr1eWVv5ml9r4N9d3lkrSugeG/kNCtuvdui78HWkTkV7BjM+HZiJ5nhV/vU4gWcQghjag+i/FnrJQ64QRu8iDqpS6zTvZnucEIBNckBhVXjHD7bHotUm2iO2tQlUoLMRQZSFqxWoxqfxaU5QAr4Gs87R6LfukN8v4slDhC63B9U92mQKcnjszggA2fJ8KXvOtyHPJ/oqj/NTKAH84Lc864M773PfuwtldRGmJB/o57bDvkYu/Z9EZFsFJ8ahzv40wTm+rrMMg4VakzNuUKm4hlNO2ZQRF7AwWO1AlmFovsMpXp/0iZvnzS3sYnh2p8yqwGWyOiD8AuQ9C4Npdxrnhkc1QIEgZgUvhfPRQ7pknTlrYBuyA3MzRgZNTtzj69fvYzphPNlRDsxpmRy8WGY3cgUZIJ8vOXg/hSmNP4UYI1ctYtoWIWfETNth2HUrS1LDFV6G8kqqpBmYbTiWcapwNclq2NkR8UQwYx5b0agSoWQGuHYMAeRmnehFAXRlPxg/nkkREA4TGwZMlghoLhklUd7Qdgb359liTXuZHHDWBKYzNrBIh17CWTEA8yEtTWgQcYsat46Q31fiwLfLe7e3KgRlSJolFjbb3WQii2ZE7CI8Vgox+2bvWe5oc2zhViEBKnPjUtMsthbYzxrs/zGu1tJAcj aUOMOjQv vq3QzJ3cBmERMrH6hQPbxzAfs2jaucXUr5WnEC+JsuKLLVTFHJDdBJ9KoeOn8zDKzylsdEy45Ye1qQESawnVzw6p47MADyxs0PzhH9igzcqLjZ8ZFvy84UBvVNqRa7K/EjZh2dYksU42nnOzPDSkUc6f6eBWTlWDV7F6Wkm1usBLn7h/9DKaqxaPr7+GCdE/UDYNuQw4m9t4jGQ2eAmKGx0KwbrPdiO0ePhxhineUgj33+Ko/2f402pOqeo+g1a+hQ3yMZg9v0p7xSXs4rnHUKNks5JoQr1/DO8xnqBjsebVkIp9xRfBEmIRYoY2Ipwn7SX3gq5GsGVZ5Leg39RqC8wLp3e7mkK4X9+/ET0+7euTonvAvCg8EHD9I5HNbzPl/uxELi+FjOV8ArH1vS+ZZctBiH3EhTvic33/7mY6tVb0MTJUMvyJV7alQR3mWAPcgwHC5kD6NO8Rha4JeIbVYJ547v0uuVGeGtity8YQiseQr/jhPyKFO1V5WMXT6U80K0DBaipahYY7tNhXMKzv/m9NeCi9zYrunZzuy6al0z54B+RfROSgVMjbeUM4DLbxO3yTjmgAjXftBITq+UfNbtyhrs/ku7pQSdrBPo6vAtX1xcs9blQeBY/SqTIcqTAYHTiLF5lt6HwIEgBHPLF6VAYQXLQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) Acked-by: Catalin Marinas --- arch/arm64/include/asm/tlb.h | 14 ++++++++------ arch/arm64/mm/mmu.c | 7 ++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h index c995d1f4594f..2c29239d05c3 100644 --- a/arch/arm64/include/asm/tlb.h +++ b/arch/arm64/include/asm/tlb.h @@ -75,18 +75,20 @@ static inline void tlb_flush(struct mmu_gather *tlb) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) { - pgtable_pte_page_dtor(pte); - tlb_remove_table(tlb, pte); + struct ptdesc *ptdesc = page_ptdesc(pte); + + pagetable_pte_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); } #if CONFIG_PGTABLE_LEVELS > 2 static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr) { - struct page *page = virt_to_page(pmdp); + struct ptdesc *ptdesc = virt_to_ptdesc(pmdp); - pgtable_pmd_page_dtor(page); - tlb_remove_table(tlb, page); + pagetable_pmd_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); } #endif @@ -94,7 +96,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, unsigned long addr) { - tlb_remove_table(tlb, virt_to_page(pudp)); + tlb_remove_ptdesc(tlb, virt_to_ptdesc(pudp)); } #endif diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 95d360805f8a..47781bec6171 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -426,6 +426,7 @@ static phys_addr_t __pgd_pgtable_alloc(int shift) static phys_addr_t pgd_pgtable_alloc(int shift) { phys_addr_t pa = __pgd_pgtable_alloc(shift); + struct ptdesc *ptdesc = page_ptdesc(phys_to_page(pa)); /* * Call proper page table ctor in case later we need to @@ -433,12 +434,12 @@ static phys_addr_t pgd_pgtable_alloc(int shift) * this pre-allocated page table. * * We don't select ARCH_ENABLE_SPLIT_PMD_PTLOCK if pmd is - * folded, and if so pgtable_pmd_page_ctor() becomes nop. + * folded, and if so pagetable_pte_ctor() becomes nop. */ if (shift == PAGE_SHIFT) - BUG_ON(!pgtable_pte_page_ctor(phys_to_page(pa))); + BUG_ON(!pagetable_pte_ctor(ptdesc)); else if (shift == PMD_SHIFT) - BUG_ON(!pgtable_pmd_page_ctor(phys_to_page(pa))); + BUG_ON(!pagetable_pmd_ctor(ptdesc)); return pa; } From patchwork Mon Jul 31 17:03: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: 13335122 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 3C322C001DE for ; Mon, 31 Jul 2023 17:04:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 40BA7280073; Mon, 31 Jul 2023 13:04:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 36F6D6B0184; Mon, 31 Jul 2023 13:04:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BFB2280073; Mon, 31 Jul 2023 13:04:26 -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 0A1666B0182 for ; Mon, 31 Jul 2023 13:04:26 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DDD0A1A0A29 for ; Mon, 31 Jul 2023 17:04:25 +0000 (UTC) X-FDA: 81072530490.14.3F03FB2 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by imf13.hostedemail.com (Postfix) with ESMTP id 458EA20050 for ; Mon, 31 Jul 2023 17:04:16 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="VD/5YQf9"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823057; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/CuYJ7liBLmFxtlpmCAIL/qtog0vkZLk1dVk72P32nA=; b=JxjwdFHXbN+va5/Vc81+OEOZ/qa7ZhWdUdI6m8yyRqYGo5TQ2DjZwRcSVaMP9+kihatULf WPRC4e9OVWif6D2nBvfZrRhuB2VG7mHpcHmmyqriabvM9BwlS0uyYVSb2HXtqgB5TTxhiA varO/isdiE28kNZpF3UuWT/tlQI2UbI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="VD/5YQf9"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823057; a=rsa-sha256; cv=none; b=TTMgP5F2iEhq8DXEogzpUB5aPYc1KX6Sb/VMnAm97je9nl8kOB5gqf3xMOQZXGQepMW6C4 I4M+htdIBsmXEzEYr3jCYgFcSmB8S3WzgUh7LaKfzlvXFGgPpWfLOH0Kk4y/x2S+GlARXp 52zuy7BCbXUC7reAXhpKPyrUkrW1hx4= Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-c5f98fc4237so3738599276.2 for ; Mon, 31 Jul 2023 10:04:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823056; x=1691427856; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/CuYJ7liBLmFxtlpmCAIL/qtog0vkZLk1dVk72P32nA=; b=VD/5YQf9dWYT3s+XLCXcwwiIVAHAp/pIe7AMdOvpExYmK5HjPOWTZu09sLOfQMxAfC OXuPdz7Tj/gRexFEV/+v0Lea9a4mnAUKnOzN7P73JNN0+oqdEeWVHp/XrVyDKMN3Sqzq XyvfOK4vNNg4SIqEO+DbR5HnEigDlCQMi9XWjP33h/pZyUUMJf9cJEbHTYSdJe7xIVgq 5L6GenpajpPmM3TvCUDFhBdcux4f7GetW1kVA2GoYO0OMNWSzyNz+zkHnzCWEOnqLDpJ MBPlFqECJSKW8b/LiB8vJt+wWDGPekjS3XxHyTLS29uaM77UixmV7cvi9KvK+lFaz9YU pXeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823056; x=1691427856; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/CuYJ7liBLmFxtlpmCAIL/qtog0vkZLk1dVk72P32nA=; b=SY6sCqTIRxy3ki5VWdOQLFdjFYu8MVqhhB/pgJS6WuYd5eKhVKc8IGL1F7tbtc3LHs 50EDdqTZ+jIusjT9Y6MDL9Jzq1w/l6qgJg+zKQBbXzY6VsdnBv+LJwZQJj2oL7Nh4W7k n8+VfDDfIltHMXokTb5zxhI3qFuWFxxbODDtk6rQtHhD7id8yevIHS2gmVOaujsP8SQd WY2REfVtZuy4PdySULGGU/XjAyN55E6Bueb9wz2dUtKm2+zz351i5XwDSyKbCa5edgKM CZ6wMOiUDoL7a9GGTZ54bhwNeGfJhwsbsFtG3QtTRg6TxA8iBtO+9q8r3FcvdxQi0M9K 33Yg== X-Gm-Message-State: ABy/qLaBACd55SlrrGdrQa/60WtzC/t0NmXgbVFfQpnfF6jKla09YdWt pPrmqxFCbU9CzeegaE6KdSA= X-Google-Smtp-Source: APBJJlFHDXc0WViYFSb3R2hW52w3IhQItZ8A+xKJNI719Lf54J20Rc3nckyX4WKCIAYzzN+QzoVnBw== X-Received: by 2002:a25:734c:0:b0:d11:61da:3a58 with SMTP id o73-20020a25734c000000b00d1161da3a58mr7589775ybc.54.1690823056172; Mon, 31 Jul 2023 10:04:16 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:15 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Guo Ren , Mike Rapoport Subject: [PATCH mm-unstable v8 19/31] csky: Convert __pte_free_tlb() to use ptdescs Date: Mon, 31 Jul 2023 10:03:20 -0700 Message-Id: <20230731170332.69404-20-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: gjtf3exdoc68cuohyyc7sistb7zysyy5 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 458EA20050 X-HE-Tag: 1690823056-856377 X-HE-Meta: U2FsdGVkX1+WRkY0fIR2CDroiGWEUWWjSLQWJXwcHY6X9Nb109SPcgyP3SBSKd5KHDZgHKhbg9SGJdo3/J7hdEhk8FF+TrAaPGSvou8HoE7r/O0r23r4d/KeszKR2EaqO58uDMp2Y4v8v6kBghCdO+wnfnXpd2qhyhBFjsekhIT/0jQ7RSzmanTlaoXe8ckoh7jXEg970S3cpxjDve3fiQqAvoESGz+RGXVb3q7bLt2FWPTZH25MkELzcYRnckBt1PjjOFUSu6voALySsndZTnowByZcDqY66zI6qz+N8ZnAIYLwQu2KZRxtx2mjDtUUHJa7wlCDm14Kh49s3M0aYeBZIKyIu0+RWDypf+iprA/gxk2W4G+6DYS/jBxkmswg1tY75b+OKxfkQHz4a8JfqtMPxiEDUc9n9gXJyKjiTxLE78XRDgxUqsHmRnjzb5CZyg+jydC2qxlONORXT2OL4NiD6eeCNQo/50X8QIuJh6iCyU0U5pLAiy0tYAYxaQ4o4Jl+setKfQj9VPDNBm+9qguQ/pAcJJ/SItiGG0CRrRz9ztfbkOLJq1Z0rFnVauUBq1oPkJMuIWBXS+utcTHrLoxgqQxOmFi26laiOsQYUj0tq5b5oBH3GgpQDw5BdScEDeJGW7mphN6VwdM8DFCV6e8IRgXdNsA0Mk2PXoBYRlQjIORawdmqsgqDjrTZqpLcEgwIJgKrEqlZDad2r+0dMnQ+wlnn6OQjz8Stqv1a+OO2u0oRvzWagqbz9eKTe3+/K2U/YlxAXJ1Eo49I7DkNUHTJKSXAEFbPpQcJkD0Gl3ZBPDkwCUs0vYToJRLoYaJxeWIUzqXbyEM0rs/OCncadfKgEUS9G9GaFk7xxOdadtmUFY3dtGh7faaUKTdYRrqb4unNVse2YIdpPsqk/sVc2/xuyT+AHH2FpEictPFy9OLCmtt3euLrbFXjWDRLX6HzgFagqJclYP+mIgX5XP1 7b9oPUpm O3b5Xx96/eCh0bKCd8VZAxWeLS81J24og1J9jlxPTFeTMbw44rcACnej3x4UuhVsKiGZp1dVF7MrNCroKGtwbHU8br8xX1lbxMrMvXCsc+A7PtXnoV6E94+bsoOab16rjnzr6wuaDQQDdfzJOiCsuAoBKygtJHcdW71hJjsYEK7goBbjvZ/9MsHMVE+uLXeD2ORKSNcyLv0AfuqogHbcpW3EH8HLjbece3YULPqAGeDuFrvwT3kjIR8TbDBKJNnBb/rl8lrrI5lkDuAeRoxLqzfPtQtL9iLudo9ISzMwqdLWoTtTAB9y4UNOHStVBj8BML8vxi6It79uR9OXA0E9MtkNcg4h/OCsilu2N++noQi8XxJQjFGCmy0csF4TnBZ+7+sf82cT+biXz8oojqvNZeDsDjmGqYnfXf55aCG4bn2tPTJHPp0l5kQO8Yq/b1EU6N7i7/83uBSmMqdTJlN7oj56Jsd1gbQudcIBsmbBefYxplTMl86H/eKBPL7w2gIUCcjcP3d2SSnbY7Pchw2R9ipqWFVYkhTtfhQWQqzRKnAcopYn77XHTs1Ty1kUDxOplDE02+vyVb3JJzbfLvwmA1qLGu5ytWcoA9fMnTH9Q8yAGAS2F/jySJgvQe1YjHOEKQNr/dI8ngVv+ZyY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) Acked-by: Guo Ren Acked-by: Mike Rapoport (IBM) --- arch/csky/include/asm/pgalloc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/csky/include/asm/pgalloc.h b/arch/csky/include/asm/pgalloc.h index 7d57e5da0914..9c84c9012e53 100644 --- a/arch/csky/include/asm/pgalloc.h +++ b/arch/csky/include/asm/pgalloc.h @@ -63,8 +63,8 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) #define __pte_free_tlb(tlb, pte, address) \ do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page(tlb, pte); \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc(tlb, page_ptdesc(pte)); \ } while (0) extern void pagetable_init(void); From patchwork Mon Jul 31 17:03: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: 13335120 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 4B878C001DC for ; Mon, 31 Jul 2023 17:04:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 260E1280071; Mon, 31 Jul 2023 13:04:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 20DFF6B0183; Mon, 31 Jul 2023 13:04:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F06F9280071; Mon, 31 Jul 2023 13:04:21 -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 DA4266B0182 for ; Mon, 31 Jul 2023 13:04:21 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A8734140347 for ; Mon, 31 Jul 2023 17:04:21 +0000 (UTC) X-FDA: 81072530322.30.E44F214 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by imf09.hostedemail.com (Postfix) with ESMTP id 92F7C140018 for ; Mon, 31 Jul 2023 17:04:19 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=LZWvv3P5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823059; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aUnc1suNAj/KzreaB6s7vAsOWiJZx3FNBLzDbQjj/SU=; b=y0SPS2ttpw5+krPLLw9RuJx/2e+SMOiP4jPlQQ4B6XJGdfXFZnWnobo/m5dplKKEd+55ro MC5pXOOWpK8fqTmIdKTHM100fjYw8ZLkFKVuVpyfkMeUVLCYzjug7vjCoR6vZacNWzA2sq 9xolOqG6/auZeGKdkvDSZ+3fk+eGRA8= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=LZWvv3P5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823059; a=rsa-sha256; cv=none; b=5XIAmLxFmdgwehh9SWxtil6Guptfh41iLaoOh1ZIuSXYdVFcq3jda4weN98HskwdKRAXkB U0RlAsiA9LE69VHxKcIyN5PAQPi/j6GIGaiIKKCrm/h9R5aekQ/fHmmb8IELxG2bBpT2YF /tA6qkJQ6jU5FvG+WTdN4j+PoT+4qY4= Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-bff89873d34so3787359276.2 for ; Mon, 31 Jul 2023 10:04:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823058; x=1691427858; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aUnc1suNAj/KzreaB6s7vAsOWiJZx3FNBLzDbQjj/SU=; b=LZWvv3P5ObD312NoT3HCx6hT2mcipY2zu8mSMdCIx/PBIBw4fnj2ZRkQKvrh+bnMcb cAhsWuRoUJhfVjNPelqZekFAhbwYfyzvXSZQKgwb66CUaJSig1RixymjgB6EpjMZeG9i TPX/SETFM0d6TUT+vW8F9GlkDQXYjB62fk/7jUTcwacjm8I/TfM4mDRrCt1nWg7/91vP laynl0EMAor5eoXfG6EYJS8WyMBq5PEy+tqv6UFYxDYMRASimm9gjZvXzBE5l6AVAiGx CLfIZvVLYDlmtO9VH/rc+XPRyyAblWv0VbvnMMW+5OEC9ZkYXTzgntXD+ElukV+Op4w9 X05g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823058; x=1691427858; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aUnc1suNAj/KzreaB6s7vAsOWiJZx3FNBLzDbQjj/SU=; b=R5L+z4YtB7uxrkX+x+y/Wec9ib4814SmyOH3fDb9SK/71rBAkIfw9eojfyn7Okt9LF ZpkonG4NODn5P+g2ricWHIxq4jM12oYoQyN5fetC6r/VHUrW+bEIffiirYAGDg82lVZ6 rRl1Dhbs3U+mO1UGOTotfWsL8sARaaigj7SLTkk/W8Ps5gViNgoNk3A0PY6aG0xdII/x R6YMvrkUMjKsxEitBZYcecvKEDIMD3uZncqL6i0g9LqJ1yTjQZQP28TU9P/3iOj+eCQc siziDE9HI6ofJ9fLfdjM020oIogsNAceBMeMDlN3nKNOnWS5iuyVMWQEe4O+KdthQh9I Fnug== X-Gm-Message-State: ABy/qLafpsrB5hMLA5WNCsoVv/ISJ1bdAdnqtEG16M6YKRA+QfJAVyF9 zr1i8GWLehb/F+qlhqaY5u0m6EQEivk3WA== X-Google-Smtp-Source: APBJJlHweyU7H3TneHig7w5n/DLDjL/9e2cIxm5cNvwqW36o28cnjEbZQWmE0nZHXnpgzHbA2ayWvQ== X-Received: by 2002:a25:acd2:0:b0:c6d:f875:520e with SMTP id x18-20020a25acd2000000b00c6df875520emr7715191ybd.49.1690823058269; Mon, 31 Jul 2023 10:04:18 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:17 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 20/31] hexagon: Convert __pte_free_tlb() to use ptdescs Date: Mon, 31 Jul 2023 10:03:21 -0700 Message-Id: <20230731170332.69404-21-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 92F7C140018 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: wmq8kca4c6hejuyuqawzxny4qbitmpsd X-HE-Tag: 1690823059-568146 X-HE-Meta: U2FsdGVkX1+CdIzk7HXl2pvsw2d27vM9X7QtZ9Eoisz7CWZmUX0LturgZn1K/Fp70a07HZVE34EeJTOPeCGPfsKtDoeYciRX0JTPjDUzLfkiPG5bIyCmxqvJbAFZityexCF0zY9tn/CimUB+co1vWyxpGfmYanNrRRbmCNUvfAYIxTu4ATWGE6sdWQumrWMYDgc8xP4Ozo3UVZxhluL8/WBWe1DFWa5MWqbH7JS7BI2+sgt2/b9XGlbulZZ6c6GNPtyiTqj85bg/akmX/IKkmPl/TqAj1E9ZkfxHCsXTafuyesOZGNxSnpFVuOx/D8/qCBNOfdA+5IjAzwq8pilLvMRpwTIROZHxdiX0aXRpdWibNPBV3bby0jihI9vg66MBt+udxYOSHQS4KRozWevIfqb26uxS5muF5o92gU5LQIjeSS5x4lBD/toTCBjNmEnXiU6o+TSyhxHGSTIkSrDMx2sEk/polXoFTrIe0MIlKPLuACeGS4emLL2k9UU1oGR6rHTa2gWESASQ47INL81h8YnLw7tMEy93oSph3ZvbnzW7Na6rp1OjjHm8QyXJxeP2G1e57kTb0uEMMlRRXi9xFw3tUlY1Cto5jaoCB/AXVhZPtBh6zN6iS7lqfqx5O/2FwZQHb691xF8vM4F6bhoMWGo4KWG5/d2O8lKMlwJ+nH0WfaKs7V/0cEKPIaj4+C0uyOJHDtT5ESheb6OJSt+v3HSTWqhAQ4zcpbZriliK5Dmbb1dEmvjAtSAFX6eDZxPtf+12OXhOqUtDzxELJGadXRaDUOyNrpDcC2lDDBI9RVi+IVOdL09jsLYGTaD1hk605oTQrr1u0B39EBLu20C2lUhrOyJPkVi3xNkKG3t2TQXZsEQE8ega6jPy0LERL35r493RuhlTg39GklRk7kx+1VSu8dGYQydRodKvR15yJ6dH3xI+AXOScswOa81sbJPLIU8QX2o0AlX02rf94gg pdNPXFsG cF4YBmz74EDpauoQByVQEvFOa3lNvJ4yMtzdRqVTrrT2fLYuEocsfYFP3lmQCMrKLmn4taTxdUCa+gYBWm+fqi1BGLAZ9AWIXRPaWwjQn+wOJwGsNf8cV5say9BjAnNjuCr7PGWfHGMTGnTIhYyUnalmvAiV5ihE4XJ+hnubmjCibNVf8+f/XY45SD0oaACGOlF+538w4nUPHfepGYc6Z7D1z/zcqXw0Xif81Q4+NTsbd6XsbHVmorCSv6014oAtszmmfnw1zx24iWnZ43KO+aX5fZlQwv86o3SiXocrX1HJwrqIO/Srp3mK55AVy5f3/mreFb0fz9LTfVnSSVnHP1xHnxO3FIbwO1iYpQ3ci9Polv9I5s8CjLCTTVEiHvEWjkdMc2FU16Ac2i8uTYiyWKZaYM9jtGWnty4aLAuVPhIJG78ihC+G5cJBcQFq9MMcJc7BbkvyUXDzGjB1YZDsBCEluitN+rKqaMCvzDO3MT98alKLoBboC08NyxkFqJMEHOW+e1BCLHut+iNZpu58khTOFwj/ElyrYvFN88swR7CgkKqAh8uuUpyJ1RySGIUYaBjWkkFx9UUVXM+9ry3jYph+wyv/8UosSFr3fbNe5vcaXU4oodpANbvAuxNIJ96rXlaVt+1xikOISjb0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/hexagon/include/asm/pgalloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h index f0c47e6a7427..55988625e6fb 100644 --- a/arch/hexagon/include/asm/pgalloc.h +++ b/arch/hexagon/include/asm/pgalloc.h @@ -87,10 +87,10 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, max_kernel_seg = pmdindex; } -#define __pte_free_tlb(tlb, pte, addr) \ -do { \ - pgtable_pte_page_dtor((pte)); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + pagetable_pte_dtor((page_ptdesc(pte))); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif From patchwork Mon Jul 31 17:03: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: 13335286 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 29D79C001DE for ; Mon, 31 Jul 2023 17:10:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B898F280081; Mon, 31 Jul 2023 13:10:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B396528007A; Mon, 31 Jul 2023 13:10:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A0162280081; Mon, 31 Jul 2023 13:10:32 -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 912BB28007A for ; Mon, 31 Jul 2023 13:10:32 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5E730120B51 for ; Mon, 31 Jul 2023 17:10:32 +0000 (UTC) X-FDA: 81072545904.06.020D32A Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) by imf12.hostedemail.com (Postfix) with ESMTP id 3BC7A40005 for ; Mon, 31 Jul 2023 17:10:30 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="L/L7zvA1"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.160.43 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823430; a=rsa-sha256; cv=none; b=R6Bg0UaI9hwKLQ0phXj/b0aF77mPDRlBd00nGDbTnVYAwn/Q5dtB0RiaPt5l6h4RHiR5hW MGs8hg5i93H9Cg3IMy/noeFEHUBskuHDEoRX5AeZgvSwzIt7wfeVjc7O0E9SMUu/WgyZch yp/bevh9UkQwvgdXeb/NUL7PE4TWYsI= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="L/L7zvA1"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.160.43 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=1690823430; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pBiyp2dfMpzV+NvCt1JbKOh6Ic1GEYp83948mVxRzoc=; b=SAhmPkA/GpQ47QH28uSJ5R3865OUJLAREcdtnZSTz+OU+6lZ2DevMop3SlhzrnX62QOSVM awkd1njTDCnWzvfqYLPGav7qQre5LKLlVQoByJPvVGv0yc9ok3mO4ZCz5C0mg5hlZrWH2W tXAAZkT8xGS/+Aed3X/VLzAXJiSaEQU= Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-1ba5cda3530so3597696fac.3 for ; Mon, 31 Jul 2023 10:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823429; x=1691428229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pBiyp2dfMpzV+NvCt1JbKOh6Ic1GEYp83948mVxRzoc=; b=L/L7zvA11LcRdD1cN1MMKXDyF33EZjb+UtaPx6sqMQxbQxkvH2GrlKxyu1w2PvN7i5 1AezWCH3S9obCTgfc/F6j3DrCPczdpxt5KHtbYnPPF5gg1D7B1fRKe1214jKxrYBAQMY v7dxEEKg6bFi7TOnwOpj/crnBTGxG2kA3Sw1SWBk51+/u3CbxU90FdyToCTE/bxLYZ5I Lw4QMdrucKhLXZJ0nAS2+qCqWiOXTDBD+569jA3oTXBERdcem/hLewLCsahrTdspLBpV e7IEX3yQCzM7MhGxf/ODfw063S34i+rKfZt+uFhLOrEJV3b142JHE6Cl+lTtbGa6iBnW H7pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823429; x=1691428229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pBiyp2dfMpzV+NvCt1JbKOh6Ic1GEYp83948mVxRzoc=; b=lTIE8Lei3Md1G1aUM2UgcTob/71qs2s+dqcCV5yHU4jVYC9jGLnz0vB4yOAgRIdtYK zKlZW9z6yxbX9wZBmIYTX6fG2iYZkwL/vCnFnJyCnU6gG4ASH6xLkn/X9doG9yaQSxPN 32tDoLg8gbfoH9vJtyTXHfC5LwR7+L7l5wN5jYr8Fj3AEaTkEQchLXOPXhEnjQfDU+YH Vdb38SfDU9QBm1KOuB8X24zyavtHrMZ0Ieh/ND9kWfxYvdRcVtlgOwRRDyM6YOhawOgj V/oE/mbM7F4TsBTW9H3W0BwqriW+UUMe1yZTOBhYdJaWGforb+JKcZW5OIQDGXCCM4rI 1RkQ== X-Gm-Message-State: ABy/qLYcXPoB5PudFGD4vCkCpCHhteDQScZlSK7Y+cz8aBmZgJ+RIsgJ e+RP+QP/lJx8GU7KNXrOSHItBkPntcZjYw== X-Google-Smtp-Source: APBJJlFeS2ogl3m5ezZAcTbxwtfQRoXWWYsAvuudazx+JhR2l/mtz06faRF9RklP+vg5BWBteq8aEQ== X-Received: by 2002:a25:d18e:0:b0:d07:d88b:4843 with SMTP id i136-20020a25d18e000000b00d07d88b4843mr7628126ybg.20.1690823060256; Mon, 31 Jul 2023 10:04:20 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:20 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Huacai Chen , Mike Rapoport Subject: [PATCH mm-unstable v8 21/31] loongarch: Convert various functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:22 -0700 Message-Id: <20230731170332.69404-22-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3BC7A40005 X-Stat-Signature: j1nemm6ihyxm3npcks48aicwdjp8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xGt1jRPVQqGFMR/VKk/O5SxW8QJF1/+A5fZXpzGTIOWRrBLccBCfg2oapkvvvBvRAcLmtRBaUEaONe4cuFv1z0xmktFS7nZ1gke5YwJvkYylix5FjGXS+r69IFrgiZNWpGpmDBTPal/Wzx2I50Tt2YsG5I4PK+/E2sFqAjMAW+flRsADHbleALa/dKMBjwlsLYc8vdo2Zf395aubD6NuG7TZg//IVja7qx/Iazf67k4TzIqBQRSg5D9BXbdTomqJT2XLwK0gfGFNxv/bN10rSmoNvKqu/zjk8NPblLK2pSdy94gYsOPd7UiJECfsEXiC9hmVcWk9uOfsblgZcNo0KEI1O2beC+yUljc7PcuLQ2qCdtN/7nV8QQ3OasLybpQ5REI3yn2gzEfcbqNQ75lw0+S/2FqqRDuaSRIJfC/iMKNJwNflZcErHXNVhRyG/l9sgKuX9DL3Ru9bG5yZdsfM6NThWcTT8jHNaGp9f7fv4d5/8UUnT2yASngvwpiIZU+Lc4Vo9WxhfGb3XoVFCQfzsI3Arwwe0hM54DMO3f93LG7KED/iwQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/loongarch/include/asm/pgalloc.h | 27 +++++++++++++++------------ arch/loongarch/mm/pgtable.c | 7 ++++--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/arch/loongarch/include/asm/pgalloc.h b/arch/loongarch/include/asm/pgalloc.h index af1d1e4a6965..23f5b1107246 100644 --- a/arch/loongarch/include/asm/pgalloc.h +++ b/arch/loongarch/include/asm/pgalloc.h @@ -45,9 +45,9 @@ extern void pagetable_init(void); extern pgd_t *pgd_alloc(struct mm_struct *mm); #define __pte_free_tlb(tlb, pte, address) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) #ifndef __PAGETABLE_PMD_FOLDED @@ -55,18 +55,18 @@ do { \ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) { pmd_t *pmd; - struct page *pg; + struct ptdesc *ptdesc; - pg = alloc_page(GFP_KERNEL_ACCOUNT); - if (!pg) + ptdesc = pagetable_alloc(GFP_KERNEL_ACCOUNT, 0); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(pg)) { - __free_page(pg); + if (!pagetable_pmd_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - pmd = (pmd_t *)page_address(pg); + pmd = ptdesc_address(ptdesc); pmd_init(pmd); return pmd; } @@ -80,10 +80,13 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address) { pud_t *pud; + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0); - pud = (pud_t *) __get_free_page(GFP_KERNEL); - if (pud) - pud_init(pud); + if (!ptdesc) + return NULL; + pud = ptdesc_address(ptdesc); + + pud_init(pud); return pud; } diff --git a/arch/loongarch/mm/pgtable.c b/arch/loongarch/mm/pgtable.c index 36a6dc0148ae..5bd102b51f7c 100644 --- a/arch/loongarch/mm/pgtable.c +++ b/arch/loongarch/mm/pgtable.c @@ -11,10 +11,11 @@ pgd_t *pgd_alloc(struct mm_struct *mm) { - pgd_t *ret, *init; + pgd_t *init, *ret = NULL; + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0); - ret = (pgd_t *) __get_free_page(GFP_KERNEL); - if (ret) { + if (ptdesc) { + ret = (pgd_t *)ptdesc_address(ptdesc); init = pgd_offset(&init_mm, 0UL); pgd_init(ret); memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, From patchwork Mon Jul 31 17:03: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: 13335123 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 747FDC05052 for ; Mon, 31 Jul 2023 17:04:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 36FA0280074; Mon, 31 Jul 2023 13:04:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F8696B0185; Mon, 31 Jul 2023 13:04:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 198D4280074; Mon, 31 Jul 2023 13:04:27 -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 067706B0184 for ; Mon, 31 Jul 2023 13:04:27 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 93A8B402F0 for ; Mon, 31 Jul 2023 17:04:25 +0000 (UTC) X-FDA: 81072530490.22.9B87617 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by imf25.hostedemail.com (Postfix) with ESMTP id 5CCFAA000A for ; Mon, 31 Jul 2023 17:04:22 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=SHsXJcCp; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; 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=1690823063; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PAg5qbCpsu4QeXC2CiYcNVSx9jEaugPagVbNncebk84=; b=bAtPMRIqtsPsPo+3SsIXMGugkDL2ETx5u2L4pNwXY5VfRKh06CxmH6P7hh8PMfIinddScz 3qzlJ0iwZk1VC921dYfZaBgiIQGmBNEh7nrgiK9hURtKZcx0Ea8hxJGZEXCB/BSMlLv/UJ Mdk3j/XULZ60mLx+UtOCZZYRrFYbOTc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823063; a=rsa-sha256; cv=none; b=6aTjPzaV717irb5kIEP9bDoSRVlb1BDUHmOlYDyK6Z6DV5yVfl9ciH5lSpBxNU88ApWZ6a 6etdo5e03TlGy0tLe2as9A644lPAWZebv4Rs8knC7xCj0eBhy7jCQEpnO7NqZNqBWgmUTj ZXPBMRQAyuR8f+VrvQ34UyYdCZO/XC4= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=SHsXJcCp; spf=pass (imf25.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-d18566dc0c1so5048015276.0 for ; Mon, 31 Jul 2023 10:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823062; x=1691427862; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PAg5qbCpsu4QeXC2CiYcNVSx9jEaugPagVbNncebk84=; b=SHsXJcCphZA5Q35Cm4n8w8dfqoRXj5UgYy95JNrPo0e5bckV50c6jH6lc7xhgkpfP3 LRpLcUVAnaJQDC2fy0cxRx/Sn5zDPk8HnSNMQ1nYTCeGYSjmp0NxEGU8+6AK0ydnCrXo B7huJXPBvLhjK9+NPSK/tK4mNxy6xmRWTGSAELwAb2C+WQkmM4czVeiClgF6xCu0dSVp valgcEUnr6tm5e6DmJ0wAnOlYJfOWUIH/75eKq+AUDCd7EFCR4LkmTx5JiojrlAh0iKl eJnCwnRGsblWEjcAQ70JqqSW1FXw0LcJDzZAr4AakE8Utv/Am0i5qwYjY31XRJqcgYKL 0oHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823062; x=1691427862; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PAg5qbCpsu4QeXC2CiYcNVSx9jEaugPagVbNncebk84=; b=AZKyY3+uBYlcqkH76ZYzy2OSogEKvT2TGi8wl0lC3KB7+QUhjCU9lUzJsZaB1JXAQj VhsQXrFd4cqRh9Ccv8gEEgtyg7ZZfCitj5cmr8ocRV5kHlrNA9ILUk+sOZGWaqNFlxCI GDHoms5qkWomFgTTxoXlffI6Sdy5QeMUp80aXDyIm2NpBj7CFFZqbkmLOgvx4qyBOOpu aW8aGtWtkSkafb/8gf1pxLTTMFJ/gnJDQ+vx2m2VvSQDo9JV9KepLB/lvLuzDwhkp1O1 B6KbDCRNVeLqCCKN0iyC7ekCXhHZp4wleeztWQl8U7xJXdRJwD2CLJEQLyPNcMvD1fKG t1Rg== X-Gm-Message-State: ABy/qLbKNGVY+kUCOWpNDF+F/CYX2f9QH0lw1FK81kwbSE6sN9gqmxzD ubsdWX9DXn8gnfjjEkBIzQE= X-Google-Smtp-Source: APBJJlEK1MlTqpIOoxn7Ar4pWAsbFPg2CXwhdETyczjwWIQSRY3cc8fD4iPGtAg+uKqG+zuVrd170A== X-Received: by 2002:a25:ad4f:0:b0:d13:80a0:b428 with SMTP id l15-20020a25ad4f000000b00d1380a0b428mr10830361ybe.3.1690823062269; Mon, 31 Jul 2023 10:04:22 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:22 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport , Geert Uytterhoeven Subject: [PATCH mm-unstable v8 22/31] m68k: Convert various functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:23 -0700 Message-Id: <20230731170332.69404-23-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Stat-Signature: ubfrm4fga6cmxwcarsa76nngbgsp47zg X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 5CCFAA000A X-Rspam-User: X-HE-Tag: 1690823062-202087 X-HE-Meta: U2FsdGVkX19zil5w7NYOMV/rhBG6h0620ruH1jMQxBfSbJaWWNpGlpRaMfK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Ks1BnuHJO7a/KJhnAEb9VzGdjztnNbm+pZmSZsKMPgwyhP0mD6qya25rer8QNkWPt1/fKKtC/wp2XKLDNj1ACDpUdVIaoRfmru6E3pidNn6xbAy5Vhh3LtsL2//qknMv5VwRi0Lupnl+TrhD/HRz6ynhHNkkB558igN4LVsZjZPHtghPzSFv4PnFqVCTqzQb6Mzy2QJW7tsBfMm5JK9iwMDyiZSMdVTyqcpkbhJ0HUv4fmVWH4k8pS8sNwrwSzc37SKguq6ny2EzeXaG9bbQtmsEoHwF01PawHL3Tnvjmoxcn0to0lrkS31v2kMlmZv1HJG2bcLx9nOMWTpgw3HDIesph5baJ8KGPZilw8xohaL8G/BzjNmHuD/kueZa7u1enY5jfo0EWMbaynBsnRXi1pc39pssj2Yr6NDuXwfpc/eSh62vrYQBmUbKpR8nFUNI1XF3D5a+AHrQ7lHQYNnIgE+N+OjN58mgoAbL/QxCn/c3ah7WLQDrnEpuInVRVUCWE0wE/vdrBdW3Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) Acked-by: Geert Uytterhoeven --- arch/m68k/include/asm/mcf_pgalloc.h | 47 ++++++++++++++-------------- arch/m68k/include/asm/sun3_pgalloc.h | 8 ++--- arch/m68k/mm/motorola.c | 4 +-- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h index 5c2c0a864524..302c5bf67179 100644 --- a/arch/m68k/include/asm/mcf_pgalloc.h +++ b/arch/m68k/include/asm/mcf_pgalloc.h @@ -5,22 +5,22 @@ #include #include -extern inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) +static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) { - free_page((unsigned long) pte); + pagetable_free(virt_to_ptdesc(pte)); } extern const char bad_pmd_string[]; -extern inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) +static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) { - unsigned long page = __get_free_page(GFP_DMA); + struct ptdesc *ptdesc = pagetable_alloc((GFP_DMA | __GFP_ZERO) & + ~__GFP_HIGHMEM, 0); - if (!page) + if (!ptdesc) return NULL; - memset((void *)page, 0, PAGE_SIZE); - return (pte_t *) (page); + return ptdesc_address(ptdesc); } extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) @@ -35,36 +35,34 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable, unsigned long address) { - struct page *page = virt_to_page(pgtable); + struct ptdesc *ptdesc = virt_to_ptdesc(pgtable); - pgtable_pte_page_dtor(page); - __free_page(page); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } static inline pgtable_t pte_alloc_one(struct mm_struct *mm) { - struct page *page = alloc_pages(GFP_DMA, 0); + struct ptdesc *ptdesc = pagetable_alloc(GFP_DMA | __GFP_ZERO, 0); pte_t *pte; - if (!page) + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - pte = page_address(page); - clear_page(pte); - + pte = ptdesc_address(ptdesc); return pte; } static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable) { - struct page *page = virt_to_page(pgtable); + struct ptdesc *ptdesc = virt_to_ptdesc(pgtable); - pgtable_pte_page_dtor(page); - __free_page(page); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } /* @@ -75,16 +73,19 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable) static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { - free_page((unsigned long) pgd); + pagetable_free(virt_to_ptdesc(pgd)); } static inline pgd_t *pgd_alloc(struct mm_struct *mm) { pgd_t *new_pgd; + struct ptdesc *ptdesc = pagetable_alloc((GFP_DMA | __GFP_NOWARN) & + ~__GFP_HIGHMEM, 0); - new_pgd = (pgd_t *)__get_free_page(GFP_DMA | __GFP_NOWARN); - if (!new_pgd) + if (!ptdesc) return NULL; + new_pgd = ptdesc_address(ptdesc); + memcpy(new_pgd, swapper_pg_dir, PTRS_PER_PGD * sizeof(pgd_t)); memset(new_pgd, 0, PAGE_OFFSET >> PGDIR_SHIFT); return new_pgd; diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h index 198036aff519..ff48573db2c0 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h @@ -17,10 +17,10 @@ extern const char bad_pmd_string[]; -#define __pte_free_tlb(tlb,pte,addr) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index c75984e2d86b..594575a0780c 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c @@ -161,7 +161,7 @@ void *get_pointer_table(int type) * m68k doesn't have SPLIT_PTE_PTLOCKS for not having * SMP. */ - pgtable_pte_page_ctor(virt_to_page(page)); + pagetable_pte_ctor(virt_to_ptdesc(page)); } mmu_page_ctor(page); @@ -201,7 +201,7 @@ int free_pointer_table(void *table, int type) list_del(dp); mmu_page_dtor((void *)page); if (type == TABLE_PTE) - pgtable_pte_page_dtor(virt_to_page((void *)page)); + pagetable_pte_dtor(virt_to_ptdesc((void *)page)); free_page (page); return 1; } else if (ptable_list[type].next != dp) { From patchwork Mon Jul 31 17:03: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: 13335124 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 ED1E3C001DC for ; Mon, 31 Jul 2023 17:04:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C6F8D280075; Mon, 31 Jul 2023 13:04:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF8E66B0185; Mon, 31 Jul 2023 13:04:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A98E66B0186; Mon, 31 Jul 2023 13:04: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 9A4B36B0184 for ; Mon, 31 Jul 2023 13:04:27 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 74E66140B41 for ; Mon, 31 Jul 2023 17:04:27 +0000 (UTC) X-FDA: 81072530574.16.69714EE Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) by imf29.hostedemail.com (Postfix) with ESMTP id 780BA120035 for ; Mon, 31 Jul 2023 17:04:25 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UQMFQ0r4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.166.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823065; a=rsa-sha256; cv=none; b=GWhaWooQZx5MQ1oI9M0m+l5tTLZ9h2JkVh5Bo9mIipVgc6ip23xV8MNMgjFJUGRosvMG1t 8ApzjAamIrOWgPJP2dYVXg9WPxUDLhAExBw+diZVtji5fLerRfqq2gVVWh7LK0C3j+NZRZ pT5pv3tARgEZmqyf6cL3DpIExHi/4jk= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=UQMFQ0r4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.166.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823065; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Z2eVDlXL8alglJUGVXcc8JA7ix0brgT+4DYqdXjkOuM=; b=fZVIo706hHxiG7x0dGuGAhme+0+6kQ3ex+yZY/kVVILDxeig/UBSkQtgcdxO+C2DK8cHuq pWH/pivxwJC4qJ4yyDKBY/QanQwYGUR/WrkMMrIZJJnE+r0HGK+F0FGWinx3shFINepN/g t7UyKnws0MOctgX2o1uCeZ/I7LsnNi4= Received: by mail-il1-f179.google.com with SMTP id e9e14a558f8ab-3491516c4aeso4951565ab.1 for ; Mon, 31 Jul 2023 10:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823064; x=1691427864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z2eVDlXL8alglJUGVXcc8JA7ix0brgT+4DYqdXjkOuM=; b=UQMFQ0r4Q5WPDgBqHxt98e/7rMdzo/EpmwOe+r7kVkn3hiopHSDbWlcbl5oUHK5iIf MEr4ea890R+sJP/eAUogbkn4iWG+9UMyn5afkOFV0PrV0pq/LpKVZxDpJGv509y94xGw hLI4HOjNYVUd1nDexzxomwE2YqUnNF1NoyuArVYtjoOeqdYPeQHR5JxR2RSbP4U9P+Tn EAeRXMlzA2BnCRlADTS23mT/QfJ1wsL2dS3bX8pvVfdD0qkUAvCOMkcifg576YKQRwd3 ZfJGkC7UmIJC4v8PHFpL2Jz1mt7kK3WgxCHNDNZXpdMKgiKnSf1XJCiXOu4fHHWiZceQ 1gJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823064; x=1691427864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z2eVDlXL8alglJUGVXcc8JA7ix0brgT+4DYqdXjkOuM=; b=XC3VzVBJOH9u8jhWgR62oJyynyYX2c09aMaZ/gauQmaDf0V8yckfaGIA/rR4KHocmp ECEyCyWCCn6ZsoT5n7nGgT1gMUujV18qY7rlGvIDazTJiiDuXYAqHh5GLGXyCI6CCHex PY4ettckzcBUsgsjXChueFMSlDlSt75OqNo9AcLg9c4cC4Frj0Mxw8GJvkVdEFrkDg/U fwhQs1XNRnTDK2okIc17LV2yMQ9xi4rxSW7EygCKP/v3IrF4t3RYEiapcIcv69KWtEvN RgMDWTZju/H0Syxp0uVWSPVKxx2VQvEhnoE3GDC+4UbTjk5vkndLI7lJ7uzMO76lCgGl +faw== X-Gm-Message-State: ABy/qLauOF7gv32f3h3PvRn+jqyGn4bpXoRYhO0yNtOxGYJmgIjMY9Y0 1i607meyc/vv4eVSgZ45B4o= X-Google-Smtp-Source: APBJJlEWWd7SGavQpR/ZisDPXe2n2lSwd0LXy0L6znKYOT3kkqP+7NMXZkXm3S5oeNu3Zj7rrKqKrw== X-Received: by 2002:a05:6e02:170d:b0:346:24c2:4f87 with SMTP id u13-20020a056e02170d00b0034624c24f87mr10569413ill.32.1690823064428; Mon, 31 Jul 2023 10:04:24 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:24 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Thomas Bogendoerfer , Mike Rapoport Subject: [PATCH mm-unstable v8 23/31] mips: Convert various functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:24 -0700 Message-Id: <20230731170332.69404-24-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 780BA120035 X-Stat-Signature: of5r4i7h1yuzoxxx3d6nfj55xkjc4quw X-HE-Tag: 1690823065-455219 X-HE-Meta: U2FsdGVkX18TD+sas5tN9BH252LDIoFhqhkTHEyFyVy2Enx0qt+RRG3x164XreQnk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z5DDm7GzdsMZKHoWza/8OmRpS/EN3uPh4Xd2agFgp+AsGZH2PKYFzHr/YZFEkIDaK8MEzDPUljuTk9/qPYkYKYhn3HkiWFau1V2GlbyjwmMEuQd8oPm6PQjZy3ecc4bhjP+DEMKZhF8IfgeiNct0JNottpg1YwUddHmPLuChEkJVj+yn3hit+0l1r6k4mpLap4z+EL6cH45g2wK0EHXh9PqkRhBKCSjXsC3jjVcT0V5gqSxTNxxCxqzyNmJn7EIox/WGwLYxAqrrrft0Ye9FBH+6qBHUK7I0plDD+1z1+4oX+Uex9sLEfAYt3mPMuUQL42DkZVfZ/AW6ydRuANsqh5iQ5xJGhBJvBl1xt9f0qMe8/YOHxBvMpEftHcdo4xkCre8pYzHfKA3Xnp2oc+2gmvIQKRlZ/YyJ3mafpHkamWeuIriP22K98d1BDrL5LhXkxoaqQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/mips/include/asm/pgalloc.h | 32 ++++++++++++++++++-------------- arch/mips/mm/pgtable.c | 8 +++++--- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h index f72e737dda21..40e40a7eb94a 100644 --- a/arch/mips/include/asm/pgalloc.h +++ b/arch/mips/include/asm/pgalloc.h @@ -51,13 +51,13 @@ extern pgd_t *pgd_alloc(struct mm_struct *mm); static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { - free_pages((unsigned long)pgd, PGD_TABLE_ORDER); + pagetable_free(virt_to_ptdesc(pgd)); } -#define __pte_free_tlb(tlb,pte,address) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, address) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) #ifndef __PAGETABLE_PMD_FOLDED @@ -65,18 +65,18 @@ do { \ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) { pmd_t *pmd; - struct page *pg; + struct ptdesc *ptdesc; - pg = alloc_pages(GFP_KERNEL_ACCOUNT, PMD_TABLE_ORDER); - if (!pg) + ptdesc = pagetable_alloc(GFP_KERNEL_ACCOUNT, PMD_TABLE_ORDER); + if (!ptdesc) return NULL; - if (!pgtable_pmd_page_ctor(pg)) { - __free_pages(pg, PMD_TABLE_ORDER); + if (!pagetable_pmd_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - pmd = (pmd_t *)page_address(pg); + pmd = ptdesc_address(ptdesc); pmd_init(pmd); return pmd; } @@ -90,10 +90,14 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address) { pud_t *pud; + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, + PUD_TABLE_ORDER); - pud = (pud_t *) __get_free_pages(GFP_KERNEL, PUD_TABLE_ORDER); - if (pud) - pud_init(pud); + if (!ptdesc) + return NULL; + pud = ptdesc_address(ptdesc); + + pud_init(pud); return pud; } diff --git a/arch/mips/mm/pgtable.c b/arch/mips/mm/pgtable.c index b13314be5d0e..1506e458040d 100644 --- a/arch/mips/mm/pgtable.c +++ b/arch/mips/mm/pgtable.c @@ -10,10 +10,12 @@ pgd_t *pgd_alloc(struct mm_struct *mm) { - pgd_t *ret, *init; + pgd_t *init, *ret = NULL; + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, + PGD_TABLE_ORDER); - ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_TABLE_ORDER); - if (ret) { + if (ptdesc) { + ret = ptdesc_address(ptdesc); init = pgd_offset(&init_mm, 0UL); pgd_init(ret); memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, From patchwork Mon Jul 31 17:03: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: 13335125 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 45B07C001DE for ; Mon, 31 Jul 2023 17:04:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A75FF280076; Mon, 31 Jul 2023 13:04:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A24366B0186; Mon, 31 Jul 2023 13:04:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EB7F280076; Mon, 31 Jul 2023 13:04:30 -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 7E24B6B0185 for ; Mon, 31 Jul 2023 13:04:30 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 407A0A0AA0 for ; Mon, 31 Jul 2023 17:04:30 +0000 (UTC) X-FDA: 81072530700.01.AA7E6CF Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf16.hostedemail.com (Postfix) with ESMTP id 7AB6918002B for ; Mon, 31 Jul 2023 17:04:27 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=f6adceAK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823067; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=DOzSOLTncjJXn0AvJQqE6PD7zrtBe8MIuyz5zw7TzDY=; b=vaVAXP6t9lUOwQBLUG/JQz69iA2mAFe60sHZ7MFCF5r/deoaOC0X3BLTap+zyj1yUJ5HWE 2sG69ukTiEzVgFLzGrcyMEi1alGPstfUXVOCI494mJ4NcOEU7GlezNykqJGaURIB3y2npy WKXw4PDH2UqbI8zhKWUWsQsWYTuKaY0= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=f6adceAK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823067; a=rsa-sha256; cv=none; b=lM+t7ysywQ8z08bYDj4mswdbnsEbB62IgeYItSZaCtbhe+s7zBD2Jb67YARE9zq16L5Fev LOVDUtojk3kyS75PP1pH/gH4SUUJYHSM6htBT+J7istTipKOpKgb4Nk6GYHA2pv6sN8Axu hWigQB/hqdOT5BmoW6X/EnsW6+P/6XQ= Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-bff89873d34so3787493276.2 for ; Mon, 31 Jul 2023 10:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823066; x=1691427866; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DOzSOLTncjJXn0AvJQqE6PD7zrtBe8MIuyz5zw7TzDY=; b=f6adceAKsPvui0l7VSUiRnWj+VnC8V29gRyKPW/KXba4L11duKnXDkkl9h+DOUEe82 /+uFEmkPUA7pfwVfanOSjRVPX3wfPLVY3FZPvGi3VyyqlsToEnHzzIylic2yHwlsDcH3 W3JP9R5mJExPbkEH69AGyH0gizw4AowCqMoujs5LGqqMzZnJK/dPFOzk0elvmdxwimx1 zHO/RBskNqXdsMC9zN3IXGN1/Qatnc3KRzwrgmn/b1CAPxkc6smcQgcPCS+F4TUkpdDt 7sG/wG+FEbTCZLXxJ46EURhFx988hfZQfl6N1HhCumdsXb4Bqj21mhmFktRwf8yfQcyF sVPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823066; x=1691427866; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DOzSOLTncjJXn0AvJQqE6PD7zrtBe8MIuyz5zw7TzDY=; b=KNmbrsxEhzmBIUk95/tUxdY799mdldafCGQi7uMEdUF6B3Swbj+mXfAVrrDKPzcTgv 0+SUUAcEuJ/S77Q2KWs1sjesUNTquQStRLxLs4BnTbYTIhO3+nIZInNBsSMKeumfPMDR OC3BqKkC7KpOKNt8Y7b3X9Q18icjAKZeOVNAgvR9+WR6sSewv0URBxhOu7JQjR8X8aQT tWncNsHHFpq/sCP2Tj2SSprZ0EPIPq4YX9FnE3FWn+9f4EHRBXhOACUm01uJfLB2F+0h kVA3oUl/kifYxsv67X9CKnko2WltNwenMDc4eJu8is2/Q0KYGtVw988ImZHaytZV0C+d Jgpw== X-Gm-Message-State: ABy/qLYUUMrm+YyxvYixa6BlFs8lenKDCefK32IyG4Sf4lvCac1sGmO1 yQYEiU7K6gO2NpgAFWc54Mc= X-Google-Smtp-Source: APBJJlE4T05ogdyrjIbBXTs0RpkDVTPnYG3Ig2UA6lH+KuSSQ9n98n0kBdmmWfFoFgc9s9NgVox+UA== X-Received: by 2002:a25:ada4:0:b0:d0a:8973:b1c with SMTP id z36-20020a25ada4000000b00d0a89730b1cmr247583ybi.12.1690823066447; Mon, 31 Jul 2023 10:04:26 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:26 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport , Dinh Nguyen Subject: [PATCH mm-unstable v8 24/31] nios2: Convert __pte_free_tlb() to use ptdescs Date: Mon, 31 Jul 2023 10:03:25 -0700 Message-Id: <20230731170332.69404-25-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7AB6918002B X-Stat-Signature: m358659uo5wrhpbfy35xoju88zjgip99 X-HE-Tag: 1690823067-399167 X-HE-Meta: U2FsdGVkX18wAwyeCL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ms/wcU5DtLhR0LqWpVxrGa2NevPvyUdBpcZZhDCcqwse/yR+dxhDosJPkwntpz9gkKLRrUgK+6VtLWJ3jx0qLIGvMxxgkBCKFNOOsU+i0043Ffdh20PqjdPautscMqF3vpj2jnoKfTKeZhS4iID0kvqr7jR97nwtCRbpZzpnYmLAuUP8gDvSkDMRjb1sbRa3xvFOwT0NBUKC0UKQPqSgvRpdHzhxZIEP2GoytlegMwT8viJ0VoTIivXU8HiHmkp6GtPdTM4cLSYCb7RU4GqXeEBrdAUBlH4p1wx4ZfIz1CFGhzdO6wvrXS/qEsa11g0DrJd5QAA0L3USFa1SqcoPc0SdCTrMPgV/2N9kWF3EUB/8HC6rdISTwBfpycqhSHpzpg5bS7q3HSCD4i1bOf/xRcHn1j8nZoYuvlixorMInkLP4d0uBrANKMqDYiuplAIFyGs03W9mC7VnxXZXdWBCWNIRVP5HfNlfYpMWtY70zXv38ZEWlBVQVIAV7A2S5+lNkCm+9bK8XTnQNoufrFYBh6YXFknNR64= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) Acked-by: Dinh Nguyen --- arch/nios2/include/asm/pgalloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h index ecd1657bb2ce..ce6bb8e74271 100644 --- a/arch/nios2/include/asm/pgalloc.h +++ b/arch/nios2/include/asm/pgalloc.h @@ -28,10 +28,10 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, extern pgd_t *pgd_alloc(struct mm_struct *mm); -#define __pte_free_tlb(tlb, pte, addr) \ - do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ + do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif /* _ASM_NIOS2_PGALLOC_H */ From patchwork Mon Jul 31 17:03: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: 13335126 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 4BAF5C04A94 for ; Mon, 31 Jul 2023 17:04:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 593EB280077; Mon, 31 Jul 2023 13:04:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F4B96B0187; Mon, 31 Jul 2023 13:04:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39505280077; Mon, 31 Jul 2023 13:04:32 -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 28EAA6B0186 for ; Mon, 31 Jul 2023 13:04:32 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EDCFA120291 for ; Mon, 31 Jul 2023 17:04:31 +0000 (UTC) X-FDA: 81072530742.11.9D86CA0 Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) by imf24.hostedemail.com (Postfix) with ESMTP id 796A1180016 for ; Mon, 31 Jul 2023 17:04:29 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=NCurFfzE; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823069; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0AnRv7d38hHUVaoAGins0CaWMMRgzo0GwUb20Y9YoSw=; b=qfLRpeZv4S4EvpdTizLualbyMlsP7SGmS+p0D/HMHXqoLgetITu0hZhk9DtFLqfjwxilNX XYk5xcuEKGHrlGrpi25RanXxxBDdowMIxBvI8OUAX91M35Z3+0DZQFat30WSGu6Ud5qQk8 ecxElZQiHoCc9xHHuqjjoAR3EfKuLAw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823069; a=rsa-sha256; cv=none; b=QofWMrBVjdoqxozJrxlWu8YD3CGP/Hd1yAkyufGYbtn3Da4zj1T45v0VD4/K78gpRtVR2h e4crL8upjTZcZ7K4HFo4aWRTOUobkX8B6lrFKqhVasizNmE4OfDpPuSU7ANYT8ONhyLcWR fzwPuZ3mVW8CvPxFvDwhFxuT9tDswak= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=NCurFfzE; spf=pass (imf24.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-bcb6dbc477eso3787472276.1 for ; Mon, 31 Jul 2023 10:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823068; x=1691427868; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0AnRv7d38hHUVaoAGins0CaWMMRgzo0GwUb20Y9YoSw=; b=NCurFfzESiDx9LJv2ZuGZQRVSVONypfRSwp3UCPEimaJ0icLYx3MO5YhqaCkZBIR4Z l/oM16YnfTb6kc+h35gY+zFIGDLtxKkoqGrDMVFkoTTTXsh+xxxFI4aLUNlB4KO70CwF WRXyA1UJf7HH1gQrjYriX6iIExSZBg+JSpTH9iwwtWaRApzq4XeZb8/+i18fB7X+SbC5 QNboB3mts09Ey/BGMzFFSqcMjH751GJumhdsMsGsSdMw+HfAwMqxwq/99BYNjLDy4Uwv T3I5GqlbCblT84V09f9Mmwx3a1PPDI4Kl+kA59SDykK80t9C+rJKaVJTL/sIPY4ok+Qa Stkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823068; x=1691427868; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0AnRv7d38hHUVaoAGins0CaWMMRgzo0GwUb20Y9YoSw=; b=aj3AoxvPsl95Udy2uz6EUFYGG2l66iXYBIwd+Q/hKMJ8u1B3nWC20typg/4dEy1A8q VQ/Lt28crzPbs1wUHXGE8QRC2LPtUjbI3i0+osEvEAR7bddPHrN27xunEYD0kJLufU+N yPySla6jC1E5Fq5z5Fdc8u3b1dlI+zPn8F4hDjbT3jgGSnx01LRcs/lyh5MY552BKr2z jUY0CmpOJ5IQ3EOu8UlK/TxJ4oVtB/xdhgsVwS9QRHfFkPIqPIno4f56y4nFiznP3nih 0pR+dS0MbXVnHweieohxse7O1Nmhn2Z25aN93PenuAidFc+2CwT5I3tBoqiizQOFp2vp myew== X-Gm-Message-State: ABy/qLZVQt6JsK7dhzAg2+UuQcb0QJZABaKN7JK/wcBDJS2Bzg9AMYoP HGiK+EuOgXXEO4nqZNwO7ZA= X-Google-Smtp-Source: APBJJlH2OMZz7Ho/ZKKTbee+QNJ7Mj2bTW6BCb3XUatLH/MvStrEwd2dCkY4APrPVNcSGvWAfXuhUw== X-Received: by 2002:a25:acd2:0:b0:c6d:f875:520e with SMTP id x18-20020a25acd2000000b00c6df875520emr7715849ybd.49.1690823068568; Mon, 31 Jul 2023 10:04:28 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:28 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Jonas Bonn , Mike Rapoport Subject: [PATCH mm-unstable v8 25/31] openrisc: Convert __pte_free_tlb() to use ptdescs Date: Mon, 31 Jul 2023 10:03:26 -0700 Message-Id: <20230731170332.69404-26-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 796A1180016 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 8b7qyd6sswduxdxwod9y6a86fqsxfjy3 X-HE-Tag: 1690823069-87739 X-HE-Meta: U2FsdGVkX18uzfddOSR4fykus4UmW+NSXldE3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dWZj2t2o6IuvsMkZRKDO9edZfxhB0FrcSKiWlO10C4G0Z9xDlxUZl6pRCu/PIYj6rToaRWLVJZwnx2FrWxVjrFIAaP9ZnA2n83C0UGTr0pC5F0/1MUEq4LEvTwhcenZiB4Y1cAhG9vI0iuWWVMI6MjtT5ci8NfXNZPEufPuM4sbB1xX/XSyqI08K9RHqnwKSThj4o9Ps00g6/AYoKZp/ua5f69Lc9NDRyUtYhAgYH8syRJShQP2O6SSd5usRM7eHWbdav8HMtiXKMUkuXNfIdG9I8oLJgmuD06WEKEXURAUBMFK9ZaJRszCeAZWC8UQCIEKYzVFmuj49WM5DcjYEab/vJr/nW9Vg4dv5p9fRY/nVS4AAfL5P4wp0D+59yyswZ5G0MQwubVIXTLzw3ogzfkTjqZxyZgZOlNmISd0a3J4EkmX6/Y37XcO4zKcrpfUqMACPhMjzxM9jEQQIjY0TVi70mvo72yUJYU2YVNOI3xl9ale4DawFxtljulZys6Aqqgo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/openrisc/include/asm/pgalloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/openrisc/include/asm/pgalloc.h b/arch/openrisc/include/asm/pgalloc.h index b7b2b8d16fad..c6a73772a546 100644 --- a/arch/openrisc/include/asm/pgalloc.h +++ b/arch/openrisc/include/asm/pgalloc.h @@ -66,10 +66,10 @@ extern inline pgd_t *pgd_alloc(struct mm_struct *mm) extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm); -#define __pte_free_tlb(tlb, pte, addr) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif From patchwork Mon Jul 31 17:03: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: 13335127 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 4FB5AC05051 for ; Mon, 31 Jul 2023 17:04:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A74BC280078; Mon, 31 Jul 2023 13:04:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A4B846B0188; Mon, 31 Jul 2023 13:04:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87685280078; Mon, 31 Jul 2023 13:04:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 75D1E6B0187 for ; Mon, 31 Jul 2023 13:04:34 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3F4F4C01AD for ; Mon, 31 Jul 2023 17:04:34 +0000 (UTC) X-FDA: 81072530868.04.7B8732E Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) by imf19.hostedemail.com (Postfix) with ESMTP id EE8E11A0020 for ; Mon, 31 Jul 2023 17:04:31 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=jDHhLXZJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823072; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3wtNkjiFE1rjq7ZRDFNmpMqdu/3EA/QyC8BNR6xlaRk=; b=A9/nQcdvnOLGAIU8JqR+5UGyXnG1LLFxR6dL/nGJS8FHdn0CkxqO8YzVMDjGtegvNpsT0P HOSDJRbVzHNUZZK6RxkWLcXTV4CmOyW23WI9ImPtnLQtZ42CUSSx/LrvNm/YZKtLUdJoB3 W3xzsShM5i4ls/uNJcqaCSfZRS1iHzY= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=jDHhLXZJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823072; a=rsa-sha256; cv=none; b=c89NVECQUQtwwHRL+fgJVTZOuGRZb2s8UjMj2+lf8fWebUT0WQfQcfHWJoeduYQxrYa8am 893T1G/su+dUTS0z57kEEIplhklCEDIVAH+6xNyFDeI5zLXjlBPdn1DleWvUSdOn9YuAS+ BlP905vmV+YSYAOpaWV5hEYuoCbndpc= Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3a38953c928so3582888b6e.1 for ; Mon, 31 Jul 2023 10:04:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823070; x=1691427870; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3wtNkjiFE1rjq7ZRDFNmpMqdu/3EA/QyC8BNR6xlaRk=; b=jDHhLXZJRXD/xeYPjUKANAGx7mWI4rG2vR3tiNn5nmibHzSYtMioLibanq9BMakzzx Dc40uVduQvHfbEsvbNTufmD3fXRl+TcWbOzDp0kgO7QuCTykCE1j+HK6n3jb1sqe57XF 7xsPytJhE4yGGkRfFmDQz1HzLuGW2ZTo/1EAyxe33p/FghCyp57Hsm7Uzya8S5xLQJaT ueIYolohxESLEyhmxK2PHze+l/eyVpSLM0kum/QRULVrKh/GfSQvLlze6Gzlo9GlB5fo iazuqOSyOZnJfKQ3WX+zpbxyRMiNA23MCvyV70vvY+gHhKrbl8nHkjOrciNugWyCFGqp 7t9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823070; x=1691427870; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3wtNkjiFE1rjq7ZRDFNmpMqdu/3EA/QyC8BNR6xlaRk=; b=OcYb9BYM0PH391Q2LHgDoe57MxxENqixk1QjVfY8qyrjZCkN3hE8GlHgcqXWQkt/7N cWX5xjDl9PnW2xNRAG5viFTxZo1boZDcxbn/fEs6qOUrM4wV/p7ETYSkRbj3TbqHyuDC k7/ba+/qJ0a96HEH+7SC8zfD8FPasmV85XRWqI5RTc4DYr9O6mswlUe7MigqxIPpgm2R QLm3ML7m2no/HB/z6u0dIr78vhIQ3n2RgV+xFqzPg297y7ujI0R+33r5/RGuR+xIRwoU ITyeKDSAFsHEwhx1pmxPk3yxCV+rBC/h565CmsLfE79+pBygvpB6gwUJ2Es3ijiNEKOx 6MkQ== X-Gm-Message-State: ABy/qLa+Erufrm+AhGtdAwMKKNE4uMAVjoo8p2+dPbas4sNLg2uForH8 9Ftg8b8IpJl8P92RikeEYdo= X-Google-Smtp-Source: APBJJlGObInRwlJ0AwNAJnouNbrDrDtHWtXxAKPp84WJFWn9NE838Pa2gI3Dgeu+TYrNO6dbsPWj8A== X-Received: by 2002:aca:2b03:0:b0:3a7:1443:f4e4 with SMTP id i3-20020aca2b03000000b003a71443f4e4mr5616696oik.44.1690823070647; Mon, 31 Jul 2023 10:04:30 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:30 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Paul Walmsley , Palmer Dabbelt , Mike Rapoport Subject: [PATCH mm-unstable v8 26/31] riscv: Convert alloc_{pmd, pte}_late() to use ptdescs Date: Mon, 31 Jul 2023 10:03:27 -0700 Message-Id: <20230731170332.69404-27-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: EE8E11A0020 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: tcudekebjpgdn6xx65a4mfpqddapazh6 X-HE-Tag: 1690823071-830332 X-HE-Meta: U2FsdGVkX1+K6qlT2z2t5isjaUzjgbOAe7wF1/krEZWxxYcvYIfqKGVj1ZnP4Gq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y3d589ct27cx+YbYwJ0bAZ2qZLrYFlTKDtnl8qeim+WCm/cj6JzZrscP2cMX+Zo0WSmOoBjxNzFcRnMbe9lVVOcAoppK6FSIWojP5NN5eRAIoGhZq3nm/btJo2p0e2oxvtTRDokROqgOU1LVzgRAD7JAvdDldA7Al5QhiCHwRb5yrGLNuKorGk6Y0GLWj+oYOOcyG+r3cdmv/HhNqoWD8S1+7qqrGg6PaRoqcbhpIScb+QY65a+AevnTNSbCP8wV9ozSKx+8GrxcQbl5MZYQjleZuFdFgXvs+fxygXCxv5qCrBwb+g5/4XeD4anAqu/KSE52xbmu2Ea+syApEYvZcyNtPPGRwvjKqykLfo1+1JGBMsg/ihU6sL8aDbtTGk0xFZFEiaOUQbQfcMLpEBt+KyBnBHBRh7CQGipIe0qY7WsZ1y4WriawWszPlNLLBS6a4qv86L7UrzFX/3po3LlSog1YGxbEjoKQ5aJSdpqSaOZ195xQgiV2EGo1dPwIkefUe5nvEsIwnMaLQonN4y3Z9HrhA52cYw8uJ9MTzYhqr X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Some of the functions use the *get*page*() helper functions. Convert these to use pagetable_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) Acked-by: Palmer Dabbelt Acked-by: Mike Rapoport (IBM) --- arch/riscv/include/asm/pgalloc.h | 8 ++++---- arch/riscv/mm/init.c | 16 ++++++---------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h index 59dc12b5b7e8..d169a4f41a2e 100644 --- a/arch/riscv/include/asm/pgalloc.h +++ b/arch/riscv/include/asm/pgalloc.h @@ -153,10 +153,10 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) #endif /* __PAGETABLE_PMD_FOLDED */ -#define __pte_free_tlb(tlb, pte, buf) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, buf) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte));\ } while (0) #endif /* CONFIG_MMU */ diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 9ce504737d18..430a3d05a841 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -353,12 +353,10 @@ static inline phys_addr_t __init alloc_pte_fixmap(uintptr_t va) static phys_addr_t __init alloc_pte_late(uintptr_t va) { - unsigned long vaddr; - - vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page((void *)vaddr))); + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !pagetable_pte_ctor(ptdesc)); + return __pa((pte_t *)ptdesc_address(ptdesc)); } static void __init create_pte_mapping(pte_t *ptep, @@ -436,12 +434,10 @@ static phys_addr_t __init alloc_pmd_fixmap(uintptr_t va) static phys_addr_t __init alloc_pmd_late(uintptr_t va) { - unsigned long vaddr; - - vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page((void *)vaddr))); + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM, 0); - return __pa(vaddr); + BUG_ON(!ptdesc || !pagetable_pmd_ctor(ptdesc)); + return __pa((pmd_t *)ptdesc_address(ptdesc)); } static void __init create_pmd_mapping(pmd_t *pmdp, From patchwork Mon Jul 31 17:03: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: 13335128 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 52235C001DC for ; Mon, 31 Jul 2023 17:04:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 93D37280079; Mon, 31 Jul 2023 13:04:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8ED236B0188; Mon, 31 Jul 2023 13:04:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78C59280079; Mon, 31 Jul 2023 13:04:36 -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 6593E6B0187 for ; Mon, 31 Jul 2023 13:04:36 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2811CA01B6 for ; Mon, 31 Jul 2023 17:04:36 +0000 (UTC) X-FDA: 81072530952.10.1CD2D5D Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by imf06.hostedemail.com (Postfix) with ESMTP id EADA8180013 for ; Mon, 31 Jul 2023 17:04:33 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=J5UHMtA0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823074; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=NG13BwzmmAIpXpcduEwvRHFbS3iQhU18W2JpKLteVDY=; b=zilN8IqKvxvNUGjeOobX1U5AjoZrbQvO5pomI5cdg16lTvRMCAa+8jupVdg7WEBQLQ5EFV sg6ODWsjndEUjC9KXOvyxhSISAGXqp4J6793YBvXPVuYQhLUPX3z6gsO8x/JXI9gmjRXvV V1PnAarq0BqKeh9KOp0nvnLoy2C8lb0= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=J5UHMtA0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823074; a=rsa-sha256; cv=none; b=wuNPiyXzsKLIV4NUkNFsoVHLtZ40whoPzwoo7iA72RBOJioQKC5ktbRH5EclgRNd7fbZjz kR9Fan3R4NgGpIsBspC5WL+MmaYYbxY6XliqBPpnAIN3xcdVULA9QBYeg1psO930RdmI1f U+lzPl4zjvo6x9+Daq7uE9+idwHzKfQ= Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3a426e70575so2742920b6e.0 for ; Mon, 31 Jul 2023 10:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823073; x=1691427873; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NG13BwzmmAIpXpcduEwvRHFbS3iQhU18W2JpKLteVDY=; b=J5UHMtA0qoYiWw4Ld5R0BKI4Tc5AGDSmTkXJ2I6fYmBwlIVDq2NZ9TijiKx7n7oR9S O2+0XndgcZyKpOow8lUaucDbgGPax/K8O+lCXFcyUW1OtbVxoGLUMUxT+xXe1Nbotguq wXQV4F4SfOD9dJwiO/iz9SNiN+CqscWBWqXkI0FM0EZ9ZzfP3bhZCq1/PYVKZkiSL88/ WlbyA+YZDFKl4pgL1EI3/3iabhB8k7YUgWRxCXqfKPLtTRNQuaY8gnPQjbT+Yt9xzJqB tpRwv/UorbhC7cKUIm0hPbznR4XxDKlGiKxb+h0cWPY+2avNMZiADFAVxe8ptEu65tNh rVOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823073; x=1691427873; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NG13BwzmmAIpXpcduEwvRHFbS3iQhU18W2JpKLteVDY=; b=j/8bk3VvPAqvmJXNu6Vbii66OEkdmqq9CFK0yvSGuqE1fvrSfKD7Yy9oR8a6GKJL2x saQV+3c8yS59172jXn0guoJDGO8Fh+yyz0N6wyZqhj8Phkd7ZD4/3ywNYEG8jiuJyiMP XrRv97WWXj5S76bVLS1UhIZfBvKv1n8wLr3NjPiQy+3AxFrgb2IeRiDo3az4Sm98943D 2G0JfHZ+w8cXFkbsmz5RuhIodXj7hl2mlYpNDBGxd9ns8LlU3yY8LtRCoKZLfIoR73og uUa4XTlNrwLu9V0p3cVvmza6ARDiGWUa2BSsGxMm6CU9xh3doXgqxrfI0qfFg1z0X6Ro XQJg== X-Gm-Message-State: ABy/qLYGOQaCcKtebZe9oULZy/F7TEnaSbm7I+JGzrsqQ32aihCFmenU Sut4N+nctHHO89vswcPHobo= X-Google-Smtp-Source: APBJJlFtSPsXmTmbaE2JVTTuMieuMfoOw8pkpK4ugTgdmGfxbA+pL1HJ6fgn2J808MNJLpsNTjXtIQ== X-Received: by 2002:a05:6808:655:b0:396:4bbc:9a36 with SMTP id z21-20020a056808065500b003964bbc9a36mr8685999oih.19.1690823072749; Mon, 31 Jul 2023 10:04:32 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:32 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Yoshinori Sato , Geert Uytterhoeven , John Paul Adrian Glaubitz , Mike Rapoport Subject: [PATCH mm-unstable v8 27/31] sh: Convert pte_free_tlb() to use ptdescs Date: Mon, 31 Jul 2023 10:03:28 -0700 Message-Id: <20230731170332.69404-28-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: gfk81zbjub4cz47igz5hzqh17sr17bpx X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: EADA8180013 X-HE-Tag: 1690823073-484304 X-HE-Meta: U2FsdGVkX18LmiRY+fhdW+90t7eR0q2b4RAddjPR2JtH3PlFQoGUbFbCbu422LbpRl7oWB2SqZhbat++/ZAzrrXZgsvgqoBLe8TmagFGfO+cNPJpop0IMpO5MKEAUUES0mjGNTua0LsAqBgl/s4xa4MUORtF2xFoe/Sze7Nkq3p9j26EreQ0dix4NbGMslmD7lvH0tj/lRTdSsjslar8JU4/5xpNPke82kZ8jQdf0WORVF1UPWDdojnkTG2aAm6zBv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PyThNOVsZWXEvolFMA4erbCqXZ7EXIaHgNM6PEIY6NIp0fvXlkv14ooxDw2jHbqF67EbIhufvcgNeOwaZt3jWuKxRErI4LNqPWQ/dexkTeEGDWcZA2OVGAYXqLaz8NPsjtGQ0TWXnzwM/wvgfLl9CmApRxAq3EQoD1419WSntixdE/W3tE0I+gMh+IjsSM0+f3Sx5T6JhyzkHEB28bGj5N8r8uiiYe+aeLIIZLMy0Jk3xeNLHNqHZRpL8kBNexEKUNluvAbBFsigehUn5KC/CQli9tvLqti0GWhOK1j77AA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Also cleans up some spacing issues. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Geert Uytterhoeven Acked-by: John Paul Adrian Glaubitz Acked-by: Mike Rapoport (IBM) --- arch/sh/include/asm/pgalloc.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h index a9e98233c4d4..5d8577ab1591 100644 --- a/arch/sh/include/asm/pgalloc.h +++ b/arch/sh/include/asm/pgalloc.h @@ -2,6 +2,7 @@ #ifndef __ASM_SH_PGALLOC_H #define __ASM_SH_PGALLOC_H +#include #include #define __HAVE_ARCH_PMD_ALLOC_ONE @@ -31,10 +32,10 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, set_pmd(pmd, __pmd((unsigned long)page_address(pte))); } -#define __pte_free_tlb(tlb,pte,addr) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), (pte)); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #endif /* __ASM_SH_PGALLOC_H */ From patchwork Mon Jul 31 17:03:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13335129 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 91532C04FE1 for ; Mon, 31 Jul 2023 17:04:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D83516B0187; Mon, 31 Jul 2023 13:04:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D31B328007A; Mon, 31 Jul 2023 13:04:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC0A36B0189; Mon, 31 Jul 2023 13:04:38 -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 9A4816B0187 for ; Mon, 31 Jul 2023 13:04:38 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 778D712022D for ; Mon, 31 Jul 2023 17:04:38 +0000 (UTC) X-FDA: 81072531036.03.07ADCFB Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf07.hostedemail.com (Postfix) with ESMTP id 5828F40013 for ; Mon, 31 Jul 2023 17:04:35 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=NsFqLoWt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823076; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=K9EaWELDe99nUon5K3Z+iJo2yPeaFSzyCnD+eyoagSI=; b=AN9WMjETQQ13/2ItlNPoLrqEeWH8udLBjzFHslNCsZdllgFP00A8fOUYivRqRIj2GoyIYj fCK/WgmfCJUxKGWzYMD/r8m8RZnQKs6k47BAT59ftEjOLnv4PJSYE0cj12WpbT8RTVSMkH klCUWRHGbAUMt3tdvsETpB8t9staWz8= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=NsFqLoWt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823076; a=rsa-sha256; cv=none; b=Vi691v2+Sth5Q+RYsSf7xWJoBwmpgJu9WCbd/+3vdK2Gmjgdjy4eCkInuoKyDF2Z+oLkG1 G56HTYz4EmZxbbKP7gEoP33uU4+xHmdAulbO8dPX6GFM5PH0tFOatAsBit8/U0nPMBgf/S bS1uuzEh6zMUaefmI4+rJu3BwgVOHFo= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-d167393b95aso8382769276.0 for ; Mon, 31 Jul 2023 10:04:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823075; x=1691427875; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K9EaWELDe99nUon5K3Z+iJo2yPeaFSzyCnD+eyoagSI=; b=NsFqLoWt3v/Ei4hrw5AsnvwdpZbLVDKyj7Tbvrs08XADPJ7gaOSxsw7sciWyK4ium/ IicTt5pAnx/uEvhHlkhBbrdEgtE6/Y30DbetyPtuylWlm9M94rgMfdNkMfsGqtqBt9r5 2L6Wjhryz46RjM7Eb4DDBBbwHfcSN7h5N/Jso4kYni+cF2Cm7JoIdTfshA0rAirRtgJq t1r00+5UN5MvK3JKDaigYuLE4bDBuDPbT6+YGl+hj7DsF2cKQbydBN3rr041uGf1vOTw rMTuYysQGj/R6E2nTgdgPgBnp/CeSE0cUWUK6rVcO8oVilzfT/uwMzlyU+7MnJSFTrKk qPDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823075; x=1691427875; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K9EaWELDe99nUon5K3Z+iJo2yPeaFSzyCnD+eyoagSI=; b=BcHLg1GFoQ+25mTOpwY9maf/7A/En/3BtpkZGqU62XiHEKCHxHiq5WFZYQpjB8ASA8 zkzWiBCdEaPIsXE7Yap8MS+hq1XpVpxWSeiRXQws/T0fzftJJwn0NdL2EQv3A5OcM4GA a06ztGto0nuAtfiuAcESIyIM2mYCHXfKPkIA1MhiSeUgeh5XtJr/gaeLCD1g3e9jDESF FD2ZcYQ7X3FAVKCdr24oq/jBIOHutlL5GmJZLh0D4HVZH3XNVwkwU4Wo4qcj7b0ek+6s fhpLprLUEN/Y+KqMjvacOwYLXB4T3QTIeAdRa25LA4rtPR8eeXHpTotSESPKMQ9Vk0sD yhEg== X-Gm-Message-State: ABy/qLabCXi4oEyJxtvP8yMbpl6zeQEh6xox+DwwND/lwv8E4k/DTjOy l1rwjId3oyxTvbLSp/U0PNU= X-Google-Smtp-Source: APBJJlGLJI7wOi/cAC+4887p5NxC1O6Jx9Z8tS0dkQscAqT6FlNcjE8alBIW2Z/pk8K3FJGLN+6VNQ== X-Received: by 2002:a25:ac99:0:b0:d35:ee7e:349 with SMTP id x25-20020a25ac99000000b00d35ee7e0349mr1328711ybi.1.1690823074854; Mon, 31 Jul 2023 10:04:34 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:34 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 28/31] sparc64: Convert various functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:29 -0700 Message-Id: <20230731170332.69404-29-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 5828F40013 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: nu1girfcxb7cbr3m18hwgy718zw6jwbm X-HE-Tag: 1690823075-428330 X-HE-Meta: U2FsdGVkX19ceEg+dxXSozsmgcd5VY0mIYohBiUlKEjGNYvyc06rd6xZVw2iSpy/YQKMKU+SuLNQMrktNIPk+lwHxskVBdSEaO+aHnVdk13AgaOegwiQX4KIOsLSDGmJsQPNGM03hyfUPhGIwZIb1aBE0UUEjEU+AZD2Kr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4RFw4paaX7ZpNI/CwDpBSijzXFRBWw7kU9b+OK8XHe9cFKBjECAzi3bKlrDTHFbbrH1psbXyjmBsKN1Ytev/ZH4jxj1RZOpoJJGtuWv2z+thKAWbcm5OVRiKSKDclIz5BwN0XCna/jwM9VHX1pHEb9b3DzsXkXF+NqJdbKuHvo+SPynXFuF6CE8cfiiOK+yCvj3oGtfZAcfKacDiYrDMGhpj/E4klk8kuAZ78uTO/pN5avOnkos2F1JRa/oVggtUAn0Q2ZuJMi2XdMQ2eCDd5R8GlWQoJChE49Upm5dwj5IA4LWH+P7ByprDhcIGOkLCChQbXyHYS8+Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/sparc/mm/init_64.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 0d7fd793924c..9a63a3e08e40 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -2893,14 +2893,15 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm) pgtable_t pte_alloc_one(struct mm_struct *mm) { - struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO); - if (!page) + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL | __GFP_ZERO, 0); + + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!pagetable_pte_ctor(ptdesc)) { + pagetable_free(ptdesc); return NULL; } - return (pte_t *) page_address(page); + return ptdesc_address(ptdesc); } void pte_free_kernel(struct mm_struct *mm, pte_t *pte) @@ -2910,10 +2911,10 @@ void pte_free_kernel(struct mm_struct *mm, pte_t *pte) static void __pte_free(pgtable_t pte) { - struct page *page = virt_to_page(pte); + struct ptdesc *ptdesc = virt_to_ptdesc(pte); - pgtable_pte_page_dtor(page); - __free_page(page); + pagetable_pte_dtor(ptdesc); + pagetable_free(ptdesc); } void pte_free(struct mm_struct *mm, pgtable_t pte) From patchwork Mon Jul 31 17:03:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13335130 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 A4B27C001DC for ; Mon, 31 Jul 2023 17:04:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8034C28007B; Mon, 31 Jul 2023 13:04:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78C2028007A; Mon, 31 Jul 2023 13:04:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62CC828007B; Mon, 31 Jul 2023 13:04:41 -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 5077328007A for ; Mon, 31 Jul 2023 13:04:41 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 265841A0B08 for ; Mon, 31 Jul 2023 17:04:41 +0000 (UTC) X-FDA: 81072531162.27.CE00E2B Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by imf09.hostedemail.com (Postfix) with ESMTP id 31C1914000C for ; Mon, 31 Jul 2023 17:04:38 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bucd5YCH; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823079; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ES9RfFz84BcV9KH4Nk3AfkjPOEvVVRdPbPMSiTejLcw=; b=PvJUOxFU+/Bg05Q4SKa4fDweOmhVmZGShqh535iBCU/F2dD6V1gy17eSTqF2NFmnaL0cgy B+GaAf/zluCTwih9OHZJVNXcPCTMlgDDrBIaRxxmE+erpREb88QsWm6LrONAQ9TEiIapqh yjPJXKf3QlW/nqclx47U1+pLdT0Q+1o= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bucd5YCH; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823079; a=rsa-sha256; cv=none; b=KHpIwns+4lI9A761Jqv4iMd9fkMk5hbu5RhfxrSZAXMkjje2ZDFDXfzNlxZCo9VBeVe4J3 GYc/oiyN+SfbgDwFiNsrP/nDJ3crXx4Q8W3g+MVLrDbYh2Q8DLh4YlgBWayks0OwxaeYEY Ocs82Nqmmj8wuXUD8BHl6zskiH+5xLE= Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-d0e55215aebso5130158276.1 for ; Mon, 31 Jul 2023 10:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823078; x=1691427878; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ES9RfFz84BcV9KH4Nk3AfkjPOEvVVRdPbPMSiTejLcw=; b=bucd5YCHLhUvx7sCV87tgBpS/yvMqV1hEBgLcIdtkbm6tehUvQ4b8S8cGlWi7/sHjP BwMI7RjEZDCFEoZqNSu1BeMgh4cbrdk5jNpPQbDjyiWAygQ6GF4RuUGGOqf6kg0VdfDp NpGCzdPUkKHCC4r7KLVhXjv8laMIW1vLz9Hl1FxyK0cd8KUbq0iEAg4q7XF5QTVPGxVT zofHi8CwcgETUVRV13Pib0COy9kOuveisGg57GrFHsyYwDdtVuj+zN7pcxA+niXzYe26 MUnkSw5QHmNGRsesWl9frKtr+MQAPLnxo4yz7glnwyiVSVRMIHwbjCv+Zju9S3AQsrM+ fRtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823078; x=1691427878; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ES9RfFz84BcV9KH4Nk3AfkjPOEvVVRdPbPMSiTejLcw=; b=OBjwLHMlGOTICd6gSR1DjotAhcyOuXIDSghGO8dTjGLWmTtRGYn+7qLoXIBAkF521d pTu2cI+k8uXLy36byy/t7RrWoXz7o+4ZN9cZptKD5SRTDRJ+qdsfSw50pCJSLXrIOR3/ lzbeIZIFarHrvIL4iFaxUyu8/MzcHPIPJTft+iH66mnrN951kPKltivQY7HkAsNYkwD3 G3j43SL8HQeEWs5XH2lZf1RYNCqZxEcZcBEYD36NQQDRsx4Q1B84ofgBGYGqGf9QBzt6 NmOjrfjC5H4IDclSq0IwFzNjyh46d1BLbZe67POqpv6K1VmiJ1y/UxghFRaMcl4vrqao 0TEA== X-Gm-Message-State: ABy/qLZ1RLYpdJjjdfrN8iXNzBcbF3wbN3zoEXZU2V7MmkDgV25pXjso D7GFXWulnrbit6HrcEGHqR0= X-Google-Smtp-Source: APBJJlH4kzdzBzRUIaE/50pCy+wwrgbHVj7GhIP0EpKNGW/07mJrSi1SmuvJmvqLlmEJ9bXKX+N7ow== X-Received: by 2002:a25:2496:0:b0:d0d:f5f3:d2bf with SMTP id k144-20020a252496000000b00d0df5f3d2bfmr9661709ybk.48.1690823077914; Mon, 31 Jul 2023 10:04:37 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:37 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , "David S. Miller" , Mike Rapoport Subject: [PATCH mm-unstable v8 29/31] sparc: Convert pgtable_pte_page_{ctor, dtor}() to ptdesc equivalents Date: Mon, 31 Jul 2023 10:03:30 -0700 Message-Id: <20230731170332.69404-30-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 53ib7sn8j4krrpy7y8fhoiriofeje1po X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 31C1914000C X-HE-Tag: 1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Abbay71/Zj+eqAC9AzVOpb/Bjz87DY+Xc7XjW7LmglFJaaqrO+NKzmNjfoxSqHk1q+DbpN96rSfHTf/FGLOdM/3Vhl+0xhFX8zpRjfKCnFBLOOXMvew+8bSt2lxD1O8anFSKB42NCcROBswLGnP86fn6utG3dnlRXVU6bqdXImcnikssEwCPbLKYY9+U9Sn+ENB7Avrpqm6NRrgQ2fU5dpGrX2eCNrwUVn5zgS9rfvigx60duNrtUb3ekq6K/c9kMoOfjUJHhePNqagLPPDSekWiliX0OteU2SN5r9BzsREwkhzpnEWe4j6qJRzXOBF6YAnftbO70hcII7m+IRh6hx6/Nb+XtmZ+xRTuKPLIUSZX6n+SmEvyhRgPyDuZmh/U5eZE4z6y9/USgobeOAcZtmaRZaY4MnAVfUmb2as5rgen1tbqJeIxJFI6XZDBs9ZJdipEMdJZGT1yobtAKwcnBbbZxCgqA/pVbxz5rZ6Fi2Xgv/1NkAm32xGZAQeftBfjnK4MGdMMHFo2Fxn+pFn5rhq8DCo3+sXrczHXmxo4LU1C9vwzg33F7hc6HpMpQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable pte constructor/destructors with ptdesc equivalents. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/sparc/mm/srmmu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 13f027afc875..8393faa3e596 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -355,7 +355,8 @@ pgtable_t pte_alloc_one(struct mm_struct *mm) return NULL; page = pfn_to_page(__nocache_pa((unsigned long)ptep) >> PAGE_SHIFT); spin_lock(&mm->page_table_lock); - if (page_ref_inc_return(page) == 2 && !pgtable_pte_page_ctor(page)) { + if (page_ref_inc_return(page) == 2 && + !pagetable_pte_ctor(page_ptdesc(page))) { page_ref_dec(page); ptep = NULL; } @@ -371,7 +372,7 @@ void pte_free(struct mm_struct *mm, pgtable_t ptep) page = pfn_to_page(__nocache_pa((unsigned long)ptep) >> PAGE_SHIFT); spin_lock(&mm->page_table_lock); if (page_ref_dec_return(page) == 1) - pgtable_pte_page_dtor(page); + pagetable_pte_dtor(page_ptdesc(page)); spin_unlock(&mm->page_table_lock); srmmu_free_nocache(ptep, SRMMU_PTE_TABLE_SIZE); From patchwork Mon Jul 31 17:03:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13335131 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 999CAC04A94 for ; Mon, 31 Jul 2023 17:04:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9FFA828007C; Mon, 31 Jul 2023 13:04:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 98C6128007A; Mon, 31 Jul 2023 13:04:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6553E28007C; Mon, 31 Jul 2023 13:04: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 50E4828007A for ; Mon, 31 Jul 2023 13:04:43 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 20258C0129 for ; Mon, 31 Jul 2023 17:04:43 +0000 (UTC) X-FDA: 81072531246.04.3690A5E Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf23.hostedemail.com (Postfix) with ESMTP id 16CE6140020 for ; Mon, 31 Jul 2023 17:04:40 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=fypnJ8EO; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823081; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JRfRtQSkmDpdaHgWU+x8J8rVDSFtmuGYMRjnXDV0vQY=; b=wahflcYyRZ/48ouTFl17ds3Q568rYgpPl8qgEa4joocjR5IZ1UYVRW42QJvyvYUQNOdkG4 t3n6FF4ZLRzG7mTAKrpQzBq1o3LTXT+paWdly6Ad1Kizc6mtsQVjPYjFX6X0EZ9E1vkTCv ZMc4ngXiq83YSA1Ck58W36n3EODjfyE= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=fypnJ8EO; spf=pass (imf23.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823081; a=rsa-sha256; cv=none; b=xeObvO91cPiouf2ouzWXiiTvFYiI8iMThsAiG9nhAjwe6MY16nJ+lezwRLQ7cOfIpsip4t npRiNTZ1Y1QBlePH9nkL5O7xcnOsKgWK0J1qtsMhROCJ9W/8HlkONHIAkVRFUw3ebh2OlX 74OdKqPVhbCvLERlmDtyXI9vH7ZgliQ= Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-bc379e4c1cbso4878960276.2 for ; Mon, 31 Jul 2023 10:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823080; x=1691427880; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JRfRtQSkmDpdaHgWU+x8J8rVDSFtmuGYMRjnXDV0vQY=; b=fypnJ8EOp6389G/yrEsdiBw8+ODFJB18UGVsK1WnMmuuyVJGZEMRFzagFIz/t/iUP/ 2hQUC88xrJTr5zC02f819WJdC4SisRLoHgth8vaUsDxgglJhi6MHYK2vk4aVYQFhtjHu EJ82jl2MiLVTmBE59Pwb2ZF5o5qt31wsfoof30f3jCxfq5PoYDaunPmGz2hyM4ah/4KD ydzqEb1pNZ1YIAh6SsOFxKI8oa6yw/2SpcLuoX5OxyBAJ0szyfenY4ClRYrgeaYLOg5P lgJjKay9Zm3G6SxJT2EV+hC0IYmKARvYedORBaKi0opdpa/X1F5LwQzjJG/maSgO9ToG 3U/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823080; x=1691427880; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JRfRtQSkmDpdaHgWU+x8J8rVDSFtmuGYMRjnXDV0vQY=; b=UHaqSRV1C2hIdu0ypSW39lqGVLjUcWl7Gn+gQRtXURYsCxuRBmmG3cogxeh97p8o7d Jp48hDqGl296RgJWkbBWaZE+J6BnBoYhYXY10jY7Q+6IGD+kepy1pJPeB/s8xscyrIVe iOfz4yZSrIXG1YLajEOOgLNE9wwS4W6xWINwV+47a7cSDGgIho+g2DOH0jMkswi2Re/X 7h68N51y9fl3T07se/Sr2fkZgHBbpgAHrJEG62M4qTpZLIwBUiyEq2mbNMU3oWTqaaLN /9vmnEW4MP2oadbnoaRtz4tpXm22GfCORTPx48+6LzJ5Gp5fefjFhQlT3vnOSmrv5kQC iE3g== X-Gm-Message-State: ABy/qLa8Q+g3xUrckhH1EBZDD8Y8zYZL8FbfeoxAHMpjQNls2HKw0cm+ sY/bXiOkWiO7ITOgZ9rHiVk= X-Google-Smtp-Source: APBJJlEdwhqcmTMrEtHQGs0fafmxeVWw9ywX+xXLwsxfbs/EAm9tmHsbV10DQDaT24PRZb9zbh9R9w== X-Received: by 2002:a25:aca8:0:b0:d0b:2ff2:ff8 with SMTP id x40-20020a25aca8000000b00d0b2ff20ff8mr11589261ybi.21.1690823079964; Mon, 31 Jul 2023 10:04:39 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:39 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Richard Weinberger , Mike Rapoport Subject: [PATCH mm-unstable v8 30/31] um: Convert {pmd, pte}_free_tlb() to use ptdescs Date: Mon, 31 Jul 2023 10:03:31 -0700 Message-Id: <20230731170332.69404-31-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 16CE6140020 X-Rspam-User: X-Stat-Signature: h185gbg97h6g8xwcz51t3m556gjkb1ok X-Rspamd-Server: rspam01 X-HE-Tag: 1690823080-696393 X-HE-Meta: U2FsdGVkX1+e7nWrl2enCdd1Vzk4KMg/+28E+JtiPJ0O+0P9EXgcgGInKm4spAa2weagVsO+8MKb76wyROPNPn/ymOgURneZDS0JUAvQQjKajUke60Y+uMp86wLsRuZ7fmSROQ3XgQKOB1jnB57TcSWWDAXRZpsROo674tQ2bqDzR40ubkh/KoiZiPPwFCBXzgqxITR5Onq8SrGLXTmGRb/Q/CHZbv8sCkVO1O+3KGSmL52tixLXwukLdCBnFbr340CDXOJoA/wgYE2wbtx0N+5s+alWehGC2bHnwjht1vN6dsTuQzilsskEvIs+DolSIiDteeWSH9DY3PmhEHntiAEqDzeLwY6VQpMJJgnmjlFtSAvYUI0Lb0MufoA7m3c69xawrdEw6MrT3vztFQDe1gT8vBmVMQy9PLgP0x2GIrX5HDETgB38nmPl9VUdxdj+tXXmN9eSTOJ3M0zTf0S2UBnyMfwDzB3U5kcTgvXS3HEiJwinhgIWz5eRSWkSmplQ8tpeCeJdXVrHsQqThgt6u/uUvT8LUJjk4Xl4RtqArtQRJ8ZSVcjmVWIMJGWGFHwim+XPSDT22avifCpWVIEd/LGnSQGGR7McEZIHHqDxBKEsGQZBXAXw1gelHpvxWbnj5i/9Ye6g3LCGYh9B8KYCfcbLxHc5VoDdk785oyl+7zVWEbxyOMb066xFim4tTOR8ZR3EkxiN1Dp3te+eIom2pzum1w06Ww4lLePldkSkYzJO0Lrdjq/ZFZJVkGdaRmOQL+GH2KBB1DXzIOAr0DqnTPbstKOmwH9S+TehSadsKfqf1IpS6o62fCAEu161JGy8bKUCBu93It1O3KAl/DN9JIYPZBKwxsGfcjZTKBoq28bDNngFHj3q81vlRS13hKAtTkXwAFnjFutW+6KqbYW5IC0OcNFBl09Eh7wpFqWvbyKMKXinzpVuAiw6znNlRlrngjUHxs4sPsfzpeHe4ai qxDiE9BQ vV3SDn3MfImWaQX2Vqb4W5txxCD5GxUw1ClfUbS/cpDBUCr1DNiUm2vpdDPwtrhU8e6LT8l/ic7aEuVVbujysCdghfXwQgeTGjNiy4980A3r5vTNK7/PPnSTf3mrzlL9OCX5GqTVCgUIz7OOEg15jsKXnm3GgYRmbIQpji/sT3Ji9prmNP9V3i0ikEh407TPjcU7Uv+saQFaU3b3GB/NVW9N/FMhr060nfvR+ED8EAyoACfcyPuqChqGa6j2/WVOe2eRjUAFhg0WTiz0XUSCy1A89/G8WtI/9Ml381LiCwyvY0rjL/Wq1gvomoAU0AHz/8qni5leYQVJH3Bb+hhygYxI9sJQqGuy5ElOZoWRCK6ZsLhhELrbR5y/ffuefVqKSvrvEFF1HZnSc/hj3uHkwiXpmnUyKx9rOJeGXcA0f0nx3zkfd+Sgy2pMtxg/TLC58DFuBtwckm8aM0Bn5mvJCxmYPlS1m09cK0EphZnKENJu4ZPLgqz4tCWEfuHBP/A/NB5LZ1y+FipdD8pbxLOHhiTWRWOP1JL0Tc/Jr59DV79amJFXXH+TTurVDpSnWuDLuE96kHDl/RBRGt/1ORAoL0KTlvU9MXQKDVqLxnfFshcwZyBA7HfryWvvgiiCerVvgr5KTOXlQmSU5DB4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents. Also cleans up some spacing issues. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- arch/um/include/asm/pgalloc.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h index 8ec7cd46dd96..de5e31c64793 100644 --- a/arch/um/include/asm/pgalloc.h +++ b/arch/um/include/asm/pgalloc.h @@ -25,19 +25,19 @@ */ extern pgd_t *pgd_alloc(struct mm_struct *); -#define __pte_free_tlb(tlb,pte, address) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb),(pte)); \ +#define __pte_free_tlb(tlb, pte, address) \ +do { \ + pagetable_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ } while (0) #ifdef CONFIG_3_LEVEL_PGTABLES -#define __pmd_free_tlb(tlb, pmd, address) \ -do { \ - pgtable_pmd_page_dtor(virt_to_page(pmd)); \ - tlb_remove_page((tlb),virt_to_page(pmd)); \ -} while (0) \ +#define __pmd_free_tlb(tlb, pmd, address) \ +do { \ + pagetable_pmd_dtor(virt_to_ptdesc(pmd)); \ + tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pmd)); \ +} while (0) #endif From patchwork Mon Jul 31 17:03:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13335132 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 E7AECC001DE for ; Mon, 31 Jul 2023 17:04:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C85928007D; Mon, 31 Jul 2023 13:04:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8527328007A; Mon, 31 Jul 2023 13:04:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A21128007D; Mon, 31 Jul 2023 13:04:47 -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 53ABB28007A for ; Mon, 31 Jul 2023 13:04:47 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1B395C017B for ; Mon, 31 Jul 2023 17:04:47 +0000 (UTC) X-FDA: 81072531414.08.B9AB696 Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) by imf17.hostedemail.com (Postfix) with ESMTP id 2EC8140009 for ; Mon, 31 Jul 2023 17:04:42 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ioOMbbu3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823083; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ge3Da1dLlbVImV5jdD/HZRx7aISFPvIvfEGvqleo2SA=; b=c5bmQf9ztju4KUzs6MdprFRq688HYYwIDmt16XsjBNE2cNAzACta8a5EFo2qkmFZGNSQsP W3BA26EBt6SPgW8R3zdmq+LEC5GcU76uYsPZimozmfO24kgMx84qx8C22Lqbnh2fCbx6Gw 9IeLF6cgAQe7EgdtrwGl4Asi8LaYCQc= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ioOMbbu3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823083; a=rsa-sha256; cv=none; b=09PcfV0+O75yViLY3ZjO0ZXrUolHsTOJv2qop5ut0N2lq0vn9T6q8VBf6x8QKp7Q5ai/S+ CTAhszJF0ak+T/7FAmsQE+0HEu0JNvJefWepUxjnl5iKkhcYbpuGBFGq+Ys/UT9D0T3EUX vRRTcW81NQAoqJbt9FTSjQO9TNE/FwY= Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-d2b8437d825so2457677276.3 for ; Mon, 31 Jul 2023 10:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823082; x=1691427882; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ge3Da1dLlbVImV5jdD/HZRx7aISFPvIvfEGvqleo2SA=; b=ioOMbbu3JES3j1Jj+JW3855XW3Ov65AQm8O9lv95JxDcPPS6IwntjHfsaaLCwjHL5b OuA4j3AMcOeG2v6VKrbkSXabyBKoN8KuyYIoDCC1YD5I/RC4KqKt3ITSQwKezbQCp/8J AR8EjEBjRuz0BKnlQIU6Pu2fINdNhuBPDReykf5gMLB8b4rp/cimT4edf9bEDyME9O7d VFOstOotn1+dDzfuistQZkRoPkOh7Uzd/ZqgsVXJ0Zgg3bR5ReggCo1obemCJNhIS+t9 Ue+OH0jfGRqmyKjIxlmOMTrVnVAvQzQZxHF6PwZledF5BBiAWirHuHl+9jo5QzXuxUnf 6Gng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823082; x=1691427882; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ge3Da1dLlbVImV5jdD/HZRx7aISFPvIvfEGvqleo2SA=; b=Ra6jbzOMiHfBSxRhseMwozBTek3pasoxR2XXuMuwYTo52MUzDQGlDwtweUcd8khCs6 H5mnTfPeWyFlIWnM6so7zlDRK8GKb8WWEhLuUego2Y46yhDNqKAN8+Vl6DoIJsLuFyuJ MA3F20jyMMuINIF5gRO/9DsqzH7HoZIQikDwjUCUlvsm13vYjbQ6jNoMtmx+R72xlJry A1hlPYsitUl11K/vX6QPOEqD7isEOFU2p5INszxsvgzpmJ14kFfB/2BqbqmSSg8c7/qr rZnSrLcdwfbZfOYWTItato0ge4IwHbnPEyQ7pAinfMzvl++US7M2gwxzIc9t/kYlLIut JI9A== X-Gm-Message-State: ABy/qLZfwZw8kYaKjpEv4+GyURy/+iBSDetDRGY9TEARwLWR44pgoaPn jru+Aq76JYL6h4sbsXnyg4o= X-Google-Smtp-Source: APBJJlF0vgCAeh2GJq7nS2h9EAm5JTHFkJPU6wpVfPXTMfmv7gc4qDUX7Q6WDvp5wiH1WM3Qyv6c4g== X-Received: by 2002:a25:d68d:0:b0:d0f:ea4b:1dff with SMTP id n135-20020a25d68d000000b00d0fea4b1dffmr10302787ybg.8.1690823081905; Mon, 31 Jul 2023 10:04:41 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:41 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH mm-unstable v8 31/31] mm: Remove pgtable_{pmd, pte}_page_{ctor, dtor}() wrappers Date: Mon, 31 Jul 2023 10:03:32 -0700 Message-Id: <20230731170332.69404-32-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2EC8140009 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: g5i3pezpw7kn1651jmfishjt7nqajf5d X-HE-Tag: 1690823082-417373 X-HE-Meta: U2FsdGVkX1/4dMQjA6hA9JDRg5cZCr0GIHonNmKdaBSI6hElFG0h42yIV14mUT7nN3tR+xPEFW1wWO2cDNWS2Yzq68FXAb8V0oI5D6QNGAS5DUUQ/TZH2NCywk0ipNbH1j0vB06YoV8iaEWGsw+r4t4ZvtwPYGN4Nj6HwCbZoYNlSd8fugPiTNIECADbXT3Ma1qLRUtIMTX6r38zbuw3xxAGda8pNxaKt9xMgA8RLoOBf4hjyjDo3lEPna3rewaJNWSEw7hBWOS6CPDSq0oz+fpUA03tMs6rm2NhYQmUsw3tWx6Z51HrMRv0HqOSKYw9wBSlMHdlj7UgvrTRppTXLVAvEDsKjR5itr35yA3nKdmVSBiPEmb/zR+Vp5EovsW50xNX7bmDXu8gXd3Qm0OWz+u0G5ISAjgP+DxYKn9cZnuY2CZyhyfOe44xEBkytQ6Pw8+EvEakQYn65pI4ytU+i51OYIHu1oEHmLxXeEumGNNrdWFqrlb69KgF+fBj9NYXfgGpU0+P8t6+HaYnB4GcBPa7t/yyfLBnO4SecaRcK31tpPeRZCN03sapOIow8lItyodpxCWUqZUxJkABJk4AlXQkM5O6l5Sps4g4RPOPGEhXbt0nTtFOMuzhGp3BpwJV2LvkVuMpRb9+3UNShHiKFfdSbyerU9zuQWD9O1tvJv3j19/5n2jGQcBsxv50QZ+al8LUK8whFjyH5Wm2KjBfEyLAq8nA7RpV4ic1bn3WQoJMdXTxNJ119Oa+hvUzduJ3KG2/CIs+gTBfXcDBB+azkRGyy3SiKo3sj+X7Jh6bOmXg36MhiTR5/WVJDzKIN4aL99Zbtnd7SLqCQFjZi6jeagQL427RS007eA7xVb/t48amk+TAg184b2Mpd5Sj16aVu91Mgn0skROrxelWBxURgCRzrT4t088AGR6edOEgLAzt9uSGj1TBlYkfRMqo1u//xoCMCaE9RYoTp4Qvnpl y4HymM+J cLYHhNKcyUztpTtbgb9AaqiqTNvyPhxdROJSlMK/5w0eOTMdGynYwoiQV5AmEf9t7AUraUdXZBreVdxpIwjsigtH71mFgpaWSXvlR1yT5Wqpf1rpvDn9YaO8wvslMflJU2TjBHrSg1Ewd6wuhXeZJshJehhm1RtTSZhM4yTLQr/xWmK64Znzccf/Ju+hZVLYePEMTAmitin6EIcjQdxxz+NGmRsZwGtAk8HtZLT9j9HwgHTNIbCQ4QZH4nzbfyBnwQBhZjHFzAlCEZVW3QMWaDgm7OWyT3WM5GKIhgqJn34Ux4HsuuShutMHzi1IxRYcRDizrJKHxeyAOC4UQ4hWsbqeDmd0xu2veQd8j+iWxJrPoPtaDGMh1OeoxcRtp/Od/mo+W7FtivhMCWKnS3mkOEavq9wTDXdewL0U0d7/X3HQUKKgRVNHSrg0HZpT7vqx+LDuZWR/Vi5kFhL+mi+L61HTMuBw9iN/OAilzy4HEEiTqa3naWaCqhPSbLjJqR5ZYQ65bwonKuik3zxVAsRKGPAVsRdolwcOeLC5py08hwkPkmkd0wrXq58WgU0e+fw8pIxE2hHOnMaGCIuX63HN+ZECGoU5/HHENZLV1EAdNzVEJQotDZOOvUJsy+7hOtLthR0Z6wqlo8KxL0kY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: These functions are no longer necessary. Remove them and cleanup Documentation referencing them. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) --- Documentation/mm/split_page_table_lock.rst | 12 +++++------ .../zh_CN/mm/split_page_table_lock.rst | 14 ++++++------- include/linux/mm.h | 20 ------------------- 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/Documentation/mm/split_page_table_lock.rst b/Documentation/mm/split_page_table_lock.rst index a834fad9de12..e4f6972eb6c0 100644 --- a/Documentation/mm/split_page_table_lock.rst +++ b/Documentation/mm/split_page_table_lock.rst @@ -58,7 +58,7 @@ Support of split page table lock by an architecture =================================================== There's no need in special enabling of PTE split page table lock: everything -required is done by pgtable_pte_page_ctor() and pgtable_pte_page_dtor(), which +required is done by pagetable_pte_ctor() and pagetable_pte_dtor(), which must be called on PTE table allocation / freeing. Make sure the architecture doesn't use slab allocator for page table @@ -68,8 +68,8 @@ This field shares storage with page->ptl. PMD split lock only makes sense if you have more than two page table levels. -PMD split lock enabling requires pgtable_pmd_page_ctor() call on PMD table -allocation and pgtable_pmd_page_dtor() on freeing. +PMD split lock enabling requires pagetable_pmd_ctor() call on PMD table +allocation and pagetable_pmd_dtor() on freeing. Allocation usually happens in pmd_alloc_one(), freeing in pmd_free() and pmd_free_tlb(), but make sure you cover all PMD table allocation / freeing @@ -77,7 +77,7 @@ paths: i.e X86_PAE preallocate few PMDs on pgd_alloc(). With everything in place you can set CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK. -NOTE: pgtable_pte_page_ctor() and pgtable_pmd_page_ctor() can fail -- it must +NOTE: pagetable_pte_ctor() and pagetable_pmd_ctor() can fail -- it must be handled properly. page->ptl @@ -97,7 +97,7 @@ trick: split lock with enabled DEBUG_SPINLOCK or DEBUG_LOCK_ALLOC, but costs one more cache line for indirect access; -The spinlock_t allocated in pgtable_pte_page_ctor() for PTE table and in -pgtable_pmd_page_ctor() for PMD table. +The spinlock_t allocated in pagetable_pte_ctor() for PTE table and in +pagetable_pmd_ctor() for PMD table. Please, never access page->ptl directly -- use appropriate helper. diff --git a/Documentation/translations/zh_CN/mm/split_page_table_lock.rst b/Documentation/translations/zh_CN/mm/split_page_table_lock.rst index 4fb7aa666037..a2c288670a24 100644 --- a/Documentation/translations/zh_CN/mm/split_page_table_lock.rst +++ b/Documentation/translations/zh_CN/mm/split_page_table_lock.rst @@ -56,16 +56,16 @@ Hugetlb特定的辅助函数: 架构对分页表锁的支持 ==================== -没有必要特别启用PTE分页表锁:所有需要的东西都由pgtable_pte_page_ctor() -和pgtable_pte_page_dtor()完成,它们必须在PTE表分配/释放时被调用。 +没有必要特别启用PTE分页表锁:所有需要的东西都由pagetable_pte_ctor() +和pagetable_pte_dtor()完成,它们必须在PTE表分配/释放时被调用。 确保架构不使用slab分配器来分配页表:slab使用page->slab_cache来分配其页 面。这个区域与page->ptl共享存储。 PMD分页锁只有在你有两个以上的页表级别时才有意义。 -启用PMD分页锁需要在PMD表分配时调用pgtable_pmd_page_ctor(),在释放时调 -用pgtable_pmd_page_dtor()。 +启用PMD分页锁需要在PMD表分配时调用pagetable_pmd_ctor(),在释放时调 +用pagetable_pmd_dtor()。 分配通常发生在pmd_alloc_one()中,释放发生在pmd_free()和pmd_free_tlb() 中,但要确保覆盖所有的PMD表分配/释放路径:即X86_PAE在pgd_alloc()中预先 @@ -73,7 +73,7 @@ PMD分页锁只有在你有两个以上的页表级别时才有意义。 一切就绪后,你可以设置CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK。 -注意:pgtable_pte_page_ctor()和pgtable_pmd_page_ctor()可能失败--必 +注意:pagetable_pte_ctor()和pagetable_pmd_ctor()可能失败--必 须正确处理。 page->ptl @@ -90,7 +90,7 @@ page->ptl用于访问分割页表锁,其中'page'是包含该表的页面struc 的指针并动态分配它。这允许在启用DEBUG_SPINLOCK或DEBUG_LOCK_ALLOC的 情况下使用分页锁,但由于间接访问而多花了一个缓存行。 -PTE表的spinlock_t分配在pgtable_pte_page_ctor()中,PMD表的spinlock_t -分配在pgtable_pmd_page_ctor()中。 +PTE表的spinlock_t分配在pagetable_pte_ctor()中,PMD表的spinlock_t +分配在pagetable_pmd_ctor()中。 请不要直接访问page->ptl - -使用适当的辅助函数。 diff --git a/include/linux/mm.h b/include/linux/mm.h index bd3d99d81984..e4e34ecbc2ea 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2913,11 +2913,6 @@ static inline bool pagetable_pte_ctor(struct ptdesc *ptdesc) return true; } -static inline bool pgtable_pte_page_ctor(struct page *page) -{ - return pagetable_pte_ctor(page_ptdesc(page)); -} - static inline void pagetable_pte_dtor(struct ptdesc *ptdesc) { struct folio *folio = ptdesc_folio(ptdesc); @@ -2927,11 +2922,6 @@ static inline void pagetable_pte_dtor(struct ptdesc *ptdesc) lruvec_stat_sub_folio(folio, NR_PAGETABLE); } -static inline void pgtable_pte_page_dtor(struct page *page) -{ - pagetable_pte_dtor(page_ptdesc(page)); -} - pte_t *__pte_offset_map(pmd_t *pmd, unsigned long addr, pmd_t *pmdvalp); static inline pte_t *pte_offset_map(pmd_t *pmd, unsigned long addr) { @@ -3038,11 +3028,6 @@ static inline bool pagetable_pmd_ctor(struct ptdesc *ptdesc) return true; } -static inline bool pgtable_pmd_page_ctor(struct page *page) -{ - return pagetable_pmd_ctor(page_ptdesc(page)); -} - static inline void pagetable_pmd_dtor(struct ptdesc *ptdesc) { struct folio *folio = ptdesc_folio(ptdesc); @@ -3052,11 +3037,6 @@ static inline void pagetable_pmd_dtor(struct ptdesc *ptdesc) lruvec_stat_sub_folio(folio, NR_PAGETABLE); } -static inline void pgtable_pmd_page_dtor(struct page *page) -{ - pagetable_pmd_dtor(page_ptdesc(page)); -} - /* * No scalability reason to split PUD locks yet, but follow the same pattern * as the PMD locks to make it easier if we decide to. The VM should not be