am 8b0ec20d: Update OOM adj levels.
Merge commit '8b0ec20d6f9636def6740085b203302c1680fa81' into gingerbread-plus-aosp
* commit '8b0ec20d6f9636def6740085b203302c1680fa81':
Update OOM adj levels.
diff --git a/rootdir/init.lowmem.rc b/rootdir/init.lowmem.rc
new file mode 100644
index 0000000..7c08054
--- /dev/null
+++ b/rootdir/init.lowmem.rc
@@ -0,0 +1,19 @@
+# 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 0d20dd4..d2ee6d5 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -179,32 +179,35 @@
# killed by the kernel. These are used in ActivityManagerService.
setprop ro.FOREGROUND_APP_ADJ 0
setprop ro.VISIBLE_APP_ADJ 1
- setprop ro.SECONDARY_SERVER_ADJ 2
- setprop ro.BACKUP_APP_ADJ 2
- setprop ro.HOME_APP_ADJ 4
+ 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.CONTENT_PROVIDER_ADJ 14
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).
- setprop ro.FOREGROUND_APP_MEM 1536
- setprop ro.VISIBLE_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.CONTENT_PROVIDER_MEM 5632
- setprop ro.EMPTY_APP_MEM 6144
+ 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 HOME_APP at the
-# same memory level as services.
- write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15
+# 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
write /proc/sys/vm/overcommit_memory 1
write /proc/sys/vm/min_free_order_shift 4
- write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144
+ write /sys/module/lowmemorykiller/parameters/minfree 2048,3072,4096,6144,7168,8192
# Set init its forked children's oom_adj.
write /proc/1/oom_adj -16