aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Capper <steve.capper@linaro.org>2014-10-09 18:29:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-09 22:26:01 -0400
commit29e5694054149acd25b0d5538c95fb6d64478315 (patch)
tree1f496525d51e1989b3415bf275034213a639bbc8
parent5e5f6dc10546f5c03bc572e3ba3089af30c66e2d (diff)
arm64: mm: enable RCU fast_gup
Activate the RCU fast_gup for ARM64. We also need to force THP splits to broadcast an IPI s.t. we block in the fast_gup page walker. As THP splits are comparatively rare, this should not lead to a noticeable performance degradation. Some pre-requisite functions pud_write and pud_page are also added. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Steve Capper <steve.capper@linaro.org> Tested-by: Dann Frazier <dann.frazier@canonical.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Hugh Dickins <hughd@google.com> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Will Deacon <will.deacon@arm.com> Cc: Christoffer Dall <christoffer.dall@linaro.org> Cc: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/arm64/Kconfig3
-rw-r--r--arch/arm64/include/asm/pgtable.h21
-rw-r--r--arch/arm64/mm/flush.c16
3 files changed, 39 insertions, 1 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 1ffd9a05206b..73bfb477ca0d 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -111,6 +111,9 @@ config GENERIC_CALIBRATE_DELAY
111config ZONE_DMA 111config ZONE_DMA
112 def_bool y 112 def_bool y
113 113
114config HAVE_GENERIC_RCU_GUP
115 def_bool y
116
114config ARCH_DMA_ADDR_T_64BIT 117config ARCH_DMA_ADDR_T_64BIT
115 def_bool y 118 def_bool y
116 119
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index d58e40cde88e..464c5cecdd15 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -244,6 +244,16 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
244 244
245#define __HAVE_ARCH_PTE_SPECIAL 245#define __HAVE_ARCH_PTE_SPECIAL
246 246
247static inline pte_t pud_pte(pud_t pud)
248{
249 return __pte(pud_val(pud));
250}
251
252static inline pmd_t pud_pmd(pud_t pud)
253{
254 return __pmd(pud_val(pud));
255}
256
247static inline pte_t pmd_pte(pmd_t pmd) 257static inline pte_t pmd_pte(pmd_t pmd)
248{ 258{
249 return __pte(pmd_val(pmd)); 259 return __pte(pmd_val(pmd));
@@ -261,7 +271,13 @@ static inline pmd_t pte_pmd(pte_t pte)
261#ifdef CONFIG_TRANSPARENT_HUGEPAGE 271#ifdef CONFIG_TRANSPARENT_HUGEPAGE
262#define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT)) 272#define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT))
263#define pmd_trans_splitting(pmd) pte_special(pmd_pte(pmd)) 273#define pmd_trans_splitting(pmd) pte_special(pmd_pte(pmd))
264#endif 274#ifdef CONFIG_HAVE_RCU_TABLE_FREE
275#define __HAVE_ARCH_PMDP_SPLITTING_FLUSH
276struct vm_area_struct;
277void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
278 pmd_t *pmdp);
279#endif /* CONFIG_HAVE_RCU_TABLE_FREE */
280#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
265 281
266#define pmd_young(pmd) pte_young(pmd_pte(pmd)) 282#define pmd_young(pmd) pte_young(pmd_pte(pmd))
267#define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd))) 283#define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd)))
@@ -282,6 +298,7 @@ static inline pmd_t pte_pmd(pte_t pte)
282#define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot) 298#define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot)
283 299
284#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK)) 300#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
301#define pud_write(pud) pte_write(pud_pte(pud))
285#define pud_pfn(pud) (((pud_val(pud) & PUD_MASK) & PHYS_MASK) >> PAGE_SHIFT) 302#define pud_pfn(pud) (((pud_val(pud) & PUD_MASK) & PHYS_MASK) >> PAGE_SHIFT)
286 303
287#define set_pmd_at(mm, addr, pmdp, pmd) set_pte_at(mm, addr, (pte_t *)pmdp, pmd_pte(pmd)) 304#define set_pmd_at(mm, addr, pmdp, pmd) set_pte_at(mm, addr, (pte_t *)pmdp, pmd_pte(pmd))
@@ -381,6 +398,8 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
381 return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(addr); 398 return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(addr);
382} 399}
383 400
401#define pud_page(pud) pmd_page(pud_pmd(pud))
402
384#endif /* CONFIG_ARM64_PGTABLE_LEVELS > 2 */ 403#endif /* CONFIG_ARM64_PGTABLE_LEVELS > 2 */
385 404
386#if CONFIG_ARM64_PGTABLE_LEVELS > 3 405#if CONFIG_ARM64_PGTABLE_LEVELS > 3
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index 0d64089d28b5..b6f14e8d2121 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -104,3 +104,19 @@ EXPORT_SYMBOL(flush_dcache_page);
104 */ 104 */
105EXPORT_SYMBOL(flush_cache_all); 105EXPORT_SYMBOL(flush_cache_all);
106EXPORT_SYMBOL(flush_icache_range); 106EXPORT_SYMBOL(flush_icache_range);
107
108#ifdef CONFIG_TRANSPARENT_HUGEPAGE
109#ifdef CONFIG_HAVE_RCU_TABLE_FREE
110void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
111 pmd_t *pmdp)
112{
113 pmd_t pmd = pmd_mksplitting(*pmdp);
114
115 VM_BUG_ON(address & ~PMD_MASK);
116 set_pmd_at(vma->vm_mm, address, pmdp, pmd);
117
118 /* dummy IPI to serialise against fast_gup */
119 kick_all_cpus_sync();
120}
121#endif /* CONFIG_HAVE_RCU_TABLE_FREE */
122#endif /* CONFIG_TRANSPARENT_HUGEPAGE */