From 06787f4089093fed8a01ec3a3d2092e10919b77e Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Sun, 7 Aug 2011 16:30:24 -0700 Subject: Activity Manager now takes care of setting OOM values. All init needs to do is make these files writeable so that the activity manager can set them. Change-Id: Ieea43208fadc01504d813be379aecbafcadf0d34 --- rootdir/init.lowmem.rc | 19 ------------------ rootdir/init.rc | 53 ++++++++------------------------------------------ 2 files changed, 8 insertions(+), 64 deletions(-) delete mode 100644 rootdir/init.lowmem.rc diff --git a/rootdir/init.lowmem.rc b/rootdir/init.lowmem.rc deleted file mode 100644 index 7c08054..0000000 --- a/rootdir/init.lowmem.rc +++ /dev/null @@ -1,19 +0,0 @@ -# Adjustments to the out-of-memory killer, for devices that are -# tight on memory. These should not be used if not needed, as they -# can result in more paging. - -on early-boot - - setprop ro.FOREGROUND_APP_MEM 1536 - setprop ro.VISIBLE_APP_MEM 2048 - setprop ro.PERCEPTIBLE_APP_MEM 2048 - setprop ro.HEAVY_WEIGHT_APP_MEM 2048 - setprop ro.SECONDARY_SERVER_MEM 4096 - setprop ro.BACKUP_APP_MEM 4096 - setprop ro.HOME_APP_MEM 4096 - setprop ro.HIDDEN_APP_MEM 5120 - setprop ro.EMPTY_APP_MEM 6144 - -on boot - - write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,3072,4096,5120,6144 diff --git a/rootdir/init.rc b/rootdir/init.rc index f843824..d0f82b9 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -190,54 +190,17 @@ on boot # set RLIMIT_NICE to allow priorities from 19 to -20 setrlimit 13 40 40 -# Define the oom_adj values for the classes of processes that can be -# killed by the kernel. These are used in ActivityManagerService. - setprop ro.FOREGROUND_APP_ADJ 0 - setprop ro.VISIBLE_APP_ADJ 1 - setprop ro.PERCEPTIBLE_APP_ADJ 2 - setprop ro.HEAVY_WEIGHT_APP_ADJ 3 - setprop ro.SECONDARY_SERVER_ADJ 4 - setprop ro.BACKUP_APP_ADJ 5 - setprop ro.HOME_APP_ADJ 6 - setprop ro.HIDDEN_APP_MIN_ADJ 7 - setprop ro.EMPTY_APP_ADJ 15 - -# Define the memory thresholds at which the above process classes will -# be killed. These numbers are in pages (4k). - # These are currently tuned for tablets with approx 1GB RAM. - setprop ro.FOREGROUND_APP_MEM 8192 - setprop ro.VISIBLE_APP_MEM 10240 - setprop ro.PERCEPTIBLE_APP_MEM 12288 - setprop ro.HEAVY_WEIGHT_APP_MEM 12288 - setprop ro.SECONDARY_SERVER_MEM 14336 - setprop ro.BACKUP_APP_MEM 14336 - setprop ro.HOME_APP_MEM 14336 - setprop ro.HIDDEN_APP_MEM 16384 - setprop ro.EMPTY_APP_MEM 20480 - - # Old values for phones. Should probably be adjusted up for the next - # phone version. - #setprop ro.FOREGROUND_APP_MEM 2048 - #setprop ro.VISIBLE_APP_MEM 3072 - #setprop ro.PERCEPTIBLE_APP_MEM 4096 - #setprop ro.HEAVY_WEIGHT_APP_MEM 4096 - #setprop ro.SECONDARY_SERVER_MEM 6144 - #setprop ro.BACKUP_APP_MEM 6144 - #setprop ro.HOME_APP_MEM 6144 - #setprop ro.HIDDEN_APP_MEM 7168 - #setprop ro.EMPTY_APP_MEM 8192 - -# Write value must be consistent with the above properties. -# Note that the driver only supports 6 slots, so we have combined some of -# the classes into the same memory level; the associated processes of higher -# classes will still be killed first. - write /sys/module/lowmemorykiller/parameters/adj 0,1,2,4,7,15 - +# Memory management. Basic kernel parameters, and allow the high +# level system server to be able to adjust the kernel OOM driver +# paramters to match how it is managing things. write /proc/sys/vm/overcommit_memory 1 write /proc/sys/vm/min_free_order_shift 4 - write /sys/module/lowmemorykiller/parameters/minfree 8192,10240,12288,14336,16384,20480 + chown root system /sys/module/lowmemorykiller/parameters/adj + chmod 0664 /sys/module/lowmemorykiller/parameters/adj + chown root system /sys/module/lowmemorykiller/parameters/minfree + chmod 0664 /sys/module/lowmemorykiller/parameters/minfree - # Set init its forked children's oom_adj. + # Set init and its forked children's oom_adj. write /proc/1/oom_adj -16 # Tweak background writeout -- cgit v1.1