|author||Joel Fernandes (Google) <firstname.lastname@example.org>||2019-01-03 15:28:38 -0800|
|committer||Linus Torvalds <email@example.com>||2019-01-04 13:13:48 -0800|
mm: speed up mremap by 20x on large regions
Android needs to mremap large regions of memory during memory management related operations. The mremap system call can be really slow if THP is not enabled. The bottleneck is move_page_tables, which is copying each pte at a time, and can be really slow across a large map. Turning on THP may not be a viable option, and is not for us. This patch speeds up the performance for non-THP system by copying at the PMD level when possible. The speedup is an order of magnitude on x86 (~20x). On a 1GB mremap, the mremap completion times drops from 3.4-3.6 milliseconds to 144-160 microseconds. Before: Total mremap time for 1GB data: 3521942 nanoseconds. Total mremap time for 1GB data: 3449229 nanoseconds. Total mremap time for 1GB data: 3488230 nanoseconds. After: Total mremap time for 1GB data: 150279 nanoseconds. Total mremap time for 1GB data: 144665 nanoseconds. Total mremap time for 1GB data: 158708 nanoseconds. If THP is enabled the optimization is mostly skipped except in certain situations. [firstname.lastname@example.org: fix 'move_normal_pmd' unused function warning] Link: http://lkml.kernel.org/r/20181108224457.GB209347@google.com Link: http://email@example.com Signed-off-by: Joel Fernandes (Google) <firstname.lastname@example.org> Acked-by: Kirill A. Shutemov <email@example.com> Reviewed-by: William Kucharski <firstname.lastname@example.org> Cc: Julia Lawall <Julia.Lawall@lip6.fr> Cc: Michal Hocko <email@example.com> Cc: Will Deacon <firstname.lastname@example.org> Signed-off-by: Andrew Morton <email@example.com> Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
Diffstat (limited to 'arch')
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index e1e540ffa979..b70c952ac838 100644
@@ -535,6 +535,11 @@ config HAVE_IRQ_TIME_ACCOUNTING
Archs need to ensure they use a high enough resolution clock to
support irq time accounting and then call enable_sched_clock_irqtime().
+ Archs that select this are able to move page tables at the PMD level.