From patchwork Mon Mar 18 20:04:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13595784 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6DBF7C54E58 for ; Mon, 18 Mar 2024 20:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=87Nif4EZxWnXQTXzx+fAn2t8+UBy/UypT+E0VwZuLQY=; b=GW7LOd/i/tE2M9 m2HxQdcGYauruCZ0pVQXxbD+1IfHGTQ/3TR6O0NduvKwEX8stqAuZ6kf7R/djPB2BxfgyN9JHX7bI 5ii+SradwB+cLGrogQx10UdDI29QCIw89cPFwo4v9Kf4/9fr7NFZWL+VN6DhdnOWZnRcICsP1yhMV hvsy3HcW5hAEwgQ8bnQZ+Op9bBr6cbLUNWsl/lRE+o1CU6OIereyjyZQb0K0xfJZgNZZI/oLO3i5w dQ8AglLUxGFL5QB4dJcf6NhkO4bMaq59GL0UmOLqiS1T5pLLifOpPBNa74HZCvGlwTKjzjxmGu9MX sTrC1gr9gwfsqjtvxpgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmJEV-00000009xtJ-3ghv; Mon, 18 Mar 2024 20:05:20 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmJDs-00000009xLO-1FE8 for linux-arm-kernel@bombadil.infradead.org; Mon, 18 Mar 2024 20:04:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=JXDMCLhq+SpXi29RlzCNqEUhIAFpzfV1ImIXAFsvuS0=; b=SxmSNGQiearCbIxr5/3wJeAJLi XpMf88LOw7DXSU4DVlIqPL9pAYopIpQiaRRcTS1I/DK5916BalxmDlkmy3HulrRT//gO81yCQhT0+ 3MbhNL7mTx8jeqAhMelXcgm9OM6nD2abEGHh2JgllFioMc7x/ewMlnWGxJKoEnkhf5kdvrGCCivvd D3g3Sb0eyh5Gtb6o4k0FqBIFuSpmqj5LhwX02Moqp5e2185F51lHtCALwO70dDPc9J56SO5UCw9/A NonjjBqBGo7h+ZqiYgqpG9pTENpr38sGRjKz70pE7vFqqqXXsAbPaCpQO7YLKIo0OY9TyzDM8eEEq Qm1Kn5hA==; Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmJDl-0000000Cp5H-1Ke4 for linux-arm-kernel@lists.infradead.org; Mon, 18 Mar 2024 20:04:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710792269; h=from:from: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; bh=JXDMCLhq+SpXi29RlzCNqEUhIAFpzfV1ImIXAFsvuS0=; b=B6o8mPGZAywSLNnVx1wf8uB8J2Qi0hm7+sL992HCsi3nMSIwlIUeHOWhN0YSA3kEe6TMOy GWeguzk/pUcFIcy3GpY/HCQ0Qrx480cTznfd7Qs63cXajGuZiHp0+leOpVwEFNchEFinke 0aYrB9bQSDalyEhMbmjuDRqM0VU3b8Q= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710792270; h=from:from: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; bh=JXDMCLhq+SpXi29RlzCNqEUhIAFpzfV1ImIXAFsvuS0=; b=Bo8/0PP45nLseXwkWMWJhZ4KoLnvMhuEiE8edqp/SgGS3SL/C4DOQTYoAU15bm0yHPgKJH bSCEAXKTv4fy5qGQAqMA6OCpP90mHXgj3ZYNZabT5GjPjPbkS8SN4Um1mBh47KWXovacI0 5tJCapvE0PvvL3Wm0p1fDLVHhHuQRCQ= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-9-M8Env9KOPMmXXaUZZ50Rng-1; Mon, 18 Mar 2024 16:04:27 -0400 X-MC-Unique: M8Env9KOPMmXXaUZZ50Rng-1 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-42f30752eb4so15657111cf.1 for ; Mon, 18 Mar 2024 13:04:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710792266; x=1711397066; 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=JXDMCLhq+SpXi29RlzCNqEUhIAFpzfV1ImIXAFsvuS0=; b=H/ndPCWG0w+e4H3jk7x/3lngvzFuyHegzMNf9i6MGy0YL8rJobm8bj3avHSg0oBET3 XG5X2f6MmoI+LPK+GQcgzzmQJIemCxf7XHiFiU0FuoBzTF2NMv/f9nt4w7Cyg2WpRhQK O9iamKYfBSBb1JEfmTJf5D1U6D++RIkVupw0Au88pfKQumWULTEDV63jV5zdPpWRk7/J o4iDG8+OmYHElwNLAJfO/Tv5Hic2M2f6loyJzXlAD/wmcGRUWGxKchMgjoTKDNh6kdBf 5HkMxC1p1iJc+DqDxCAVzfSJylNu3hzTdp/VaBuRZxtfzDEO/kyD9vOpyf6qOETfxJu0 7Q8g== X-Forwarded-Encrypted: i=1; AJvYcCXNPgQf6Z8X81z+8fCIkHQpGl526ACkx0bLxekv/spNIbxrr6hy1T1sW+Vr+VaIaxLS4BVtxoOaZHcCfhmhHoSRD3XrBiBq73+RTONKK4F4VVJv4hY= X-Gm-Message-State: AOJu0YwPcqh6/NHkY73rMlLKGbTORnzXIAg8K6xcXP/YNla9dWfk5fGT 1AppS1yAUPfjr6iIGEuSjbnZFiJjU49yQvS/viDmyWoTwK623g9jULR2o/sWwqGBQO0mYKlWwlM 9i+HQz7uvLmxQaxcFiBgPtFkqxvBiCyrZdqKyPcHIgIrJnhH8oCNwVuLUcSnl3yOS8cbDUERR X-Received: by 2002:ac8:5f91:0:b0:430:c2dc:a5ef with SMTP id j17-20020ac85f91000000b00430c2dca5efmr447849qta.2.1710792266522; Mon, 18 Mar 2024 13:04:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBYHTFmkqNiU+ToXou6wXh4FVDhWI9gJPxxfj+3GqwNDwAz7q/kbYXHDobvjaQIuNomZFyOQ== X-Received: by 2002:ac8:5f91:0:b0:430:c2dc:a5ef with SMTP id j17-20020ac85f91000000b00430c2dca5efmr447812qta.2.1710792266091; Mon, 18 Mar 2024 13:04:26 -0700 (PDT) Received: from x1n.. ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id hj10-20020a05622a620a00b0042ebbc1196fsm3484491qtb.87.2024.03.18.13.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 13:04:25 -0700 (PDT) From: peterx@redhat.com To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , x86@kernel.org, Muchun Song , Mike Rapoport , Matthew Wilcox , sparclinux@vger.kernel.org, Jason Gunthorpe , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , linux-arm-kernel@lists.infradead.org, peterx@redhat.com, Mark Salter , Catalin Marinas , Will Deacon , Russell King , Shawn Guo , Krzysztof Kozlowski , Bjorn Andersson , Arnd Bergmann , Konrad Dybcio , Fabio Estevam Subject: [PATCH v2 13/14] mm/arm: Remove pmd_thp_or_huge() Date: Mon, 18 Mar 2024 16:04:03 -0400 Message-ID: <20240318200404.448346-14-peterx@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240318200404.448346-1-peterx@redhat.com> References: <20240318200404.448346-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240318_200435_622343_60259DF8 X-CRM114-Status: GOOD ( 18.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peter Xu ARM/ARM64 used to define pmd_thp_or_huge(). Now this macro is completely redundant. Remove it and use pmd_leaf(). Cc: Mark Salter Cc: Catalin Marinas Cc: Will Deacon 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/include/asm/pgtable-2level.h | 1 - arch/arm/include/asm/pgtable-3level.h | 1 - arch/arm/lib/uaccess_with_memcpy.c | 4 ++-- arch/arm64/include/asm/pgtable.h | 2 -- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h index 4245c2e74720..6b5392e20f41 100644 --- a/arch/arm/include/asm/pgtable-2level.h +++ b/arch/arm/include/asm/pgtable-2level.h @@ -241,7 +241,6 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr) * define empty stubs for use by pin_page_for_write. */ #define pmd_hugewillfault(pmd) (0) -#define pmd_thp_or_huge(pmd) (0) #endif /* __ASSEMBLY__ */ diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h index 9e3c44f0aea2..fa5939eb9864 100644 --- a/arch/arm/include/asm/pgtable-3level.h +++ b/arch/arm/include/asm/pgtable-3level.h @@ -190,7 +190,6 @@ static inline pte_t pte_mkspecial(pte_t pte) #define pmd_dirty(pmd) (pmd_isset((pmd), L_PMD_SECT_DIRTY)) #define pmd_hugewillfault(pmd) (!pmd_young(pmd) || !pmd_write(pmd)) -#define pmd_thp_or_huge(pmd) (pmd_leaf(pmd) || pmd_trans_huge(pmd)) #ifdef CONFIG_TRANSPARENT_HUGEPAGE #define pmd_trans_huge(pmd) (pmd_val(pmd) && !pmd_table(pmd)) diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c index 2f6163f05e93..c0ac7796d775 100644 --- a/arch/arm/lib/uaccess_with_memcpy.c +++ b/arch/arm/lib/uaccess_with_memcpy.c @@ -56,10 +56,10 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) * to see that it's still huge and whether or not we will * need to fault on write. */ - if (unlikely(pmd_thp_or_huge(*pmd))) { + if (unlikely(pmd_leaf(*pmd))) { ptl = ¤t->mm->page_table_lock; spin_lock(ptl); - if (unlikely(!pmd_thp_or_huge(*pmd) + if (unlikely(!pmd_leaf(*pmd) || pmd_hugewillfault(*pmd))) { spin_unlock(ptl); return 0; diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index c4efa47fed5f..a580068a6564 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -512,8 +512,6 @@ static inline pmd_t pmd_mkinvalid(pmd_t pmd) return pmd; } -#define pmd_thp_or_huge(pmd) (pmd_leaf(pmd) || pmd_trans_huge(pmd)) - #define pmd_write(pmd) pte_write(pmd_pte(pmd)) #define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT))