Skip to contentSkip to conversation

i386/PAE: fix pud_page()

PATCH Applied Jan Beulich 2 participants 2 messages Oct 30, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i386/PAE: fix pud_page()

To the unsuspecting user it is quite annoying that this broken and inconsistent with x86-64 definition still exists.

---
 arch/x86/include/asm/pgtable-3level.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/pgtable-3level.h +2 -2
@@ -120,13 +120,13 @@ static inline void pud_clear(pud_t *pudp
 		write_cr3(pgd);
 }
 
-#define pud_page(pud) ((struct page *) __va(pud_val(pud) & PTE_PFN_MASK))
+#define pud_page(pud) pfn_to_page(pud_val(pud) >> PAGE_SHIFT)
 
 #define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PTE_PFN_MASK))
 
 
 /* Find an entry in the second-level page table.. */
-#define pmd_offset(pud, address) ((pmd_t *)pud_page(*(pud)) +	\
+#define pmd_offset(pud, address) ((pmd_t *)pud_page_vaddr(*(pud)) +	\
 				  pmd_index(address))
 
 #ifdef CONFIG_SMP
Applied
#1 lore raw
Quoted 8 lines · Jan Beulich

To the unsuspecting user it is quite annoying that this broken and inconsistent with x86-64 definition still exists.

---
 arch/x86/include/asm/pgtable-3level.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

applied, thanks Jan!

arch/x86/include/asm/pgtable-3level.h static inline void pud_clear(pud_t *pudp · line 130

Quoted 10 lines
arch/x86/include/asm/pgtable-3level.h +2 -2
-#define pud_page(pud) ((struct page *) __va(pud_val(pud) & PTE_PFN_MASK))
+#define pud_page(pud) pfn_to_page(pud_val(pud) >> PAGE_SHIFT)
 
 #define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PTE_PFN_MASK))
 
 
 /* Find an entry in the second-level page table.. */
-#define pmd_offset(pud, address) ((pmd_t *)pud_page(*(pud)) +	\
+#define pmd_offset(pud, address) ((pmd_t *)pud_page_vaddr(*(pud)) +	\
 				  pmd_index(address))

we were quite lucky there. Despite being a cleanup i've put this into x86/urgent - i agree that it's just too ugly and confusing.

Ingo