From patchwork Wed Mar 6 10:41:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13583879 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 D7058C54E49 for ; Wed, 6 Mar 2024 10:43:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7042D6B0072; Wed, 6 Mar 2024 05:43:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B4826B0082; Wed, 6 Mar 2024 05:43:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 554E76B00A6; Wed, 6 Mar 2024 05:43:00 -0500 (EST) 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 3FCDD6B0072 for ; Wed, 6 Mar 2024 05:43:00 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0F19B120459 for ; Wed, 6 Mar 2024 10:43:00 +0000 (UTC) X-FDA: 81866276520.20.5A14183 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 5B75616001D for ; Wed, 6 Mar 2024 10:42:58 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eVWZ5zwK; spf=pass (imf08.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709721778; 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=4C+lWpN1qDfU+nymiqOVXkY7IqPiijqTb8F5rFjpmTU=; b=LdIPf9KmDqGhgA7Uw2+G7EPzOPK77p1z6fyuCahvWEopBbEov2rlawJCNXfl+AeH5ZIq1p yZBjtOv6RVfk88LEUexfnLzp7gJ+HFTIv04AUErXEVpNbulJMZ8a+eB+39PmjD94lLMep5 hBhI+UbJhQAs+aZzR5U0df0kVQNBVFg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709721778; a=rsa-sha256; cv=none; b=TQ4zK2TLy26+TYeOhj27okJjHLPFXftTqlHz0hI/5Sx7Y8DpegvLBO4YavBE0ih9ph4a5i Y9eh7j05w53aJL+VBzqPvtJCekxTJslJtfQxm2d2zFNkwz0loeaRrq8acsgN6Cnhdha6PM 6nNgTLbXqDH6jaHI4Az76+ufIqrLoYg= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eVWZ5zwK; spf=pass (imf08.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709721777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4C+lWpN1qDfU+nymiqOVXkY7IqPiijqTb8F5rFjpmTU=; b=eVWZ5zwKEn8D25OPaGhlp+G77eC1s/VFSQZFX7ZvRMeh6LSTS7vORfQP5vYpnprelmrGn3 KuJgJbsHcZH70ERCBmFUM804XqyGrD2HnaJJymlEBNvkXJBUR+R4uXsI/nPNmfie/tWYzv 8M0w72q+B0hvNuAmvVSMi4M5yivXI3k= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-aSR7lTs0MGOXGlrFM8hoQg-1; Wed, 06 Mar 2024 05:42:54 -0500 X-MC-Unique: aSR7lTs0MGOXGlrFM8hoQg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7927980F7E3; Wed, 6 Mar 2024 10:42:53 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id A34D7111DCFF; Wed, 6 Mar 2024 10:42:44 +0000 (UTC) From: peterx@redhat.com To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Andrew Morton , Muchun Song , Jason Gunthorpe , peterx@redhat.com, Matthew Wilcox , Mike Rapoport , Christophe Leroy , x86@kernel.org, sparclinux@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Russell King , Shawn Guo , Krzysztof Kozlowski , Bjorn Andersson , Arnd Bergmann , Konrad Dybcio , Fabio Estevam Subject: [PATCH RFC 07/13] mm/arm: Redefine pmd_huge() with pmd_leaf() Date: Wed, 6 Mar 2024 18:41:41 +0800 Message-ID: <20240306104147.193052-8-peterx@redhat.com> In-Reply-To: <20240306104147.193052-1-peterx@redhat.com> References: <20240306104147.193052-1-peterx@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Rspamd-Queue-Id: 5B75616001D X-Rspam-User: X-Rspamd-Server: rspam11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jD3qvfs2cNHIwlWTrqXE2i3tknH4JDmIFxETgFjBhjM7fdyB15ky2IHWaVogobRHH/lJOPfskYWCHyNcHeSmdKl1WjxZhy6npZkmSd866z45KLlWt0bSOAyWkxOCnuelCcc4WGUVWLyf7EoKM6V0o3HE5lZvO3uwr0ZFQUG4TF1hM3pdSKrIDcbt9/StmhVS2M4L82TCn9pnnQLAS6EnDBe1waHBjSvjTsOKlo34zyLFLoFAGoJJ0YS620suTH9bTgxf7vaSzp6UK0qoMqQ9r32ncCOt5Krkt86ohxc5s+ud1NxuAJTtRIGZIZi87hB++Xz7PWdyAWH1H7psNyF0I5kKcM18OPVeufgwnLDvHv08Bnxip42/4no85vxkoxsHEqiRmanX2ywKvYrk5QxDmIsCYuFAVnXdsjRUrQtT/dgkEhKErpK2EFhkHZfdWBcV+UhVko= 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: List-Subscribe: List-Unsubscribe: From: Peter Xu Most of the archs already define these two APIs the same way. ARM is more complicated in two aspects: - For pXd_huge() it's always checking against !PXD_TABLE_BIT, while for pXd_leaf() it's always checking against PXD_TYPE_SECT. - SECT/TABLE bits are defined differently on 2-level v.s. 3-level ARM pgtables, which makes the whole thing even harder to follow. Luckily, the second complexity should be hidden by the pmd_leaf() implementation against 2-level v.s. 3-level headers. Invoke pmd_leaf() directly for pmd_huge(), to remove the first part of complexity. This prepares to drop pXd_huge() API globally. When at it, drop the obsolete comments - it's outdated. Cc: Russell King Cc: Shawn Guo Cc: Krzysztof Kozlowski Cc: Bjorn Andersson Cc: Arnd Bergmann Cc: Konrad Dybcio Cc: Fabio Estevam Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Peter Xu --- arch/arm/mm/hugetlbpage.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/arm/mm/hugetlbpage.c b/arch/arm/mm/hugetlbpage.c index dd7a0277c5c0..c2fa643f6bb5 100644 --- a/arch/arm/mm/hugetlbpage.c +++ b/arch/arm/mm/hugetlbpage.c @@ -18,11 +18,6 @@ #include #include -/* - * On ARM, huge pages are backed by pmd's rather than pte's, so we do a lot - * of type casting from pmd_t * to pte_t *. - */ - int pud_huge(pud_t pud) { return 0; @@ -30,5 +25,5 @@ int pud_huge(pud_t pud) int pmd_huge(pmd_t pmd) { - return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT); + return pmd_leaf(pmd); }