From 7ef939054139ef857cebbec07cbd12d7cf7beedd Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Sat, 3 Sep 2005 15:57:52 -0700 Subject: [PATCH] uml: fix x86_64 page leak We were leaking pmd pages when 3_LEVEL_PGTABLES was enabled. This fixes that. Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-um/pgalloc.h | 12 +++++++----- include/asm-um/pgtable-3level.h | 9 +++------ 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/asm-um/pgalloc.h b/include/asm-um/pgalloc.h index 8fcb2fc0a89..ea49411236d 100644 --- a/include/asm-um/pgalloc.h +++ b/include/asm-um/pgalloc.h @@ -42,11 +42,13 @@ static inline void pte_free(struct page *pte) #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) #ifdef CONFIG_3_LEVEL_PGTABLES -/* - * In the 3-level case we free the pmds as part of the pgd. - */ -#define pmd_free(x) do { } while (0) -#define __pmd_free_tlb(tlb,x) do { } while (0) + +extern __inline__ void pmd_free(pmd_t *pmd) +{ + free_page((unsigned long)pmd); +} + +#define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x)) #endif #define check_pgt_cache() do { } while (0) diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h index 32cd6236f24..786c2572728 100644 --- a/include/asm-um/pgtable-3level.h +++ b/include/asm-um/pgtable-3level.h @@ -69,14 +69,11 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) return pmd; } -static inline void pmd_free(pmd_t *pmd){ - free_page((unsigned long) pmd); +extern inline void pud_clear (pud_t *pud) +{ + set_pud(pud, __pud(0)); } -#define __pmd_free_tlb(tlb,x) do { } while (0) - -static inline void pud_clear (pud_t * pud) { } - #define pud_page(pud) \ ((struct page *) __va(pud_val(pud) & PAGE_MASK)) -- cgit v1.2.3