[RFC PATCH 7/9] powerpc/mm/book3s-64: Shuffle read, write, execute and user bits in PTE

Michael Ellerman mpe at ellerman.id.au
Mon Feb 22 11:27:36 AEDT 2016


On Mon, 2016-02-22 at 09:36 +1100, Paul Mackerras wrote:
> On Sun, Feb 21, 2016 at 01:00:54PM +0530, Aneesh Kumar K.V wrote:
> > Paul Mackerras <paulus at samba.org> writes:
> >
> > Also can you use constants like
> > #define _PAGE_USER PPC_BIT(60)
>
> I'd really rather not - that is harder for the casual reader to parse,
> because they then have to go off and find out what exactly PPC_BIT
> does.  The only time that using PPC_BIT would help is when checking
> that the bit definitions match the Power ISA, and that's presumably
> done by intelligent people that can handle backwards bit numbering in
> their heads. :)

Yep agree 100%.

Using PPC_BIT() means every time someone sees that defintion they need to think
about what the conversion is and whether it's right, ie. for the entire future
history of this code.

On the other hand not using PPC_BIT() means the person who writes the
definition needs to think about it and do the correct conversion, but only
once.

cheers



More information about the Linuxppc-dev mailing list