[v3] device.mk: Add options to make things perform a bit better in lowmemory situations

Message ID 1493423236-22257-1-git-send-email-john.stultz@linaro.org
State New
Headers show

Commit Message

John Stultz April 28, 2017, 11:47 p.m.
With the db410c especially, the memory constraints are very
tight, so try to eek out a bit more memory by setting some
options suggested by Bero.

Cc: Rob Herring <rob.herring@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Vishal Bhoj <vishal.bhoj@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>

---
 Kconfig                  |  7 +++++++
 configs/db410c_defconfig |  1 +
 device.mk                |  1 +
 lowmem/Android.mk        | 11 +++++++++++
 lowmem/device.mk         |  8 ++++++++
 lowmem/lowmem.rc         |  5 +++++
 6 files changed, 33 insertions(+)
 create mode 100644 lowmem/Android.mk
 create mode 100644 lowmem/device.mk
 create mode 100644 lowmem/lowmem.rc

-- 
2.7.4

Patch

diff --git a/Kconfig b/Kconfig
index 555127a..b0b48f3 100644
--- a/Kconfig
+++ b/Kconfig
@@ -143,6 +143,13 @@  config DALVIK_VM_HEAPGROWTHLIMIT
 	help
 	  Typically this is less than half the heap size.
 
+config LOWMEM_CONFIG
+	bool "Enable Lowmem Configuration"
+	default false
+	help
+	  Enables some of the reccomended low-memory options for devices
+	  with 1GB or less RAM.
+
 endmenu
 
 menu "Image Configuration"
diff --git a/configs/db410c_defconfig b/configs/db410c_defconfig
index 2923287..e13ad04 100644
--- a/configs/db410c_defconfig
+++ b/configs/db410c_defconfig
@@ -1,5 +1,6 @@ 
 CONFIG_PRODUCT_DEVICE="db410c"
 CONFIG_DALVIK_VM_HEAPSIZE=32
+CONFIG_LOWMEM_CONFIG=y
 CONFIG_BOARD_SYSTEMIMAGE_PARTITION_SIZE=1288491008
 CONFIG_BOARD_USERDATAIMAGE_PARTITION_SIZE=5653544960
 CONFIG_KERNEL=y
diff --git a/device.mk b/device.mk
index 1071301..3a1bad7 100644
--- a/device.mk
+++ b/device.mk
@@ -76,6 +76,7 @@  PRODUCT_PROPERTY_OVERRIDES += \
     dalvik.vm.heapmaxfree=$(CONFIG_DALVIK_VM_HEAPMAXFREE)m
 
 subdirs-true := lights graphics
+subdirs-$(CONFIG_LOWMEM_CONFIG) += lowmem
 subdirs-$(CONFIG_WIFI) += wifi
 subdirs-$(CONFIG_ETHERNET) += ethernet
 subdirs-$(CONFIG_SENSOR) += sensor
diff --git a/lowmem/Android.mk b/lowmem/Android.mk
new file mode 100644
index 0000000..92dd75a
--- /dev/null
+++ b/lowmem/Android.mk
@@ -0,0 +1,11 @@ 
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE:= lowmem.rc
+
+LOCAL_INIT_RC := $(LOCAL_MODULE)
+
+include $(BUILD_PHONY_PACKAGE)
+
+include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/lowmem/device.mk b/lowmem/device.mk
new file mode 100644
index 0000000..77afd59
--- /dev/null
+++ b/lowmem/device.mk
@@ -0,0 +1,8 @@ 
+#lowmem items
+PRODUCT_PACKAGES := \
+		lowmem.rc \
+
+PRODUCT_PROPERTY_OVERRIDES += \
+	ro.config.low_ram=true \
+	dalvik.vm.jit.codecachesize=0 \
+
diff --git a/lowmem/lowmem.rc b/lowmem/lowmem.rc
new file mode 100644
index 0000000..dbccba2
--- /dev/null
+++ b/lowmem/lowmem.rc
@@ -0,0 +1,5 @@ 
+on boot
+    write /sys/kernel/mm/ksm/pages_to_scan 100
+    write /sys/kernel/mm/ksm/sleep_millisecs 500
+    write /sys/kernel/mm/ksm/run 1
+    write /proc/sys/vm/page-cluster 0