aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Capper <steve.capper@linaro.org>2013-10-07 11:24:39 +0100
committerKim Phillips <kim.phillips@linaro.org>2013-10-10 10:57:07 -0500
commitfad4f3e5e2f5de45bfac686d8c29ec1900fa2824 (patch)
treef28f51eab483fcb7a856a2e1aa5292a48e449a71
parent0bb5dde15801cd37357cbd153272f71992e45952 (diff)
thp: Introduce arch_(un)block_thp_split
In kernel/futex.c an assumption is made in the THP tail pinning code that disabling the irqs is sufficient to block the THP splitting code from completing. Architectures such as ARM do hardware TLB broadcasts so disabling the irqs will not prevent a THP split from completing. This patch introduces: arch_block_thp_split and arch_unblock_thp_split, and provides stock implementations that observe the original irq enable and disable behaviour. One can then define these macros themselves to implement architecture specific behaviour. Signed-off-by: Steve Capper <steve.capper@linaro.org> Signed-off-by: Kim Phillips <kim.phillips@linaro.org>
-rw-r--r--include/linux/huge_mm.h16
-rw-r--r--kernel/futex.c6
2 files changed, 19 insertions, 3 deletions
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 528454c2caa9..be186410a879 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -180,6 +180,14 @@ static inline struct page *compound_trans_head(struct page *page)
extern int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma,
unsigned long addr, pmd_t pmd, pmd_t *pmdp);
+#ifndef arch_block_thp_split
+#define arch_block_thp_split(mm) local_irq_disable()
+#endif
+
+#ifndef arch_unblock_thp_split
+#define arch_unblock_thp_split(mm) local_irq_enable()
+#endif
+
#else /* CONFIG_TRANSPARENT_HUGEPAGE */
#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
#define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; })
@@ -230,6 +238,14 @@ static inline int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_str
return 0;
}
+#ifndef arch_block_thp_split
+#define arch_block_thp_split(mm) do { } while (0)
+#endif
+
+#ifndef arch_unblock_thp_split
+#define arch_unblock_thp_split(mm) do { } while (0)
+#endif
+
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
#endif /* _LINUX_HUGE_MM_H */
diff --git a/kernel/futex.c b/kernel/futex.c
index 195983547d51..cfa9ee794ae1 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -286,7 +286,7 @@ again:
if (unlikely(PageTail(page))) {
put_page(page);
/* serialize against __split_huge_page_splitting() */
- local_irq_disable();
+ arch_block_thp_split(mm);
if (likely(__get_user_pages_fast(address, 1, 1, &page) == 1)) {
page_head = compound_head(page);
/*
@@ -303,9 +303,9 @@ again:
get_page(page_head);
put_page(page);
}
- local_irq_enable();
+ arch_unblock_thp_split(mm);
} else {
- local_irq_enable();
+ arch_unblock_thp_split(mm);
goto again;
}
}