aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Daly <pdaly@codeaurora.org>2019-12-11 15:52:05 -0800
committerMarcos Tolcachir <marcostolcachir@gmail.com>2022-01-05 04:58:12 +0100
commit34cb672cee3cb66320ae6e347eeb65e4b446ab2b (patch)
tree75ad76098b96d88e671b3ca26473ce8820b2cfff
parentde53a682d1028359bce98c69b54859ca9f584ade (diff)
addison: init: post_boot: Ensure SLAB_STORE_USER is disabled for zram kmem_caches
ZRAM compression uses the linux slub allocator its internal data structures. If these internal data structure consume a lot of memory, ZRAM compression may increase memory usage, rather than decrease it as expected. Decrease the chance of this occuring by ensuring the SLAB_STORE_USER debug option is disabled. Change-Id: I4684feda94b7bebacb6218b7f979c95771b0ee10 Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
-rw-r--r--rootdir/bin/init.qcom.post_boot.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/rootdir/bin/init.qcom.post_boot.sh b/rootdir/bin/init.qcom.post_boot.sh
index 3293d7c..8b28021 100644
--- a/rootdir/bin/init.qcom.post_boot.sh
+++ b/rootdir/bin/init.qcom.post_boot.sh
@@ -224,6 +224,16 @@ function configure_zram_parameters() {
else
echo $zRamSizeBytes > /sys/block/zram0/disksize
fi
+
+ # ZRAM may use more memory than it saves if SLAB_STORE_USER
+ # debug option is enabled.
+ if [ -e /sys/kernel/slab/zs_handle ]; then
+ echo 0 > /sys/kernel/slab/zs_handle/store_user
+ fi
+ if [ -e /sys/kernel/slab/zspage ]; then
+ echo 0 > /sys/kernel/slab/zspage/store_user
+ fi
+
mkswap /dev/block/zram0
swapon /dev/block/zram0 -p 32758
fi