mm: optimize thread stack usage on arm64 [1/1]
authortao zeng <tao.zeng@amlogic.com>
Mon, 15 Oct 2018 07:20:38 +0000 (15:20 +0800)
committerLuan Yuan <luan.yuan@amlogic.com>
Mon, 17 Dec 2018 06:52:05 +0000 (14:52 +0800)
commit4d6ae435938536bf77c11b6adfaaf1f744415e87
tree1044352dfdb148d3ae633ef1d985a896db8d4c04
parentd53e8a7f8c64f9dd8c4ee303e9c5dcf8577b53c9
mm: optimize thread stack usage on arm64 [1/1]

PD#SWPL-1219

Problem:
On arm64, thread stack is 16KB for each task. If running task number
is large, this type of memory may over 40MB. It's a large amount on
small memory platform. But most case thread only use less 4KB stack.
It's waste of memory and we need optimize it.

Solution:
1. Pre-allocate a vmalloc address space for task stack;
2. Only map 1st page for stack and handle page fault in EL1
   when stack growth triggered exception;
3. handle stack switch for exception.

Verify:
p212

Change-Id: I47f511ccfa2868d982bc10a820ed6435b6d52ba9
Signed-off-by: tao zeng <tao.zeng@amlogic.com>
16 files changed:
MAINTAINERS
arch/arm64/kernel/entry.S
arch/arm64/kernel/hw_breakpoint.c
arch/arm64/kernel/smp.c
arch/arm64/kernel/stacktrace.c
arch/arm64/kernel/traps.c
drivers/amlogic/memory_ext/Kconfig
drivers/amlogic/memory_ext/Makefile
drivers/amlogic/memory_ext/vmap_stack.c [new file with mode: 0644]
drivers/amlogic/pm/gx_pm.c
fs/proc/meminfo.c
include/linux/amlogic/vmap_stack.h [new file with mode: 0644]
include/linux/sched.h
include/linux/vmalloc.h
kernel/fork.c
mm/vmalloc.c