[Resend] [Hugetlb x86] 1/3 Add pte_huge() macro

From: Adam Litke (agl_at_us.ibm.com)
Date: 08/26/05

  • Next message: Adam Litke: "[Resend] [Hugetlb x86] 3/3 Check p?d_present in huge_pte_offset()"
    To: akpm@osdl.org
    Date:	Fri, 26 Aug 2005 09:08:47 -0500
    
    

    Fixed whitespace issue in asm-x86_64/pgtable.h

    Initial Post (Wed, 17 Aug 2005)

    This patch adds a macro pte_huge(pte) for i386/x86_64 which is needed by a
    patch later in the series. Instead of repeating (_PAGE_PRESENT | _PAGE_PSE),
    I've added __LARGE_PTE to i386 to match x86_64.

    Diffed against 2.6.13-rc6-git7

    Signed-off-by: Adam Litke <agl@us.ibm.com>

    ---
     asm-i386/pgtable.h   |    4 +++-
     asm-x86_64/pgtable.h |    3 ++-
     2 files changed, 5 insertions(+), 2 deletions(-)
    diff -upN reference/include/asm-i386/pgtable.h current/include/asm-i386/pgtable.h
    --- reference/include/asm-i386/pgtable.h
    +++ current/include/asm-i386/pgtable.h
    @@ -215,11 +215,13 @@ extern unsigned long pg0[];
      * The following only work if pte_present() is true.
      * Undefined behaviour if not..
      */
    +#define __LARGE_PTE (_PAGE_PSE | _PAGE_PRESENT)
     static inline int pte_user(pte_t pte)		{ return (pte).pte_low & _PAGE_USER; }
     static inline int pte_read(pte_t pte)		{ return (pte).pte_low & _PAGE_USER; }
     static inline int pte_dirty(pte_t pte)		{ return (pte).pte_low & _PAGE_DIRTY; }
     static inline int pte_young(pte_t pte)		{ return (pte).pte_low & _PAGE_ACCESSED; }
     static inline int pte_write(pte_t pte)		{ return (pte).pte_low & _PAGE_RW; }
    +static inline int pte_huge(pte_t pte)		{ return ((pte).pte_low & __LARGE_PTE) == __LARGE_PTE; }
     
     /*
      * The following only works if pte_present() is not true.
    @@ -236,7 +238,7 @@ static inline pte_t pte_mkexec(pte_t pte
     static inline pte_t pte_mkdirty(pte_t pte)	{ (pte).pte_low |= _PAGE_DIRTY; return pte; }
     static inline pte_t pte_mkyoung(pte_t pte)	{ (pte).pte_low |= _PAGE_ACCESSED; return pte; }
     static inline pte_t pte_mkwrite(pte_t pte)	{ (pte).pte_low |= _PAGE_RW; return pte; }
    -static inline pte_t pte_mkhuge(pte_t pte)	{ (pte).pte_low |= _PAGE_PRESENT | _PAGE_PSE; return pte; }
    +static inline pte_t pte_mkhuge(pte_t pte)	{ (pte).pte_low |= __LARGE_PTE; return pte; }
     
     #ifdef CONFIG_X86_PAE
     # include <asm/pgtable-3level.h>
    diff -upN reference/include/asm-x86_64/pgtable.h current/include/asm-x86_64/pgtable.h
    --- reference/include/asm-x86_64/pgtable.h
    +++ current/include/asm-x86_64/pgtable.h
    @@ -247,6 +247,7 @@ static inline pte_t pfn_pte(unsigned lon
      * The following only work if pte_present() is true.
      * Undefined behaviour if not..
      */
    +#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
     static inline int pte_user(pte_t pte)		{ return pte_val(pte) & _PAGE_USER; }
     extern inline int pte_read(pte_t pte)		{ return pte_val(pte) & _PAGE_USER; }
     extern inline int pte_exec(pte_t pte)		{ return pte_val(pte) & _PAGE_USER; }
    @@ -254,8 +255,8 @@ extern inline int pte_dirty(pte_t pte)		
     extern inline int pte_young(pte_t pte)		{ return pte_val(pte) & _PAGE_ACCESSED; }
     extern inline int pte_write(pte_t pte)		{ return pte_val(pte) & _PAGE_RW; }
     static inline int pte_file(pte_t pte)		{ return pte_val(pte) & _PAGE_FILE; }
    +static inline int pte_huge(pte_t pte)		{ return (pte_val(pte) & __LARGE_PTE) == __LARGE_PTE; }
     
    -#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
     extern inline pte_t pte_rdprotect(pte_t pte)	{ set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
     extern inline pte_t pte_exprotect(pte_t pte)	{ set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
     extern inline pte_t pte_mkclean(pte_t pte)	{ set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Adam Litke: "[Resend] [Hugetlb x86] 3/3 Check p?d_present in huge_pte_offset()"

    Relevant Pages

    • Re: [PATCH] I/O space write barrier
      ... instead of repeating this nice but pretty lengthy ... > Guennadi Liakhovetski ... patch to qla1280 should be ready for inclusion therein also. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [Hugetlb x86] 1/3 Add pte_huge() macro
      ... patch later in the series. ... Instead of repeating, ... Undefined behaviour if not.. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [parisc-linux] Re: [PATCH 3/9] mm: parisc pte atomicity
      ... using your own tmpalias area sounds much better than getting ... I've simply not wrapped my head around the races, ... it looks like we agree that my patch is necessary and valid as is; ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: keyboard - was: Re: Linux 2.6.0-test4
      ... >> I was able to get the key unstuck by switching back and forth between ... I rebuild my kernel including your patch; ... I'll get back to you once I verify that the problem doesn't occur ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.0-test8/test9 io scheduler needs tuning?
      ... interactivity with regard to desktop use. ... Going to improve the time info output of the ddd loops to get better data and ... with the patch the hang reported earlier was not encountered again so ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)