zswap settings not taking effect despite changes to the relevant files.

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
abdoalihuss
Level 1
Level 1
Posts: 5
Joined: Mon Aug 15, 2022 10:06 am

zswap settings not taking effect despite changes to the relevant files.

Post by abdoalihuss »

So I wanted to use zswap to improve the performance of my machine following this link => https://easylinuxtipsproject.blogspot.c ... -mint.html

I have done exactly as described, but for some reason, the settings/changes aren't taking effect. For example, when I run the following command, sudo grep -R . /sys/module/zswap/parameters | grep -in enabled, I get the following result:

Code: Select all

1:/sys/module/zswap/parameters/same_filled_pages_enabled:Y
2:/sys/module/zswap/parameters/enabled:N
I assume that means the zswap isn't enabled. Also, I tried to change the percentages of the zswap to see if any change is reflected, but none whatsoever.

Here is my /etc/default/grub file,

Code: Select all

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash zswap.enabled=1 zswap.compressor=lz4 zswap.max_pool_percent=35 zswap.zpool=z3fold"
GRUB_CMDLINE_LINUX="quiet splash zswap.enabled=1 zswap.compressor=lz4 zswap.max_pool_percent=35 zswap.zpool=z3fold"


# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
Here is my system details,

Code: Select all

System:    Kernel: 5.4.0-132-generic x86_64 bits: 64 compiler: gcc v: 9.4.0 Desktop: Gnome 3.36.9 Distro: Linux Mint 20.3 Una 
           base: Ubuntu 20.04 focal 
Machine:   Type: Laptop System: Acer product: Aspire E1-572G v: V2.17 serial: <filter> 
           Mobo: Acer model: EA50_HW v: V2.17 serial: <filter> UEFI: Insyde v: 2.17 date: 09/02/2014 
Battery:   ID-1: BAT1 charge: 3.6 Wh condition: 3.6/37.0 Wh (10%) model: SANYO AL12A32 status: Full 
CPU:       Topology: Dual Core model: Intel Core i7-4500U bits: 64 type: MT MCP arch: Haswell rev: 1 L2 cache: 4096 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 19155 
           Speed: 870 MHz min/max: 800/3000 MHz Core speeds (MHz): 1: 798 2: 798 3: 798 4: 798 
Graphics:  Device-1: Intel Haswell-ULT Integrated Graphics vendor: Acer Incorporated ALI driver: i915 v: kernel 
           bus ID: 00:02.0 
           Device-2: Advanced Micro Devices [AMD/ATI] Opal XT [Radeon R7 M265/M365X/M465] 
           vendor: Acer Incorporated ALI Aspire V5 driver: N/A bus ID: 03:00.0 
           Display: x11 server: X.Org 1.20.13 driver: modesetting unloaded: fbdev,vesa resolution: 1366x768~60Hz 
           OpenGL: renderer: Mesa DRI Intel HD Graphics 4400 (HSW GT2) v: 4.5 Mesa 21.2.6 direct render: Yes 
Audio:     Device-1: Intel Haswell-ULT HD Audio vendor: Acer Incorporated ALI driver: snd_hda_intel v: kernel bus ID: 00:03.0 
           Device-2: Intel 8 Series HD Audio vendor: Acer Incorporated ALI driver: snd_hda_intel v: kernel bus ID: 00:1b.0 
           Sound Server: ALSA v: k5.4.0-132-generic 
Network:   Device-1: Broadcom and subsidiaries NetXtreme BCM57786 Gigabit Ethernet PCIe vendor: Acer Incorporated ALI 
           driver: tg3 v: 3.137 port: 4040 bus ID: 01:00.0 
           IF: enp1s0f0 state: down mac: <filter> 
           Device-2: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter vendor: Foxconn driver: ath9k v: kernel 
           port: 4040 bus ID: 02:00.0 
           IF: wlp2s0 state: up mac: <filter> 
           IF-ID-1: br-89e4c5d9c400 state: down mac: <filter> 
           IF-ID-2: docker0 state: down mac: <filter> 
Drives:    Local Storage: total: 1.02 TiB used: 210.10 GiB (20.1%) 
           ID-1: /dev/sda vendor: Kingston model: SA400S37120G size: 111.79 GiB temp: 32 C 
           ID-2: /dev/sdb vendor: Western Digital model: WD10JPVX-22JC3T0 size: 931.51 GiB temp: 38 C 
Partition: ID-1: / size: 103.30 GiB used: 73.42 GiB (71.1%) fs: ext4 dev: /dev/sda1 
           ID-2: swap-1 size: 6.27 GiB used: 2.39 GiB (38.2%) fs: swap dev: /dev/sda2 
