diff mbox

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

Message ID 1432929632-19956-1-git-send-email-j.orti.alcaine@gmail.com
State Accepted
Headers show

Commit Message

Juan Orti Alcaine May 29, 2015, 8 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.

---
v2:
  Fallback to no priority when swapon doesn't support it.

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

Juan Orti Alcaine May 29, 2015, 8:02 p.m. UTC | #1
Sorry, this is the good one. I sent the wrong patch in my previous email.

2015-05-29 22:00 GMT+02:00 Juan Orti Alcaine <j.orti.alcaine@gmail.com>:
> 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.
>
> ---
> v2:
>   Fallback to no priority when swapon doesn't support it.
>
> 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(-)
>
> diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init
> index 23de915..44f75dd 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" || swapon "$zram_dev"
>         } done
>  }
>
> --
> 2.4.1
>
diff mbox

Patch

diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init
index 23de915..44f75dd 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" || swapon "$zram_dev"
 	} done
 }