All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm/hash: Code cleanup
@ 2024-01-25  9:46 Kunwu Chan
  2024-01-25 13:47 ` Aneesh Kumar K.V
  0 siblings, 1 reply; 3+ messages in thread
From: Kunwu Chan @ 2024-01-25  9:46 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: linuxppc-dev, linux-kernel, Kunwu Chan

This part was commented in about 17 years before.
If there are no plans to enable this part code in the future,
we can remove this dead code.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
 arch/powerpc/include/asm/book3s/64/mmu-hash.h | 22 -------------------
 1 file changed, 22 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
index 1c4eebbc69c9..d39ec7134a78 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
@@ -731,26 +731,6 @@ struct hash_mm_context {
 #endif /* CONFIG_PPC_SUBPAGE_PROT */
 };
 
-#if 0
-/*
- * The code below is equivalent to this function for arguments
- * < 2^VSID_BITS, which is all this should ever be called
- * with.  However gcc is not clever enough to compute the
- * modulus (2^n-1) without a second multiply.
- */
-#define vsid_scramble(protovsid, size) \
-	((((protovsid) * VSID_MULTIPLIER_##size) % VSID_MODULUS_##size))
-
-/* simplified form avoiding mod operation */
-#define vsid_scramble(protovsid, size) \
-	({								 \
-		unsigned long x;					 \
-		x = (protovsid) * VSID_MULTIPLIER_##size;		 \
-		x = (x >> VSID_BITS_##size) + (x & VSID_MODULUS_##size); \
-		(x + ((x+1) >> VSID_BITS_##size)) & VSID_MODULUS_##size; \
-	})
-
-#else /* 1 */
 static inline unsigned long vsid_scramble(unsigned long protovsid,
 				  unsigned long vsid_multiplier, int vsid_bits)
 {
@@ -764,8 +744,6 @@ static inline unsigned long vsid_scramble(unsigned long protovsid,
 	return (vsid + ((vsid + 1) >> vsid_bits)) & vsid_modulus;
 }
 
-#endif /* 1 */
-
 /* Returns the segment size indicator for a user address */
 static inline int user_segment_size(unsigned long addr)
 {
-- 
2.39.2


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

* Re: [PATCH] powerpc/mm/hash: Code cleanup
  2024-01-25  9:46 [PATCH] powerpc/mm/hash: Code cleanup Kunwu Chan
@ 2024-01-25 13:47 ` Aneesh Kumar K.V
  2024-01-26  1:51   ` Kunwu Chan
  0 siblings, 1 reply; 3+ messages in thread
From: Aneesh Kumar K.V @ 2024-01-25 13:47 UTC (permalink / raw)
  To: Kunwu Chan, mpe, npiggin, christophe.leroy, naveen.n.rao
  Cc: linuxppc-dev, linux-kernel

On 1/25/24 3:16 PM, Kunwu Chan wrote:
> This part was commented in about 17 years before.
> If there are no plans to enable this part code in the future,
> we can remove this dead code.
> 
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> ---
>  arch/powerpc/include/asm/book3s/64/mmu-hash.h | 22 -------------------
>  1 file changed, 22 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
> index 1c4eebbc69c9..d39ec7134a78 100644
> --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
> +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
> @@ -731,26 +731,6 @@ struct hash_mm_context {
>  #endif /* CONFIG_PPC_SUBPAGE_PROT */
>  };
>  
> -#if 0
> -/*
> - * The code below is equivalent to this function for arguments
> - * < 2^VSID_BITS, which is all this should ever be called
> - * with.  However gcc is not clever enough to compute the
> - * modulus (2^n-1) without a second multiply.
> - */
> -#define vsid_scramble(protovsid, size) \
> -	((((protovsid) * VSID_MULTIPLIER_##size) % VSID_MODULUS_##size))
> -
> -/* simplified form avoiding mod operation */
> -#define vsid_scramble(protovsid, size) \
> -	({								 \
> -		unsigned long x;					 \
> -		x = (protovsid) * VSID_MULTIPLIER_##size;		 \
> -		x = (x >> VSID_BITS_##size) + (x & VSID_MODULUS_##size); \
> -		(x + ((x+1) >> VSID_BITS_##size)) & VSID_MODULUS_##size; \
> -	})
> -
> -#else /* 1 */
>  static inline unsigned long vsid_scramble(unsigned long protovsid,
>  				  unsigned long vsid_multiplier, int vsid_bits)
>  {
> @@ -764,8 +744,6 @@ static inline unsigned long vsid_scramble(unsigned long protovsid,
>  	return (vsid + ((vsid + 1) >> vsid_bits)) & vsid_modulus;
>  }
>  
> -#endif /* 1 */
> -
>  /* Returns the segment size indicator for a user address */
>  static inline int user_segment_size(unsigned long addr)
>  {

That was done to make sure one can follow the actual compiled code better. 

-aneesh


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

* Re: [PATCH] powerpc/mm/hash: Code cleanup
  2024-01-25 13:47 ` Aneesh Kumar K.V
