aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSinan Kaya <okaya@kernel.org>2021-04-23 20:03:25 +0000
committerArmin Kuster <akuster808@gmail.com>2021-04-25 15:12:19 -0700
commitef6adcba6f45ff84b5150c372c50f270edc3cc76 (patch)
tree05c0e256b723f81cfb5d19a5a8c3ecd72b46e84a
parent981a6b3cb103e3f51fc3e40530477defec898304 (diff)
downloadmeta-openembedded-ef6adcba6f45ff84b5150c372c50f270edc3cc76.tar.gz
meta-openembedded-ef6adcba6f45ff84b5150c372c50f270edc3cc76.tar.bz2
meta-openembedded-ef6adcba6f45ff84b5150c372c50f270edc3cc76.zip
zram: add support for mem_limit
Some targets might be interested in limiting how big zram can grow. If the variable is set in /etc/default/zram file, configure it in mem_limit sysfs attribute. Signed-off-by: Sinan Kaya <okaya@kernel.org> Signed-off-by: Khem Raj <raj.khem@gmail.com> (cherry picked from commit cb1cf053785bcb5670b2eca7051aa11f29ef80b1) Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rwxr-xr-xmeta-oe/recipes-extended/zram/zram/zram-swap-init5
1 files changed, 5 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/zram/zram/zram-swap-init b/meta-oe/recipes-extended/zram/zram/zram-swap-init
index ccc3aafe3..28082f7ff 100755
--- a/meta-oe/recipes-extended/zram/zram/zram-swap-init
+++ b/meta-oe/recipes-extended/zram/zram/zram-swap-init
@@ -24,3 +24,8 @@ modprobe -q zram || true
zramctl -a ${ZRAM_ALGORITHM} -s ${memzram}KB $device
mkswap -L "zram-swap" $device
+
+devname="${device##*/}"
+if [ ! -z ${ZRAM_SIZE_LIMIT+x} ]; then
+ echo ${ZRAM_SIZE_LIMIT} > /sys/block/$devname/mem_limit
+fi