From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC27030566A for ; Fri, 24 Jul 2026 01:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784856924; cv=none; b=ZK1sglemTNqsrIdrDJ5OrFub2mUTmCUXmrq3GwQEVZZbRlsuIemEKjU9YyubMEGfyXnPBpGRFcRjHV/aEWILBOf+VtDeom/wuAxmZGODz6y7Kc8KRUVoS0ooLyDNa5SoT/qCz0azHKBGJZORebE1lQHa46RCHsq/y8XwXK6/EnY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784856924; c=relaxed/simple; bh=YFTEwD+SWfywdkGiZdfk/cAlFVzuABKh4ZAt5FV4B94=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qvSV8gLvde8iDspPc1nBSC3CuEa6Se3dOFqtxm1wvU5pLMZAE4EILgEvNbieHrZ1FJvODg04+JEXsRykeWiWgqSI8iu+7Ua/W+lf8B4KUlmXryRlHa0e3/cAU9kLxJaEPDO9QXd3+7QtEapm+9Dmq7f91zBFvaVkF3RG0pKj/dI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=N8haj5lD; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="N8haj5lD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784856921; 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=cOa/59JmCKeAYJ2ebD2ctA/PG5bDvtBZwPXhXKsPfUM=; b=N8haj5lDVNobB4NymCnMpopWNGu0WDbNByd4S/tlVKfgH0c6qk4qahDkygKXpl48fRRGNW sOCFCPncES2Pp7vy3DoPAtY190tjT9Lx/OLugLRiRVYdUDRB4+w/HXryFzZ4dvjtYsYbH8 nhPLNFXU6VobkxVm4ZZClYWcdAI/a1A= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-394-Az6f25ZYPI-ycQsqqY49EQ-1; Thu, 23 Jul 2026 21:35:18 -0400 X-MC-Unique: Az6f25ZYPI-ycQsqqY49EQ-1 X-Mimecast-MFC-AGG-ID: Az6f25ZYPI-ycQsqqY49EQ_1784856915 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0EE1F180A997; Fri, 24 Jul 2026 01:35:15 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.80.238]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6BE68180059A; Fri, 24 Jul 2026 01:35:11 +0000 (UTC) From: Luiz Capitulino To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, david@kernel.org, baolin.wang@linux.alibaba.com, ziy@nvidia.com, lance.yang@linux.dev Cc: corbet@lwn.net, tsbogend@alpha.franken.de, maddy@linux.ibm.com, mpe@ellerman.id.au, agordeev@linux.ibm.com, gerald.schaefer@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, x86@kernel.org, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, ira.weiny@intel.com, hughd@google.com, dave.hansen@linux.intel.com, djbw@kernel.org, vishal.l.verma@intel.com, dave.jiang@intel.com, akpm@linux-foundation.org, yintirui@huawei.com, ljs@kernel.org, dev.jain@arm.com Subject: [PATCH v6 09/14] powerpc: move has_transparent_hugepage() out of THP guard Date: Thu, 23 Jul 2026 21:34:13 -0400 Message-ID: <29b33d5aed6d788381f42cba9dcaeb8a83569790.1784856856.git.luizcap@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 has_transparent_hugepage() definition is guarded by CONFIG_TRANSPARENT_HUGEPAGE, but there's a need to use it when CONFIG_TRANSPARENT_HUGEPAGE=n. Move the definition out of the THP guard. Signed-off-by: Luiz Capitulino --- arch/powerpc/include/asm/book3s/64/hash-4k.h | 2 +- arch/powerpc/include/asm/book3s/64/hash-64k.h | 2 +- arch/powerpc/include/asm/book3s/64/pgtable.h | 18 +++++++++--------- arch/powerpc/include/asm/book3s/64/radix.h | 14 +++++++------- arch/powerpc/mm/book3s64/hash_pgtable.c | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h index 8e5bd9902bed..79511e6abfca 100644 --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h @@ -165,9 +165,9 @@ extern void hash__pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, extern pgtable_t hash__pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp); extern pmd_t hash__pmdp_huge_get_and_clear(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp); -extern int hash__has_transparent_hugepage(void); #endif +extern int hash__has_transparent_hugepage(void); #endif /* !__ASSEMBLER__ */ #endif /* _ASM_POWERPC_BOOK3S_64_HASH_4K_H */ diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h b/arch/powerpc/include/asm/book3s/64/hash-64k.h index 7deb3a66890b..a4a44a112ff9 100644 --- a/arch/powerpc/include/asm/book3s/64/hash-64k.h +++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h @@ -278,9 +278,9 @@ extern void hash__pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, extern pgtable_t hash__pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp); extern pmd_t hash__pmdp_huge_get_and_clear(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp); -extern int hash__has_transparent_hugepage(void); #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +extern int hash__has_transparent_hugepage(void); #endif /* __ASSEMBLER__ */ #endif /* _ASM_POWERPC_BOOK3S_64_HASH_64K_H */ diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index f4db7d7fbd5c..2a795f6d9263 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -1121,15 +1121,6 @@ static inline void update_mmu_cache_pud(struct vm_area_struct *vma, { } -extern int hash__has_transparent_hugepage(void); -static inline int has_transparent_hugepage(void) -{ - if (radix_enabled()) - return radix__has_transparent_hugepage(); - return hash__has_transparent_hugepage(); -} -#define has_transparent_hugepage has_transparent_hugepage - static inline int has_transparent_pud_hugepage(void) { if (radix_enabled()) @@ -1441,6 +1432,15 @@ static inline bool arch_needs_pgtable_deposit(void) #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +extern int hash__has_transparent_hugepage(void); +static inline int has_transparent_hugepage(void) +{ + if (radix_enabled()) + return radix__has_transparent_hugepage(); + return hash__has_transparent_hugepage(); +} +#define has_transparent_hugepage has_transparent_hugepage + #define __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION pte_t ptep_modify_prot_start(struct vm_area_struct *, unsigned long, pte_t *); void ptep_modify_prot_commit(struct vm_area_struct *, unsigned long, diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h index da954e779744..50545cf519bd 100644 --- a/arch/powerpc/include/asm/book3s/64/radix.h +++ b/arch/powerpc/include/asm/book3s/64/radix.h @@ -298,22 +298,22 @@ extern pmd_t radix__pmdp_huge_get_and_clear(struct mm_struct *mm, pud_t radix__pudp_huge_get_and_clear(struct mm_struct *mm, unsigned long addr, pud_t *pudp); -static inline int radix__has_transparent_hugepage(void) +static inline int radix__has_transparent_pud_hugepage(void) { - /* For radix 2M at PMD level means thp */ - if (mmu_psize_defs[MMU_PAGE_2M].shift == PMD_SHIFT) + /* For radix 1G at PUD level means pud hugepage support */ + if (mmu_psize_defs[MMU_PAGE_1G].shift == PUD_SHIFT) return 1; return 0; } +#endif -static inline int radix__has_transparent_pud_hugepage(void) +static inline int radix__has_transparent_hugepage(void) { - /* For radix 1G at PUD level means pud hugepage support */ - if (mmu_psize_defs[MMU_PAGE_1G].shift == PUD_SHIFT) + /* For radix 2M at PMD level means thp */ + if (mmu_psize_defs[MMU_PAGE_2M].shift == PMD_SHIFT) return 1; return 0; } -#endif struct vmem_altmap; struct dev_pagemap; diff --git a/arch/powerpc/mm/book3s64/hash_pgtable.c b/arch/powerpc/mm/book3s64/hash_pgtable.c index d9b5b751d7b7..50316f3fc5d3 100644 --- a/arch/powerpc/mm/book3s64/hash_pgtable.c +++ b/arch/powerpc/mm/book3s64/hash_pgtable.c @@ -391,6 +391,8 @@ pmd_t hash__pmdp_huge_get_and_clear(struct mm_struct *mm, return old_pmd; } +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ + int hash__has_transparent_hugepage(void) { @@ -422,8 +424,6 @@ int hash__has_transparent_hugepage(void) } EXPORT_SYMBOL_GPL(hash__has_transparent_hugepage); -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ - #ifdef CONFIG_STRICT_KERNEL_RWX struct change_memory_parms { -- 2.55.0