diff options
author | Sinan Kaya <okaya@kernel.org> | 2021-04-23 20:03:25 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-04-23 21:41:26 -0700 |
commit | cb1cf053785bcb5670b2eca7051aa11f29ef80b1 (patch) | |
tree | 7cb4a27ed5d81d05656bba70f348a7faa3e39c57 | |
parent | a7d0d878542ec24d718972423b34c59aa5bd2498 (diff) | |
download | meta-openembedded-cb1cf053785bcb5670b2eca7051aa11f29ef80b1.tar.gz |
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>
-rwxr-xr-x | meta-oe/recipes-extended/zram/zram/zram-swap-init | 5 |
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 | |||
24 | 24 | ||
25 | zramctl -a ${ZRAM_ALGORITHM} -s ${memzram}KB $device | 25 | zramctl -a ${ZRAM_ALGORITHM} -s ${memzram}KB $device |
26 | mkswap -L "zram-swap" $device | 26 | mkswap -L "zram-swap" $device |
27 | |||
28 | devname="${device##*/}" | ||
29 | if [ ! -z ${ZRAM_SIZE_LIMIT+x} ]; then | ||
30 | echo ${ZRAM_SIZE_LIMIT} > /sys/block/$devname/mem_limit | ||
31 | fi | ||