@ 2024-01-26  1:51   ` Kunwu Chan
  0 siblings, 0 replies; 3+ messages in thread
From: Kunwu Chan @ 2024-01-26  1:51 UTC (permalink / raw)
  To: Aneesh Kumar K.V, mpe, npiggin, christophe.leroy, naveen.n.rao
  Cc: linuxppc-dev, linux-kernel

On 2024/1/25 21:47, Aneesh Kumar K.V wrote:
> On 1/25/24 3:16 PM, Kunwu Chan wrote:
>> This part was commented in about 17 years before.
>> If there are no plans to enable this part code in the future,
>> we can remove this dead code.
>>
>> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
>> ---
>>   arch/powerpc/include/asm/book3s/64/mmu-hash.h | 22 -------------------
>>   1 file changed, 22 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
>> index 1c4eebbc69c9..d39ec7134a78 100644
>> --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
>> +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
>> @@ -731,26 +731,6 @@ struct hash_mm_context {
>>   #endif /* CONFIG_PPC_SUBPAGE_PROT */
>>   };
>>   
>> -#if 0
>> -/*
>> - * The code below is equivalent to this function for arguments
>> - * < 2^VSID_BITS, which is all this should ever be called
>> - * with.  However gcc is not clever enough to compute the
>> - * modulus (2^n-1) without a second multiply.
>> - */
>> -#define vsid_scramble(protovsid, size) \
>> -	((((protovsid) * VSID_MULTIPLIER_##size) % VSID_MODULUS_##size))
>> -
>> -/* simplified form avoiding mod operation */
>> -#define vsid_scramble(protovsid, size) \
>> -	({								 \
>> -		unsigned long x;					 \
>> -		x = (protovsid) * VSID_MULTIPLIER_##size;		 \
>> -		x = (x >> VSID_BITS_##size) + (x & VSID_MODULUS_##size); \
>> -		(x + ((x+1) >> VSID_BITS_##size)) & VSID_MODULUS_##size; \
>> -	})
>> -
>> -#else /* 1 */
>>   static inline unsigned long vsid_scramble(unsigned long protovsid,
>>   				  unsigned long vsid_multiplier, int vsid_bits)
>>   {
>> @@ -764,8 +744,6 @@ static inline unsigned long vsid_scramble(unsigned long protovsid,
>>   	return (vsid + ((vsid + 1) >> vsid_bits)) & vsid_modulus;
>>   }
>>   
>> -#endif /* 1 */
>> -
>>   /* Returns the segment size indicator for a user address */
>>   static inline int user_segment_size(unsigned long addr)
>>   {
> 
> That was done to make sure one can follow the actual compiled code better.
Thanks for your explanation. It's my bad.
> 
> -aneesh
> 
-- 
Thanks,
   Kunwu


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

end of thread, other threads:[~2024-01-26  1:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25  9:46 [PATCH] powerpc/mm/hash: Code cleanup Kunwu Chan
2024-01-25 13:47 ` Aneesh Kumar K.V
2024-01-26  1:51   ` Kunwu Chan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.