diff mbox

[OpenWrt-Devel] zram-swap: set a high priority for the swap

Message ID 1432505332-18899-1-git-send-email-j.orti.alcaine@gmail.com
State Superseded
Headers show

Commit Message

Juan Orti Alcaine May 24, 2015, 10:08 p.m. UTC
The zram swap must be activated with a higher priority than
disk-based swap, so it is used before any other.
This patch activates the zram-based swap with a priority of 100.

Signed-off-by: Juan Orti Alcaine <j.orti.alcaine@gmail.com>
---
 package/system/zram-swap/files/zram.init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bastian Bittorf May 27, 2015, 2:09 p.m. UTC | #1
* Juan Orti Alcaine <j.orti.alcaine@gmail.com> [26.05.2015 07:59]:
> -		swapon "$zram_dev"
> +		swapon -p 100 "$zram_dev"

please use at least:

swapon -p X $dev || swapon $dev

so it can work even without '-p' option,
which is optional in busybox.

bye, bastian
diff mbox

Patch

diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init
index 23de915..b26ee0d 100644
--- a/package/system/zram-swap/files/zram.init
+++ b/package/system/zram-swap/files/zram.init
@@ -100,7 +100,7 @@  start()
 		zram_reset "$zram_dev" "enforcing defaults"
 		echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename $zram_dev )/disksize"
 		mkswap "$zram_dev"
-		swapon "$zram_dev"
+		swapon -p 100 "$zram_dev"
 	} done
 }