Sensors:   System Temperatures: cpu: 62.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Info:      Processes: 306 Uptime: 4h 48m Memory: 3.72 GiB used: 2.87 GiB (77.1%) Init: systemd runlevel: 5 Compilers: 
           gcc: 9.4.0 Shell: bash v: 5.0.17 inxi: 3.0.38 

Full disclosure, I have grub-customizer installed. I update the grub using the usual update-grub & not grub-customizer, so I don't know what might be causing the issue. Any help is appreciated.
Last edited by LockBot on Thu May 25, 2023 10:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Termy
Level 12
Level 12
Posts: 4254
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: zswap settings not taking effect despite changes to the relevant files.

Post by Termy »

Is the module loaded? Probably a daft question, since it's showing up in SYSFS ('/sys'), but as I'm not that familiar with zswap, I thought I'd check.

Are you just wanting to have a swapfile in RAM instead of on a disk? You could set up a swap file on a TMPFS RAM disk, which might be easier to set up. I use TMPFS for all sorts (mainly '/tmp'), but I'm not sure I've tried putting a swap file on it. Knowing me, I probably have. :lol: You'd have to edit '/etc/fstab' with a valid TMPFS entry.

Honestly, if you can get an SSD, that'd be the way to go. With your limited RAM, I wouldn't even be considering any of this, but I suppose it depends on your usage.
I'm also Terminalforlife on GitHub.
abdoalihuss
Level 1
Level 1
Posts: 5
Joined: Mon Aug 15, 2022 10:06 am

Re: zswap settings not taking effect despite changes to the relevant files.

Post by abdoalihuss »

Termy wrote: Sat Nov 26, 2022 3:31 pm Is the module loaded? Probably a daft question, since it's showing up in SYSFS ('/sys'), but as I'm not that familiar with zswap, I thought I'd check.

Are you just wanting to have a swapfile in RAM instead of on a disk? You could set up a swap file on a TMPFS RAM disk, which might be easier to set up. I use TMPFS for all sorts (mainly '/tmp'), but I'm not sure I've tried putting a swap file on it. Knowing me, I probably have. :lol: You'd have to edit '/etc/fstab' with a valid TMPFS entry.

Honestly, if you can get an SSD, that'd be the way to go. With your limited RAM, I wouldn't even be considering any of this, but I suppose it depends on your usage.
Hi there. Thanks for replying. I already have SSD. But the machine's memory is only 4 GB. I have the usual swap partition setup & enabled, but as per the link in the original post, the author(@Pjotr) suggested one additional way to optimize performance and at the same time preserve the long-term performance & health of an SSD drive is to use zswap. I followed the guide to a tee and it still wasn't enabled. So I'm wondering what did I miss or need to do to get it working.
User avatar
Termy
Level 12
Level 12
Posts: 4254
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: zswap settings not taking effect despite changes to the relevant files.

Post by Termy »

abdoalihuss wrote: Sat Nov 26, 2022 4:15 pm [...]
I'm told zswap pretty much does the same thing as I was suggesting with TMPFS, but, unlike TMPFS, it will also compress the data, which is actually pretty cool. Hopefully you can get it sorted, but I'm still sceptical as to whether it'd be worthwhile with your amount of RAM. If you get it sorted, I'd love an update as to whether you notice a difference. :) You could always send Pjotr a PM.
I'm also Terminalforlife on GitHub.
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: zswap settings not taking effect despite changes to the relevant files.

Post by SMG »

Moderator note: iluvgriffith's similar issue can be found here zswap settings not taking effect after rebooting despite changes to the relevant files..
Image
A woman typing on a laptop with LM20.3 Cinnamon.
EOS
Level 1
Level 1
Posts: 1
Joined: Sat Jan 21, 2023 3:34 am

Re: zswap settings not taking effect despite changes to the relevant files.

Post by EOS »

Hello.
If I use the parameter

Code: Select all

zswap.zpool=z3fold
and do

Code: Select all

sudo dmesg | grep -i "zswap"
I will be notified:

Code: Select all

[    1.087653] zswap: zpool z3fold not available, using default zbud
[    1.088575] zswap: loaded using pool lzo/zbud
Maybe you could try without it (zswap.zpool=z3fold). I use 5.15.0-58-generic kernel.

Edit.
On my machine it was due to a missing module.
I did according to this page:
https://askubuntu.com/questions/991953/ ... d-to-zswap
And re-generated grub config and now I have z3fold enabled:

Code: Select all

grep -R . /sys/module/zswap/parameters
/sys/module/zswap/parameters/same_filled_pages_enabled:Y
/sys/module/zswap/parameters/enabled:Y
/sys/module/zswap/parameters/max_pool_percent:33
/sys/module/zswap/parameters/compressor:lzo
/sys/module/zswap/parameters/zpool:z3fold
/sys/module/zswap/parameters/accept_threshold_percent:90
Locked

Return to “Other topics”