# Re: \[PATCH\] powerpc/mm: Code cleanup for \_\_hash\_page\_thp

- From: Kunwu Chan \<hidden\>
- Date: 2024-02-27 03:14:43 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2024/02/2512374
- Thread: https://ratatoskr.run/linuxppc-dev/2024/01/2471386/t.md

```text
Thanks for the reply.

On 2024/2/26 18:49, Michael Ellerman wrote:
> Kunwu Chan [ref] writes:
>> 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.
>
> I agree the code can go. But I'd like it to be replaced with a comment
> explaining what the dead code was trying to say.
Thanks, i'll update a new patch with the following comment:
    /*
    * No CPU has hugepages but lacks no execute, so we
    * don't need to worry about cpu no CPU_FTR_COHERENT_ICACHE feature case
    */

>
> cheers
>
>> diff --git a/arch/powerpc/mm/book3s64/hash_hugepage.c b/arch/powerpc/mm/book3s64/hash_hugepage.c
>> index c0fabe6c5a12..127a3a2c174b 100644
>> --- a/arch/powerpc/mm/book3s64/hash_hugepage.c
>> +++ b/arch/powerpc/mm/book3s64/hash_hugepage.c
>> @@ -59,16 +59,6 @@ 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)) {
>> -
>> -		/*
>> -		 * 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
-- 
Thanks,
  Kunwu

```
