From: Michael Ellerman <mpe@ellerman•id.au>
To: Ram Pai <linuxram@us•ibm.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux•vnet.ibm.com>
Cc: benh@kernel•crashing.org, paulus@samba•org,
linuxppc-dev@lists•ozlabs.org
Subject: Re: [PATCH] powerpc/mm: use _raw variant of page table accessors
Date: Thu, 02 Jun 2016 17:44:46 +1000 [thread overview]
Message-ID: <1464853486.19646.8.camel@ellerman.id.au> (raw)
In-Reply-To: <20160601221311.GB5658@ram.oc3035372033.ibm.com>
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
next prev parent reply other threads:[~2016-06-02 7:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 10:59 [PATCH] powerpc/mm: use _raw variant of page table accessors Aneesh Kumar K.V
2016-06-01 22:13 ` Ram Pai
2016-06-02 7:44 ` Michael Ellerman [this message]
2016-06-03 5:34 ` Balbir Singh
2016-06-05 22:30 ` Benjamin Herrenschmidt
2016-06-06 5:33 ` Balbir Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464853486.19646.8.camel@ellerman.id.au \
--to=mpe@ellerman$(echo .)id.au \
--cc=aneesh.kumar@linux$(echo .)vnet.ibm.com \
--cc=benh@kernel$(echo .)crashing.org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=linuxram@us$(echo .)ibm.com \
--cc=paulus@samba$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox