From 52b786a6b30b8eb34245ba3244cab42d3aa0bb82 Mon Sep 17 00:00:00 2001 From: Chris Murphy Date: Jun 26 2019 01:13:02 +0000 Subject: [PATCH 1/3] clarify factor relationship --- diff --git a/zram.conf b/zram.conf index c4c5cb5..bff45ba 100644 --- a/zram.conf +++ b/zram.conf @@ -1,4 +1,4 @@ -# The factor is the percentage of total system RAM to allocate to the ZRAM block device(s). +# The factor determines the ratio 1/n of RAM to allocate to the ZRAM block device, where FACTOR = n. FACTOR=2 PRIORITY=1000 From b41e31f20549630bd57521694cf139b9ad26055c Mon Sep 17 00:00:00 2001 From: Chris Murphy Date: Jun 26 2019 01:13:53 +0000 Subject: [PATCH 2/3] fix typos --- diff --git a/zramstart b/zramstart index 91bdd64..f6a05e6 100755 --- a/zramstart +++ b/zramstart @@ -12,7 +12,7 @@ priority=32767 mem_total=$(free -w |grep "^Mem" |awk '{printf("%d",$2)}') zram_size=$((${mem_total} / ${factor} /1024)) -# zram in recent kernels is multitreaded so we don't need to balance across CPUs +# ZRAM in recent kernels is multithreaded so we don't need to balance across CPUs modprobe -q zram num_devices=1 # Create ZRAM with first device, lz4 algorithm From 606846f61f7c4d2839152f2905aca2713d19eed4 Mon Sep 17 00:00:00 2001 From: Chris Murphy Date: Jun 26 2019 01:15:28 +0000 Subject: [PATCH 3/3] reset zram device following swapoff This will hot remove the /dev/zram device node following successful swapoff, unloading the module is unnecessary. --- diff --git a/zramstop b/zramstop index 42eea41..0777797 100755 --- a/zramstop +++ b/zramstop @@ -1,10 +1,5 @@ #!/bin/sh for i in $(grep '^/dev/zram' /proc/swaps | awk '{ print $1 }'); do - swapoff "$i" + swapoff "$i" && zramctl --reset "$i" done - -if grep -q "^zram " /proc/modules; then - sleep 1 - rmmod zram -fi