diff options
author | Toshi Kani <toshi.kani@hp.com> | 2015-04-14 18:47:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 19:49:04 -0400 |
commit | b9820d8f39f816b67112eb7ec5cdc4c1655ff060 (patch) | |
tree | 7185bfd18a02552345fbcfda941d1dc8c9bdd802 | |
parent | e61ce6ade404ef17bd63d62bec78e29047a47b47 (diff) |
mm: change vunmap to tear down huge KVA mappings
Change vunmap_pmd_range() and vunmap_pud_range() to tear down huge KVA
mappings when they are set. pud_clear_huge() and pmd_clear_huge() return
zero when no-operation is performed, i.e. huge page mapping was not used.
These changes are only enabled when CONFIG_HAVE_ARCH_HUGE_VMAP is defined
on the architecture.
[akpm@linux-foundation.org: use consistent code layout]
Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Robert Elliott <Elliott@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/asm-generic/pgtable.h | 10 | ||||
-rw-r--r-- | mm/vmalloc.c | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 9fb7dc7ca7f4..39f1d6a2b04d 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -700,6 +700,8 @@ static inline int pmd_protnone(pmd_t pmd) | |||
700 | #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP | 700 | #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP |
701 | int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot); | 701 | int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot); |
702 | int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot); | 702 | int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot); |
703 | int pud_clear_huge(pud_t *pud); | ||
704 | int pmd_clear_huge(pmd_t *pmd); | ||
703 | #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */ | 705 | #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */ |
704 | static inline int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot) | 706 | static inline int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot) |
705 | { | 707 | { |
@@ -709,6 +711,14 @@ static inline int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot) | |||
709 | { | 711 | { |
710 | return 0; | 712 | return 0; |
711 | } | 713 | } |
714 | static inline int pud_clear_huge(pud_t *pud) | ||
715 | { | ||
716 | return 0; | ||
717 | } | ||
718 | static inline int pmd_clear_huge(pmd_t *pmd) | ||
719 | { | ||
720 | return 0; | ||
721 | } | ||
712 | #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */ | 722 | #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */ |
713 | 723 | ||
714 | #endif /* !__ASSEMBLY__ */ | 724 | #endif /* !__ASSEMBLY__ */ |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index a48cd061f16f..a5bbdd3b5d67 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -75,6 +75,8 @@ static void vunmap_pmd_range(pud_t *pud, unsigned long addr, unsigned long end) | |||
75 | pmd = pmd_offset(pud, addr); | 75 | pmd = pmd_offset(pud, addr); |
76 | do { | 76 | do { |
77 | next = pmd_addr_end(addr, end); | 77 | next = pmd_addr_end(addr, end); |
78 | if (pmd_clear_huge(pmd)) | ||
79 | continue; | ||
78 | if (pmd_none_or_clear_bad(pmd)) | 80 | if (pmd_none_or_clear_bad(pmd)) |
79 | continue; | 81 | continue; |
80 | vunmap_pte_range(pmd, addr, next); | 82 | vunmap_pte_range(pmd, addr, next); |
@@ -89,6 +91,8 @@ static void vunmap_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end) | |||
89 | pud = pud_offset(pgd, addr); | 91 | pud = pud_offset(pgd, addr); |
90 | do { | 92 | do { |
91 | next = pud_addr_end(addr, end); | 93 | next = pud_addr_end(addr, end); |
94 | if (pud_clear_huge(pud)) | ||
95 | continue; | ||
92 | if (pud_none_or_clear_bad(pud)) | 96 | if (pud_none_or_clear_bad(pud)) |
93 | continue; | 97 | continue; |
94 | vunmap_pmd_range(pud, addr, next); | 98 | vunmap_pmd_range(pud, addr, next); |