You are not logged in.

#1 2025-04-25 01:10:01

Martinchoox
Member
Registered: 2025-04-25
Posts: 4

The PC freezes and does not use swap memory.

My PC is freezing and is not using the swap memory even though the swappines is set to 60. I ran memfill which is a program that fills the memory (I can provide the program code if necessary). As a result, the PC froze. In addition, in htop, the swap memory was unused at the time it froze. I don't know how to debug it because the PC freezes and I can't access it via SSH or TTY.

Offline

#2 2025-04-25 07:31:24

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,298

Re: The PC freezes and does not use swap memory.

Start by elaborating on your swap setup and notably whether you (also) use https://wiki.archlinux.org/title/Zswap and or https://wiki.archlinux.org/title/Zram

The swappiness factor dictates whether the system will rather swap out anon-pages or drop file caches when you run OOM, it will not lead to swap being used earlier, when plenty of free RAM is available.

zswap can completely explode into your face - notably when filling the memory with synthetic, possbily very compressible patterns (so by the tiem your actually run OOM, you've  1TB worth of swap compressed into 100MB zswap)
The system will "freeze" for the kswapd being busy, until the OOM killer steps in because you're out of RAM and SWAP.

Offline

#3 2025-04-25 19:41:01

Martinchoox
Member
Registered: 2025-04-25
Posts: 4

Re: The PC freezes and does not use swap memory.

Hi, I'm using both (Zram and Zswap) and also 2GB of swapfile. My current setup is:

File: /proc/swaps

/dev/zram0                              partition   8138236     0       100
/media/m2/swapfile                      file        2097148     0       -2

File: /proc/sys/vm/swappiness

20

File: /etc/systemd/zram-generator.conf

[zram0]
zram-size = ram / 2
compression-algorithm = zstd
swap-priority = 100

A part of the file: /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet ipv6.disable=0 amd_iommu=on iommu=pt nouveau.modeset=0 nvidia-drm.modeset=1 nvidia_drm.fbdev=1 pcie_acs_override=downstream,multifunction video=efifb:off ibt=off psi=1 zswap.enabled=1 zswap.compressor=zstd zswap.max_pool_percent=20 zswap.zpool=z3fold sysrq_always_enabled=1"

GRUB_CMDLINE_LINUX="rootfstype=ext4 initcall_blacklist=simpledrm_platform_driver_init"

If necessary, I add my PC specs:

mchoox@mchoox
---------------------
Motherboard: Asus Tuf b450m plus II
OS: Arch Linux x86_64
Kernel: 6.14.3-zen1-1-zen
Uptime: 1 hour, 47 mins
Packages: 2228 (pacman), 2 (brew), 52 (nix-user)
Shell: zsh 5.9
Resolution: 1920x1080
DE: Hyprland
WM: sway
Theme: Adwaita [GTK2/3]
Icons: Adwaita-Red [GTK2/3]
Terminal: alacritty
CPU: AMD Ryzen 3 3100 (8) @ 4.123GHz
GPU: NVIDIA GeForce GTX 1070
Memory: 2233MiB / 15895MiB
Drives:
sda    disk 465,8G TOSHIBA DT01ACA050
sdb    disk 111,8G KINGSTON SA400S37120G
sdc    disk 238,5G SAMSUNG MZNLN256HCHP-000L2
sdd    disk 298,1G WDC WD3200LPVX-22V0TT0
---------------------

It also happens that the PC freezes randomly, for example when I transfer large files or try to import a large image in Docker and in htop the RAM consumption is not reflected and it does not use swap, zram or zswap.

Last edited by Martinchoox (2025-04-25 19:50:59)

Offline

#4 2025-04-25 19:48:21

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,298

Re: The PC freezes and does not use swap memory.

Please use [code][/code] tags. Edit your post in this regard.

Hi, I'm using both (Zram and Zswap)

Don't - they're mutually exclusive (resp. using both makes no sense at all, you're just creating overhead)
Check the wiki for an oversight and then pick one and see what impact that has.
If you go for zswap, try w/o the custom settings

File copies will fill up the file cache, not sure in how far htop reflects that)

Sidebar: "ibt=off" is most likely no longer needed, neither is "nouveau.modeset=0" if you're using nvidia anyway (plus disabling kms is hardly what you want ever), fbdev=1 is meanwhile default (so likely pointless) - and why are you enforcing the iommu?

Offline

#5 2025-04-25 19:56:42

Martinchoox
Member
Registered: 2025-04-25
Posts: 4

Re: The PC freezes and does not use swap memory.

I'm enforcing the iommu because I used to use Virt Manager with GPU passthrough but I don't use it anymore. If that has any influence, I have no problem disabling it.

Offline

#6 2025-04-25 20:04:08

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,298

Re: The PC freezes and does not use swap memory.

You should™ not have had to enforce it tbw - it's mandatory but you want that to be available automatically.

Might be related, but my money is on your swap config (colliding zram/zswap, maybe the custom zswap parameters)

Offline

#7 2025-05-08 20:15:17

Martinchoox
Member
Registered: 2025-04-25
Posts: 4

Re: The PC freezes and does not use swap memory.

I don't know why but I solved the freezes by changing the kernel from linux-zen to linux-xanmod-edge-x64v3. I also tried changing from linux-zen to linux-cachyos but the same problem occurred. Now i am using linux-xanmod-edge-x64v3

Last edited by Martinchoox (2025-05-08 20:16:59)

Offline

#8 2025-05-08 20:18:59

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,298

Re: The PC freezes and does not use swap memory.

Do you still use zswap and zram together?

Offline

Board footer

Powered by FluxBB