[openwrt/openwrt] zram-swap: enable swap discard

LEDE Commits lede-commits at lists.infradead.org
Sat Jul 11 09:54:38 EDT 2020


ynezz pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/0bd7dfa3ed60588ec83a8f60f48b6991ebb16940

commit 0bd7dfa3ed60588ec83a8f60f48b6991ebb16940
Author: Rui Salvaterra <rsalvaterra at gmail.com>
AuthorDate: Tue Jun 23 12:29:54 2020 +0100

    zram-swap: enable swap discard
    
    Zram block devices have supported trim/discard for over six years, let's
    enable it. This allows the zram device to actually free up allocated memory
    when it's marked as unused in the filesystem metadata, as explained in more
    detail in the original commit message [1].
    
    [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/block/zram/zram_drv.c?h=linux-4.14.y&id=f4659d8e620d08bd1a84a8aec5d2f5294a242764
    
    Signed-off-by: Rui Salvaterra <rsalvaterra at 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 c855bbc087..a6126e578f 100755
--- a/package/system/zram-swap/files/zram.init
+++ b/package/system/zram-swap/files/zram.init
@@ -182,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_priority "$zram_dev"
+	swapon -d $zram_priority "$zram_dev"
 }
 
 stop()



More information about the lede-commits mailing list