[PATCH 1/2] folded page table walkers
From: Nick Piggin
Date: Thu Feb 17 2005 - 10:40:42 EST
(Note these are all obviously just RFCs, until after 2.6.11,
at which time I'll send them off to Andrew if they've proven
OK).
Anyway, here is the patch to fold the page table walkers
nicely for 2 and 3 level implementations... now we are getting
some good reasons why people should convert to the -nop?d.h
headers :)
We cut 35% off lmbench fork time with 2 level UP i386. This
patch gets most of the improvement.
plain +ptwalk +folded +funit-at-a-time for mm/
mm/memory.o text size 10935 10679 9799 9519
lmb fork 335 327 223 218
lmb exec 1417 1445 1228 1198
lmb shell 5483 5507 5195 5087
---
linux-2.6-npiggin/include/asm-generic/pgtable-nopmd.h | 9 +++++++++
linux-2.6-npiggin/include/asm-generic/pgtable-nopud.h | 8 ++++++++
linux-2.6-npiggin/include/asm-generic/pgtable.h | 4 ++++
3 files changed, 21 insertions(+)
diff -puN include/asm-generic/pgtable.h~vm-folded-walkers include/asm-generic/pgtable.h
--- linux-2.6/include/asm-generic/pgtable.h~vm-folded-walkers 2005-02-18 01:54:50.000000000 +1100
+++ linux-2.6-npiggin/include/asm-generic/pgtable.h 2005-02-18 01:54:50.000000000 +1100
@@ -175,6 +175,7 @@ static inline void ptep_mkdirty(pte_t *p
*
* see for_each_pgd
*/
+#ifndef for_each_pud
#define for_each_pud(pgd, start, end, pud, pud_start, pud_end) \
for ( pud = pud_offset(pgd, start), \
pud_start = start; \
@@ -183,12 +184,14 @@ static inline void ptep_mkdirty(pte_t *p
pud <= pud_offset(pgd, end-1); \
pud_start = pud_end, \
pud++ )
+#endif
/*
* for_each_pmd - iterate through pmd entries in a given pud
*
* see for_each_pgd
*/
+#ifndef for_each_pmd
#define for_each_pmd(pud, start, end, pmd, pmd_start, pmd_end) \
for ( pmd = pmd_offset(pud, start), \
pmd_start = start; \
@@ -197,6 +200,7 @@ static inline void ptep_mkdirty(pte_t *p
pmd <= pmd_offset(pud, end-1); \
pmd_start = pmd_end, \
pmd++ )
+#endif
/*
* for_each_pte_map - iterate through pte entries in a given pmd
diff -puN include/asm-generic/pgtable-nopud.h~vm-folded-walkers include/asm-generic/pgtable-nopud.h
--- linux-2.6/include/asm-generic/pgtable-nopud.h~vm-folded-walkers 2005-02-18 01:54:50.000000000 +1100
+++ linux-2.6-npiggin/include/asm-generic/pgtable-nopud.h 2005-02-18 02:22:43.000000000 +1100
@@ -52,5 +52,13 @@ static inline pud_t * pud_offset(pgd_t *
#define pud_free(x) do { } while (0)
#define __pud_free_tlb(tlb, x) do { } while (0)
+#undef for_each_pud
+#define for_each_pud(pgd, start, end, pud, pud_start, pud_end) \
+ for ( pud = (pud_t *)pgd, \
+ pud_start = start, \
+ pud_end = end; \
+ pud_start == start; \
+ pud_start++ )
+
#endif /* __ASSEMBLY__ */
#endif /* _PGTABLE_NOPUD_H */
diff -puN include/asm-generic/pgtable-nopmd.h~vm-folded-walkers include/asm-generic/pgtable-nopmd.h
--- linux-2.6/include/asm-generic/pgtable-nopmd.h~vm-folded-walkers 2005-02-18 01:54:50.000000000 +1100
+++ linux-2.6-npiggin/include/asm-generic/pgtable-nopmd.h 2005-02-18 02:22:43.000000000 +1100
@@ -55,6 +55,15 @@ static inline pmd_t * pmd_offset(pud_t *
#define pmd_free(x) do { } while (0)
#define __pmd_free_tlb(tlb, x) do { } while (0)
+#undef for_each_pmd
+#define for_each_pmd(pud, start, end, pmd, pmd_start, pmd_end) \
+ for ( pmd = (pmd_t *)pud, \
+ pmd_start = start, \
+ pmd_end = end; \
+ pmd_start == start; \
+ pmd_start++ )
+
+
#endif /* __ASSEMBLY__ */
#endif /* _PGTABLE_NOPMD_H */
_