Skip to contentSkip to conversation

x86 : omit duplicate processing at pte_pgprot()

PATCH In review [email protected] 2 participants 2 messages Aug 9, 2009 – Aug 15, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86 : omit duplicate processing at pte_pgprot()

I suggest following PATCH that omit duplicate processing of mask.

pte_pgprot() macro [arch/x86/include/asm/pgtable.h] call pte_flags() [arch/x86/include/asm/pgtable_types.h] that return value is masked by PTE_FLAGS_MASK in pte_flags() function, and this macro also masks the returned value by PTE_FLAGS_MASK.

I guess that we don't have to do the mask processing at pte_pgprot() macro because it has already been masked at pte_flags(). So, how about the following PATCH ?

<Hiroyasu OHYAMA>

arch/x86/include/asm/pgtable.h +0 -0
index 3cc06e3..a0b454c 100644
@@ -265,7 +265,7 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
        return __pgprot(preservebits | addbits);
         }
 
         -#define pte_pgprot(x) __pgprot(pte_flags(x) & PTE_FLAGS_MASK)
         +#define pte_pgprot(x) __pgprot(pte_flags(x))
 
          #define canon_pgprot(p) __pgprot(massage_pgprot(p))
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · On 08/09/09 08:43, [email protected] wrote:

I suggest following PATCH that omit duplicate processing of mask.

pte_pgprot() macro [arch/x86/include/asm/pgtable.h] call pte_flags() [arch/x86/include/asm/pgtable_types.h] that return value is masked by PTE_FLAGS_MASK in pte_flags() function, and this macro also masks the returned value by PTE_FLAGS_MASK.

It probably won't make any difference in practice, because gcc will do a common subexpression elimination for the "& PTE_FLAGS_MASK" between the inline function and its caller. But it does tidy things up a bit.

Quoted 5 lines

I guess that we don't have to do the mask processing at pte_pgprot() macro because it has already been masked at pte_flags(). So, how about the following PATCH ?

<Hiroyasu OHYAMA>

Please add a proper Signed-off-by: line.

J

Quoted 19 lines
arch/x86/include/asm/pgtable.h +0 -1
index 3cc06e3..a0b454c 100644
@@ -265,7 +265,7 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
        return __pgprot(preservebits | addbits);
         }
 
         -#define pte_pgprot(x) __pgprot(pte_flags(x) & PTE_FLAGS_MASK)
         +#define pte_pgprot(x) __pgprot(pte_flags(x))
 
          #define canon_pgprot(p) __pgprot(massage_pgprot(p))
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/