mm: optimize stack usage for functions [1/1]
authortao zeng <tao.zeng@amlogic.com>
Wed, 7 Nov 2018 08:51:50 +0000 (16:51 +0800)
committerLuan Yuan <luan.yuan@amlogic.com>
Mon, 17 Dec 2018 09:21:59 +0000 (17:21 +0800)
commit5f10dc6fb5852ca187f642b5420e04289ab89384
treeb1312d56b7a68df1153e5f04ec8c91d4e0f60874
parente0d751a9fa441846641ef762a0d191585d8443ff
mm: optimize stack usage for functions [1/1]

PD#SWPL-1773

Problem:
After adding optimization of vmap stack, we can found stack usage
of each functions when handle vmap fault. From test log we see some
functions using large stack size which over 256bytes. Especially
common call path from fs. We need to optimize stack usage of these
functions to reduce stack fault probability and save stack memory
usage.

Solution:
1. remove CONFIG_CC_STACKPROTECTOR_STRONG and set STACKPROTECTOR to
   NONE. This can save stack usage add by compiler for most functions.
   Kernel code size can also save over 1MB.
2. Add some noinline functions for android_fs_data rw trace calls. In
   these trace call it allcated a 256 bytes local buffer.
3. Add a wrap function for mem abort handler. By default, it defined a
   siginfo struct(size over 100 bytes) in local but only used when fault
   can't be handled.
4. reduce cached page size for vmap stack since probability of page
   fault caused by stack overflow is reduced after function stack usage
   optimized.
Monkey test show real stack usage ratio compared with 1st vmap
implementation reduced from 35% ~ 38% to 26 ~ 27%. Which is very
close to 25%, theory limit.

Verify:
P212

Change-Id: I5505cacc1cab51f88654052902852fd648b6a036
Signed-off-by: tao zeng <tao.zeng@amlogic.com>
arch/arm64/configs/meson64_defconfig
arch/arm64/mm/fault.c
drivers/amlogic/memory_ext/vmap_stack.c
fs/ext4/inode.c
fs/ext4/readpage.c
fs/f2fs/data.c
fs/f2fs/inline.c
fs/mpage.c
fs/sdcardfs/inode.c
include/linux/amlogic/vmap_stack.h
include/trace/events/android_fs.h