aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/zram-swap/files
diff options
context:
space:
mode:
authorMaxim Storchak <m.storchak@gmail.com>2020-01-09 20:27:44 +0200
committerJohn Crispin <john@phrozen.org>2020-01-15 20:49:00 +0100
commit5f07b6f367ff10ecc029e0b9e41b9fc5eac6968e (patch)
treef7e48d29fcae788fdd9af08863ad4e51c9aae418 /package/system/zram-swap/files
parentc9ac7b17296ff29d9df39db8a68c449ef1514bbd (diff)
downloadupstream-5f07b6f367ff10ecc029e0b9e41b9fc5eac6968e.tar.gz
upstream-5f07b6f367ff10ecc029e0b9e41b9fc5eac6968e.tar.bz2
upstream-5f07b6f367ff10ecc029e0b9e41b9fc5eac6968e.zip
zram-swap: support swap priority
If zram-backed swap is added after an existing swap, it gets a lower priority. Assiming that usually all other swaps are slower, there should be a way to assign a higher priority to zram swap. Signed-off-by: Maxim Storchak <m.storchak@gmail.com>
Diffstat (limited to 'package/system/zram-swap/files')
-rwxr-xr-xpackage/system/zram-swap/files/zram.init4
1 files changed, 3 insertions, 1 deletions
diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init
index ae432f3b00..49140ad406 100755
--- a/package/system/zram-swap/files/zram.init
+++ b/package/system/zram-swap/files/zram.init
@@ -172,6 +172,8 @@ start()
local zram_size="$( zram_getsize )"
local zram_dev="$( zram_getdev )"
zram_applicable "$zram_dev" || return 1
+ local zram_priority="$( uci -q get system.@system[0].zram_priority )"
+ zram_priority=${zram_priority:+-p $zram_priority}
logger -s -t zram_start -p daemon.debug "activating '$zram_dev' for swapping ($zram_size MegaBytes)"
@@ -180,7 +182,7 @@ start()
zram_comp_streams "$zram_dev"
echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename "$zram_dev" )/disksize"
mkswap "$zram_dev"
- swapon "$zram_dev"
+ swapon $zram_priority "$zram_dev"
}
stop()