Skip to content

Commit 4d14455

Browse files
committed
udev: Rework ZRAM rule
This ensures that high swappiness and Zswap disabling is not applied when user has masked zram-generator service. Signed-off-by: Vasiliy Stelmachenok <[email protected]>
1 parent a961b12 commit 4d14455

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

usr/lib/tmpfiles.d/disable-zswap.conf

Lines changed: 0 additions & 3 deletions
This file was deleted.

usr/lib/udev/rules.d/30-zram.rules

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
TEST!="/dev/zram0", GOTO="zram_end"
2-
31
# When used with ZRAM, it is better to prefer page out only anonymous pages,
42
# because it ensures that they do not go out of memory, but will be just
53
# compressed. If we do frequent flushing of file pages, that increases the
@@ -9,6 +7,8 @@ TEST!="/dev/zram0", GOTO="zram_end"
97
# the page cache as hermetic as possible, because otherwise it is "expensive"
108
# to read data from disk again. At the same time, uncompressing pages from ZRAM
119
# is not as expensive and is usually very fast on modern CPUs.
12-
SYSCTL{vm.swappiness}="150"
13-
14-
LABEL="zram_end"
10+
#
11+
# Also it's better to disable Zswap, as this may prevent ZRAM from working
12+
# properly or keeping a proper count of compressed pages via zramctl.
13+
ACTION=="change", KERNEL=="zram0", ATTR{initstate}=="1", SYSCTL{vm.swappiness}="150", \
14+
RUN+="/bin/sh -c 'echo N > /sys/module/zswap/parameters/enabled'"

0 commit comments

Comments
 (0)