On Wed, 2016-06-01 at 15:13 -0700, Ram Pai wrote: > On Tue, May 31, 2016 at 04:29:42PM +0530, Aneesh Kumar K.V wrote: > > diff --git a/arch/powerpc/include/asm/book3s/64/pgtable-4k.h > > b/arch/powerpc/include/asm/book3s/64/pgtable-4k.h > > index 71e9abced493..9db83b4e017d 100644 > > --- a/arch/powerpc/include/asm/book3s/64/pgtable-4k.h > > +++ b/arch/powerpc/include/asm/book3s/64/pgtable-4k.h > > @@ -31,7 +31,7 @@ static inline int pgd_huge(pgd_t pgd) > > * leaf pte for huge page > > */ > > if (radix_enabled()) > > - return !!(pgd_val(pgd) & _PAGE_PTE); > > + return !!(pgd_raw(pgd) & cpu_to_be64(_PAGE_PTE)); > > pgd_raw() will not do the endian swapping. > But instead cpu_to_be64(_PAGE_PTE) will now do the endian swapping. So does it > really optimize anything? i tend to think it just moves the endian > swapping overhead from one place to the other. no?
> Is cpu_to_be64(constant) faster than cpu_to_be64(variable) ? Yes, the compiler will do it at compile time for constants, or anything it can prove is a constant. You can also see from the asm dump that Aneesh posted that it drastically improves the generated code. cheers _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev