2024-03-01 08:58:57

by Kunwu Chan

[permalink] [raw]
Subject: [PATCH v2] powerpc/mm: Code cleanup for __hash_page_thp

This part was commented from commit 6d492ecc6489
("powerpc/THP: Add code to handle HPTE faults for hugepages")
in about 11 years before.

If there are no plans to enable this part code in the future,
we can remove this dead code and replace with a comment
explaining what the dead code was trying to say.

Signed-off-by: Kunwu Chan <[email protected]>
Suggested-by: Michael Ellerman <[email protected]>
Suggested-by: Aneesh Kumar K.V <[email protected]>
---
Changes to v2:
- Replace dead code with a comment as Michael Ellerman said in https://lore.kernel.org/all/[email protected]/#R
- Improve commit msg
---
arch/powerpc/mm/book3s64/hash_hugepage.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/mm/book3s64/hash_hugepage.c b/arch/powerpc/mm/book3s64/hash_hugepage.c
index c0fabe6c5a12..15d6f3ea7178 100644
--- a/arch/powerpc/mm/book3s64/hash_hugepage.c
+++ b/arch/powerpc/mm/book3s64/hash_hugepage.c
@@ -59,16 +59,13 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,

rflags = htab_convert_pte_flags(new_pmd, flags);

-#if 0
- if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) {
+ /*
+ * THPs are only supported on platforms that can do mixed page size
+ * segments (MPSS) and all such platforms have coherent icache. Hence we
+ * don't need to do lazy icache flush (hash_page_do_lazy_icache()) on
+ * noexecute fault.
+ */

- /*
- * No CPU has hugepages but lacks no execute, so we
- * don't need to worry about that case
- */
- rflags = hash_page_do_lazy_icache(rflags, __pte(old_pte), trap);
- }
-#endif
/*
* Find the slot index details for this ea, using base page size.
*/
--
2.39.2



2024-03-13 13:28:02

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH v2] powerpc/mm: Code cleanup for __hash_page_thp

On Fri, 01 Mar 2024 16:58:34 +0800, Kunwu Chan wrote:
> This part was commented from commit 6d492ecc6489
> ("powerpc/THP: Add code to handle HPTE faults for hugepages")
> in about 11 years before.
>
> If there are no plans to enable this part code in the future,
> we can remove this dead code and replace with a comment
> explaining what the dead code was trying to say.
>
> [...]

Applied to powerpc/next.

[1/1] powerpc/mm: Code cleanup for __hash_page_thp
https://git.kernel.org/powerpc/c/d9cf600ecb7b053345aa76c1988cf374260cfdaf

cheers