aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/zram-swap
diff options
context:
space:
mode:
authorRui Salvaterra <rsalvaterra@gmail.com>2021-06-24 20:05:22 +0100
committerPaul Spooren <mail@aparcar.org>2021-06-27 14:44:28 -1000
commit7720de419411562cdf08eb98ace7416fe33eeb43 (patch)
tree8e56892b916b39c1df2d1766741b0b553f216e6f /package/system/zram-swap
parentf727005ae976fdd85f31690f5381d5db51b87701 (diff)
downloadupstream-7720de419411562cdf08eb98ace7416fe33eeb43.tar.gz
upstream-7720de419411562cdf08eb98ace7416fe33eeb43.tar.bz2
upstream-7720de419411562cdf08eb98ace7416fe33eeb43.zip
zram-swap: set the zram swap priority to 100 by default
New swap devices are added in decreasing priority order, starting at -1. Make sure the zram swap device has the highest priority, by default. Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
Diffstat (limited to 'package/system/zram-swap')
-rwxr-xr-xpackage/system/zram-swap/files/zram.init7
1 files changed, 5 insertions, 2 deletions
diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init
index 9fce5e4797..ea9b55680e 100755
--- a/package/system/zram-swap/files/zram.init
+++ b/package/system/zram-swap/files/zram.init
@@ -144,7 +144,10 @@ start()
local zram_size="$( zram_getsize )"
local zram_priority="$( uci -q get system.@system[0].zram_priority )"
- zram_priority=${zram_priority:+-p $zram_priority}
+
+ if [ -z "$zram_priority" ]; then
+ zram_priority="100"
+ fi
logger -s -t zram_start -p daemon.debug "activating '$zram_dev' for swapping ($zram_size MegaBytes)"
@@ -152,7 +155,7 @@ start()
zram_comp_algo "$zram_dev"
echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename "$zram_dev" )/disksize"
busybox mkswap "$zram_dev"
- busybox swapon -d $zram_priority "$zram_dev"
+ busybox swapon -d -p $zram_priority "$zram_dev"
}
stop()