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>
This commit is contained in:
Patrick Daly 2019-12-11 15:52:05 -08:00 committed by Max Weffers
parent a293622e25
commit 20bc13de0e
No known key found for this signature in database
GPG key ID: 795F73D22FB93FAE

View file

@ -392,6 +392,16 @@ function configure_zram_parameters() {
else else
echo $zRamSizeBytes > /sys/block/zram0/disksize echo $zRamSizeBytes > /sys/block/zram0/disksize
fi 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 mkswap /dev/block/zram0
swapon /dev/block/zram0 -p 32758 swapon /dev/block/zram0 -p 32758
fi fi