linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc/nohash: Remove pgd_huge() stub
@ 2022-09-07  9:34 Christophe Leroy
  2022-09-07  9:34 ` [PATCH 2/2] powerpc: Rely on generic definition of hugepd_t and is_hugepd when unused Christophe Leroy
  2022-10-04 13:24 ` [PATCH 1/2] powerpc/nohash: Remove pgd_huge() stub Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe Leroy @ 2022-09-07  9:34 UTC (permalink / raw)
  To: linux-mm @ kvack . org, Michael Ellerman, Nicholas Piggin
  Cc: Christophe Leroy, linux-kernel, linuxppc-dev

linux/hugetlb.h has a fallback pgd_huge() macro for when
pgd_huge is not defined.

Remove the powerpc redundant definitions.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/include/asm/nohash/pgtable.h | 6 ------
 arch/powerpc/include/asm/page.h           | 1 -
 2 files changed, 7 deletions(-)

diff --git a/arch/powerpc/include/asm/nohash/pgtable.h b/arch/powerpc/include/asm/nohash/pgtable.h
index b499da6c1a99..08429c612cdf 100644
--- a/arch/powerpc/include/asm/nohash/pgtable.h
+++ b/arch/powerpc/include/asm/nohash/pgtable.h
@@ -277,12 +277,6 @@ static inline int pud_huge(pud_t pud)
 	return 0;
 }
 
-static inline int pgd_huge(pgd_t pgd)
-{
-	return 0;
-}
-#define pgd_huge		pgd_huge
-
 #define is_hugepd(hpd)		(hugepd_ok(hpd))
 #endif
 
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index e5f75c70eda8..c67eb9531a3f 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -311,7 +311,6 @@ static inline bool pfn_valid(unsigned long pfn)
 
 #ifndef CONFIG_HUGETLB_PAGE
 #define is_hugepd(pdep)		(0)
-#define pgd_huge(pgd)		(0)
 #endif /* CONFIG_HUGETLB_PAGE */
 
 struct page;
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] powerpc: Rely on generic definition of hugepd_t and is_hugepd when unused
  2022-09-07  9:34 [PATCH 1/2] powerpc/nohash: Remove pgd_huge() stub Christophe Leroy
@ 2022-09-07  9:34 ` Christophe Leroy
  2022-10-04 13:24 ` [PATCH 1/2] powerpc/nohash: Remove pgd_huge() stub Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2022-09-07  9:34 UTC (permalink / raw)
  To: linux-mm @ kvack . org, Michael Ellerman, Nicholas Piggin
  Cc: Christophe Leroy, linux-kernel, linuxppc-dev

CONFIG_ARCH_HAS_HUGEPD is used to tell core mm when huge page
directories are used.

When they are not used, no need to provide hugepd_t or is_hugepd(),
just rely on the core mm fallback definition.

For that, change core mm behaviour so that CONFIG_ARCH_HAS_HUGEPD
is used instead of indirect is_hugepd macro existence.

powerpc being the only user of huge page directories, there is no
impact on other architectures.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/include/asm/page.h             | 5 -----
 arch/powerpc/include/asm/pgtable-be-types.h | 2 ++
 arch/powerpc/include/asm/pgtable-types.h    | 2 ++
 include/linux/hugetlb.h                     | 2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index c67eb9531a3f..7f20636d13ed 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -308,11 +308,6 @@ static inline bool pfn_valid(unsigned long pfn)
 #include <asm/pgtable-types.h>
 #endif
 
-
-#ifndef CONFIG_HUGETLB_PAGE
-#define is_hugepd(pdep)		(0)
-#endif /* CONFIG_HUGETLB_PAGE */
-
 struct page;
 extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
 extern void copy_user_page(void *to, void *from, unsigned long vaddr,
diff --git a/arch/powerpc/include/asm/pgtable-be-types.h b/arch/powerpc/include/asm/pgtable-be-types.h
index b169bbf95fcb..82633200b500 100644
--- a/arch/powerpc/include/asm/pgtable-be-types.h
+++ b/arch/powerpc/include/asm/pgtable-be-types.h
@@ -101,6 +101,7 @@ static inline bool pmd_xchg(pmd_t *pmdp, pmd_t old, pmd_t new)
 	return pmd_raw(old) == prev;
 }
 
