diff options
author | Gerald Schaefer <gerald.schaefer@de.ibm.com> | 2008-04-28 02:13:28 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 08:58:25 -0700 |
commit | 8fe627ec5b7c47b1654dff50536d9709863295a3 (patch) | |
tree | 78511553eb4111224e89ef02a9436d0db382694b | |
parent | 6d779079bfd1196e077bb1d0a906c37ae770b102 (diff) | |
download | blackbird-op-linux-8fe627ec5b7c47b1654dff50536d9709863295a3.tar.gz blackbird-op-linux-8fe627ec5b7c47b1654dff50536d9709863295a3.zip |
hugetlbfs: add missing TLB flush to hugetlb_cow()
A cow break on a hugetlbfs page with page_count > 1 will set a new pte with
set_huge_pte_at(), w/o any tlb flush operation. The old pte will remain in
the tlb and subsequent write access to the page will result in a page fault
loop, for as long as it may take until the tlb is flushed from somewhere else.
This patch introduces an architecture-specific huge_ptep_clear_flush()
function, which is called before the the set_huge_pte_at() in hugetlb_cow().
ATTENTION: This is just a nop on all architectures for now, the s390
implementation will come with our large page patch later. Other architectures
should define their own huge_ptep_clear_flush() if needed.
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/asm-ia64/hugetlb.h | 5 | ||||
-rw-r--r-- | include/asm-powerpc/hugetlb.h | 5 | ||||
-rw-r--r-- | include/asm-sh/hugetlb.h | 5 | ||||
-rw-r--r-- | include/asm-sparc64/hugetlb.h | 5 | ||||
-rw-r--r-- | include/asm-x86/hugetlb.h | 5 | ||||
-rw-r--r-- | mm/hugetlb.c | 1 |
6 files changed, 26 insertions, 0 deletions
diff --git a/include/asm-ia64/hugetlb.h b/include/asm-ia64/hugetlb.h index f0ee14c6e172..5f5434374972 100644 --- a/include/asm-ia64/hugetlb.h +++ b/include/asm-ia64/hugetlb.h @@ -34,4 +34,9 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, return ptep_get_and_clear(mm, addr, ptep); } +static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, + unsigned long addr, pte_t *ptep) +{ +} + #endif /* _ASM_IA64_HUGETLB_H */ diff --git a/include/asm-powerpc/hugetlb.h b/include/asm-powerpc/hugetlb.h index f537993c5c87..bead2ff78493 100644 --- a/include/asm-powerpc/hugetlb.h +++ b/include/asm-powerpc/hugetlb.h @@ -34,4 +34,9 @@ static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm) { } +static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, + unsigned long addr, pte_t *ptep) +{ +} + #endif /* _ASM_POWERPC_HUGETLB_H */ diff --git a/include/asm-sh/hugetlb.h b/include/asm-sh/hugetlb.h index 885218d2c844..d1ed476467a1 100644 --- a/include/asm-sh/hugetlb.h +++ b/include/asm-sh/hugetlb.h @@ -46,4 +46,9 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, return ptep_get_and_clear(mm, addr, ptep); } +static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, + unsigned long addr, pte_t *ptep) +{ +} + #endif /* _ASM_SH_HUGETLB_H */ diff --git a/include/asm-sparc64/hugetlb.h b/include/asm-sparc64/hugetlb.h index 7e111cfd31ea..0b9e44c85c5d 100644 --- a/include/asm-sparc64/hugetlb.h +++ b/include/asm-sparc64/hugetlb.h @@ -39,4 +39,9 @@ static inline void hugetlb_free_pgd_range(struct mmu_gather **tlb, free_pgd_range(tlb, addr, end, floor, ceiling); } +static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, + unsigned long addr, pte_t *ptep) +{ +} + #endif /* _ASM_SPARC64_HUGETLB_H */ diff --git a/include/asm-x86/hugetlb.h b/include/asm-x86/hugetlb.h index ec21cedd7149..f57236dfc8f4 100644 --- a/include/asm-x86/hugetlb.h +++ b/include/asm-x86/hugetlb.h @@ -46,4 +46,9 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, return ptep_get_and_clear(mm, addr, ptep); } +static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, + unsigned long addr, pte_t *ptep) +{ +} + #endif /* _ASM_X86_HUGETLB_H */ diff --git a/mm/hugetlb.c b/mm/hugetlb.c index d36e1f11a5f2..262d0a93d2b6 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -892,6 +892,7 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma, ptep = huge_pte_offset(mm, address & HPAGE_MASK); if (likely(pte_same(*ptep, pte))) { /* Break COW */ + huge_ptep_clear_flush(vma, address, ptep); set_huge_pte_at(mm, address, ptep, make_huge_pte(vma, new_page, 1)); /* Make the old page be freed below */ |