From 772bb69313ec9939720bbee9681cda32f71a33b9 Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Sun, 13 Mar 2005 00:21:15 -0800 Subject: [PATCH] ptwalk: pud and pmd folded Nick Piggin's patch to fold away most of the pud and pmd levels when not required. Adjusted to define minimal pud_addr_end (in the 4LEVEL_HACK case too) and pmd_addr_end. Responsible for half of the savings. Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-generic/4level-fixup.h | 4 ++++ include/asm-generic/pgtable-nopmd.h | 5 +++++ include/asm-generic/pgtable-nopud.h | 5 +++++ include/asm-generic/pgtable.h | 4 ++++ 4 files changed, 18 insertions(+) (limited to 'include') diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h index 02675742f472..c20ec257ecc0 100644 --- a/include/asm-generic/4level-fixup.h +++ b/include/asm-generic/4level-fixup.h @@ -2,6 +2,7 @@ #define _4LEVEL_FIXUP_H #define __ARCH_HAS_4LEVEL_HACK +#define __PAGETABLE_PUD_FOLDED #define PUD_SIZE PGDIR_SIZE #define PUD_MASK PGDIR_MASK @@ -31,4 +32,7 @@ #define pud_free(x) do { } while (0) #define __pud_free_tlb(tlb, x) do { } while (0) +#undef pud_addr_end +#define pud_addr_end(addr, end) (end) + #endif diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h index b7714d41138c..c8d53ba20e19 100644 --- a/include/asm-generic/pgtable-nopmd.h +++ b/include/asm-generic/pgtable-nopmd.h @@ -5,6 +5,8 @@ #include +#define __PAGETABLE_PMD_FOLDED + /* * Having the pmd type consist of a pud gets the size right, and allows * us to conceptually access the pud entry that this pmd is folded into @@ -55,6 +57,9 @@ static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address) #define pmd_free(x) do { } while (0) #define __pmd_free_tlb(tlb, x) do { } while (0) +#undef pmd_addr_end +#define pmd_addr_end(addr, end) (end) + #endif /* __ASSEMBLY__ */ #endif /* _PGTABLE_NOPMD_H */ diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h index ffce31fef970..82e29f0ce467 100644 --- a/include/asm-generic/pgtable-nopud.h +++ b/include/asm-generic/pgtable-nopud.h @@ -3,6 +3,8 @@ #ifndef __ASSEMBLY__ +#define __PAGETABLE_PUD_FOLDED + /* * Having the pud type consist of a pgd gets the size right, and allows * us to conceptually access the pgd entry that this pud is folded into @@ -52,5 +54,8 @@ static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address) #define pud_free(x) do { } while (0) #define __pud_free_tlb(tlb, x) do { } while (0) +#undef pud_addr_end +#define pud_addr_end(addr, end) (end) + #endif /* __ASSEMBLY__ */ #endif /* _PGTABLE_NOPUD_H */ diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 20f401dcffda..60148466d023 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -146,15 +146,19 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres (__boundary - 1 < (end) - 1)? __boundary: (end); \ }) +#ifndef pud_addr_end #define pud_addr_end(addr, end) \ ({ unsigned long __boundary = ((addr) + PUD_SIZE) & PUD_MASK; \ (__boundary - 1 < (end) - 1)? __boundary: (end); \ }) +#endif +#ifndef pmd_addr_end #define pmd_addr_end(addr, end) \ ({ unsigned long __boundary = ((addr) + PMD_SIZE) & PMD_MASK; \ (__boundary - 1 < (end) - 1)? __boundary: (end); \ }) +#endif #ifndef __ASSEMBLY__ /* -- cgit v1.2.3