+#ifdef CONFIG_ARCH_HAS_HUGEPD
 typedef struct { __be64 pdbe; } hugepd_t;
 #define __hugepd(x) ((hugepd_t) { cpu_to_be64(x) })
 
@@ -108,5 +109,6 @@ static inline unsigned long hpd_val(hugepd_t x)
 {
 	return be64_to_cpu(x.pdbe);
 }
+#endif
 
 #endif /* _ASM_POWERPC_PGTABLE_BE_TYPES_H */
diff --git a/arch/powerpc/include/asm/pgtable-types.h b/arch/powerpc/include/asm/pgtable-types.h
index efed0db7b1db..082c85cc09b1 100644
--- a/arch/powerpc/include/asm/pgtable-types.h
+++ b/arch/powerpc/include/asm/pgtable-types.h
@@ -83,11 +83,13 @@ static inline bool pte_xchg(pte_t *ptep, pte_t old, pte_t new)
 }
 #endif
 
+#ifdef CONFIG_ARCH_HAS_HUGEPD
 typedef struct { unsigned long pd; } hugepd_t;
 #define __hugepd(x) ((hugepd_t) { (x) })
 static inline unsigned long hpd_val(hugepd_t x)
 {
 	return x.pd;
 }
+#endif
 
 #endif /* _ASM_POWERPC_PGTABLE_TYPES_H */
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 3ec981a0d8b3..1ec1535be04f 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -17,7 +17,7 @@ struct ctl_table;
 struct user_struct;
 struct mmu_gather;
 
-#ifndef is_hugepd
+#ifndef CONFIG_ARCH_HAS_HUGEPD
 typedef struct { unsigned long pd; } hugepd_t;
 #define is_hugepd(hugepd) (0)
 #define __hugepd(x) ((hugepd_t) { (x) })
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] powerpc/nohash: Remove pgd_huge() stub
  2022-09-07  9:34 [PATCH 1/2] powerpc/nohash: Remove pgd_huge() stub Christophe Leroy
  2022-09-07  9:34 ` [PATCH 2/2] powerpc: Rely on generic definition of hugepd_t and is_hugepd when unused Christophe Leroy
@ 2022-10-04 13:24 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2022-10-04 13:24 UTC (permalink / raw)
  To: linux-mm @ kvack . org, Nicholas Piggin, Christophe Leroy,
	Michael Ellerman
  Cc: linux-kernel, linuxppc-dev

On Wed, 7 Sep 2022 11:34:44 +0200, Christophe Leroy wrote:
> linux/hugetlb.h has a fallback pgd_huge() macro for when
> pgd_huge is not defined.
> 
> Remove the powerpc redundant definitions.
> 
> 

Applied to powerpc/next.

[1/2] powerpc/nohash: Remove pgd_huge() stub
      https://git.kernel.org/powerpc/c/a26494cf4aeb8e9888428a43f55cc486f06f1334
[2/2] powerpc: Rely on generic definition of hugepd_t and is_hugepd when unused
      https://git.kernel.org/powerpc/c/691cdf016d3be6f66a3ea384809be229e0f9c590

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-04 13:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07  9:34 [PATCH 1/2] powerpc/nohash: Remove pgd_huge() stub Christophe Leroy
2022-09-07  9:34 ` [PATCH 2/2] powerpc: Rely on generic definition of hugepd_t and is_hugepd when unused Christophe Leroy
2022-10-04 13:24 ` [PATCH 1/2] powerpc/nohash: Remove pgd_huge() stub Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).