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)
committerJianxin Pan <jianxin.pan@amlogic.com>
Wed, 12 Dec 2018 02:31:19 +0000 (18:31 -0800)
commit08fbfd263a0b7f8ef9a0684791a4bb02487c4c83
treef7133de0928db2db8a16f785c3088238336f39b7
parent1d3dbed18511b85d01af6c4a04e40bfcc258d300
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