[Swap Issue] Kernel ignores 8GB swapfile under memory pressure despite swappiness=100

Hello Manjaro Community,

I’m experiencing an issue with swap behavior after changing my swap file size from 4 GB to 8 GB. Despite rigorous tuning, the kernel refuses to use swap under memory pressure, causing system crashes.

System Details

  • Manjaro: 6.12.39-1 LTS (BSPWM)
  • Hardware:
  • CPU: Intel Core i3-4170 (4 threads)
  • RAM: 12 GB DDR3
  • Storage: 1 TB HDD (ext4 root, swap file on the same filesystem)
  • Kernel Parameters:
    transparent_hugepage=never udev.log_priority=3 nvidia-drm.modeset=1

Issue Summary

  • Previously: The 4 GB swap file was working perfectly (used when RAM was full)
  • Now: After creating the 8 GB swap file (using fallocate/dd), the swap file shows no activity even with:
  • vm.swappiness=100
  • THP disabled
  • Default boot pressure setting Aggressive cache
  • Consequence: System crashes when RAM is about to run out (10-11 GB used)

Diagnostic evidence

  1. Swap is active, but unused:
    $ free -h
    total used free shared buff/cache available
    Mem: 11Gi 10Gi 768Mi 223Mi 959Mi 1.3Gi
    Swap: 8.0Gi 524Ki 8.0Gi

  2. Kernel messages show swap initialization but no activity during pressure.

What I’ve Tried

  1. Created swapfile via both fallocate and dd (with conv=fdatasync).
  2. Tested a dedicated swap partition and direct /dev/loopX mapping.
  3. Swappiness set from default 60 → 100.
  4. Disabled Transparent HugePages.
  5. Tuned kernel parameters:
  • vm.vfs_cache_pressure=150–200
  • vm.min_free_kbytes=20480–51200
  1. Switched kernels (currently 6.12.39-1 LTS).
  2. Installed and configured earlyoom.
  3. Relaxed overcommit (vm.overcommit_memory=1, vm.overcommit_ratio=100).

Full Technical Report

===== System Information =====
System:
  Kernel: 6.12.34-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 15.1.1
    clocksource: tsc avail: hpet,acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.12-x86_64
    root=UUID=0112145f-5715-4b71-a6cf-525bdad5b9ba rw quiet splash
    transparent_hugepage=never udev.log_priority=3 nvidia-drm.modeset=1
  Desktop: bspwm v: 0.9.10 with: polybar tools: avail: i3lock vt: 2 dm: SDDM
    Distro: Manjaro base: Arch Linux
Machine:
  Type: Desktop Mobo: ASRock model: H81M-VG4 R2.0 serial: <superuser required>
    uuid: <superuser required> BIOS: American Megatrends v: P1.30
    date: 04/24/2015
CPU:
  Info: model: Intel Core i3-4170 bits: 64 type: MT MCP arch: Haswell
    gen: core 4 level: v3 note: check built: 2013-15 process: Intel 22nm
    family: 6 model-id: 0x3C (60) stepping: 3 microcode: 0x28
  Topology: cpus: 1x dies: 1 clusters: 2 cores: 2 threads: 4 tpc: 2
    smt: enabled cache: L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB
    desc: 2x256 KiB L3: 3 MiB desc: 1x3 MiB
  Speed (MHz): avg: 3697 min/max: 800/3700 scaling: driver: intel_cpufreq
    governor: schedutil cores: 1: 3697 2: 3697 3: 3697 4: 3697 bogomips: 29606
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: indirect_target_selection status: Not affected
  Type: itlb_multihit status: KVM: Split huge pages
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data status: Unknown: No mitigations
  Type: reg_file_data_sampling status: Not affected
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines; IBPB: conditional; IBRS_FW;
    STIBP: conditional; RSB filling; PBRSB-eIBRS: Not affected; BHI: Not
    affected
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA GM107 [GeForce GTX 750 Ti] vendor: eVga.com. driver: nvidia
    v: 575.64 alternate: nouveau,nvidia_drm non-free: 550-570.xx+ status: current
    (as of 2025-04; EOL~2026-12-xx) arch: Maxwell code: GMxxx
    process: TSMC 28nm built: 2014-2019 pcie: gen: 1 speed: 2.5 GT/s lanes: 16
    link-max: gen: 2 speed: 5 GT/s ports: active: none off: HDMI-A-1
    empty: DP-1,DVI-I-1 bus-ID: 01:00.0 chip-ID: 10de:1380 class-ID: 0300
  Display: x11 server: X.Org v: 21.1.18 with: Xwayland v: 24.1.8 driver: X:
    loaded: nvidia gpu: nvidia,nvidia-nvswitch display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1366x768 s-dpi: 84 s-size: 413x232mm (16.26x9.13")
    s-diag: 474mm (18.65")
  Monitor-1: HDMI-A-1 mapped: HDMI-0 note: disabled model: Samsung T19B300
    built: 2010 res: mode: 1366x768 hz: 60 scale: 100% (1) dpi: 85 gamma: 1.4
    size: 410x230mm (16.14x9.06") diag: 470mm (18.5") ratio: 16:9 modes:
    max: 1366x768 min: 640x480
  API: EGL v: 1.5 hw: drv: nvidia platforms: device: 0 drv: nvidia device: 2
    drv: swrast gbm: drv: nvidia surfaceless: drv: nvidia x11: drv: nvidia
    inactive: wayland,device-1
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 575.64
    glx-v: 1.4 direct-render: yes renderer: NVIDIA GeForce GTX 750 Ti/PCIe/SSE2
    memory: 1000 MiB
  API: Vulkan v: 1.4.313 layers: 6 device: 0 type: discrete-gpu name: NVIDIA
    GeForce GTX 750 Ti driver: nvidia v: 575.64 device-ID: 10de:1380
    surfaces: N/A
  Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo
    de: kscreen-console,kscreen-doctor gpu: nvidia-settings,nvidia-smi
    wl: wayland-info x11: xdpyinfo, xprop, xrandr
Audio:
  Device-1: Intel 8 Series/C220 Series High Definition Audio vendor: ASRock
    driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:8c20
    class-ID: 0403
  Device-2: NVIDIA GM107 High Definition Audio [GeForce 940MX]
    vendor: eVga.com. driver: snd_hda_intel v: kernel pcie: gen: 2 speed: 5 GT/s
    lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:0fbc class-ID: 0403
  API: ALSA v: k6.12.34-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: PipeWire v: 1.4.5 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
    vendor: ASRock driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1
    port: d000 bus-ID: 03:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp3s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Info: services: NetworkManager,systemd-timesyncd
Drives:
  Local Storage: total: 931.51 GiB used: 534.17 GiB (57.3%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: Toshiba model: DT01ACA100
    size: 931.51 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    tech: HDD rpm: 7200 serial: <filter> fw-rev: A750 scheme: MBR
Partition:
  ID-1: / raw-size: 99.19 GiB size: 97.07 GiB (97.87%) used: 79.77 GiB (82.2%)
    fs: ext4 dev: /dev/sda2 maj-min: 8:2
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: file size: 8 GiB used: 524 KiB (0.0%) priority: -2
    file: /swapfile
Sensors:
  System Temperatures: cpu: 45.0 C mobo: N/A gpu: nvidia temp: 34 C
  Fan Speeds (rpm): N/A gpu: nvidia fan: 40%
Info:
  Memory: total: 12 GiB available: 11.62 GiB used: 4.74 GiB (40.8%)
  Processes: 216 Power: uptime: 28m states: freeze,mem,disk suspend: deep
    avail: s2idle wakeups: 0 hibernate: platform avail: shutdown, reboot,
    suspend, test_resume image: 4.56 GiB
    services: power-profiles-daemon,upowerd Init: systemd v: 257
    default: graphical tool: systemctl
  Packages: 1826 pm: pacman pkgs: 1799 libs: 548 tools: pamac,yay
    pm: flatpak pkgs: 27 Compilers: clang: 20.1.6 gcc: 15.1.1 Shell: Zsh v: 5.9
    default: Bash v: 5.2.37 running-in: konsole inxi: 3.3.38

===== Memory and Swap Status =====
               total       usado       libre  compartido   búf/caché  disponible
Mem:            11Gi       4,9Gi       5,7Gi       239Mi       1,4Gi       6,7Gi
Inter:         8,0Gi       524Ki       8,0Gi
NAME      TYPE SIZE USED PRIO
/swapfile file   8G 524K   -2
SwapCached:            0 kB
SwapTotal:       8388604 kB
SwapFree:        8388080 kB
Zswap:                 0 kB
Zswapped:              0 kB

===== Swap Configuration =====
-rw------- 1 root root 8,0G jul 21 14:42 /swapfile
/swapfile   none   swap   sw   0 0

===== Kernel Parameters =====
vm.swappiness = 60
vm.vfs_cache_pressure = 100
vm.min_free_kbytes = 51200
vm.overcommit_memory = 0

===== THP Configuration =====
always madvise [never]
always defer defer+madvise madvise [never]

===== Relevant Kernel Messages =====
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-6.12-x86_64 root=UUID=0112145f-5715-4b71-a6cf-525bdad5b9ba rw quiet splash transparent_hugepage=never udev.log_priority=3 nvidia-drm.modeset=1
[    0.000000] DMI: Memory slots populated: 2/2
[    0.007504] ACPI: Reserving FACP table memory at [mem 0xdd8fc7c0-0xdd8fc8cb]
[    0.007506] ACPI: Reserving DSDT table memory at [mem 0xdd8f2190-0xdd8fc7be]
[    0.007506] ACPI: Reserving FACS table memory at [mem 0xdd913080-0xdd9130bf]
[    0.007507] ACPI: Reserving APIC table memory at [mem 0xdd8fc8d0-0xdd8fc941]
[    0.007507] ACPI: Reserving FPDT table memory at [mem 0xdd8fc948-0xdd8fc98b]
[    0.007508] ACPI: Reserving SSDT table memory at [mem 0xdd8fc990-0xdd8fcec8]
[    0.007509] ACPI: Reserving SSDT table memory at [mem 0xdd8fced0-0xdd8fd9a7]
[    0.007509] ACPI: Reserving SSDT table memory at [mem 0xdd8fd9a8-0xdd8fdb6e]
[    0.007510] ACPI: Reserving MCFG table memory at [mem 0xdd8fdb70-0xdd8fdbab]
[    0.007510] ACPI: Reserving HPET table memory at [mem 0xdd8fdbb0-0xdd8fdbe7]
[    0.007511] ACPI: Reserving SSDT table memory at [mem 0xdd8fdbe8-0xdd8fdf54]
[    0.007511] ACPI: Reserving SSDT table memory at [mem 0xdd8fdf58-0xdd9013ea]
[    0.007512] ACPI: Reserving AAFT table memory at [mem 0xdd9013f0-0xdd9016aa]
[    0.007744] Early memory node ranges
[    0.028181] PM: hibernation: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.028182] PM: hibernation: Registered nosave memory: [mem 0x0009d000-0x000fffff]
[    0.028184] PM: hibernation: Registered nosave memory: [mem 0xcb24e000-0xcb254fff]
[    0.028185] PM: hibernation: Registered nosave memory: [mem 0xcb9a5000-0xcbbdcfff]
[    0.028186] PM: hibernation: Registered nosave memory: [mem 0xdd614000-0xdd819fff]
[    0.028187] PM: hibernation: Registered nosave memory: [mem 0xdd86e000-0xddffefff]
[    0.028188] PM: hibernation: Registered nosave memory: [mem 0xde000000-0xffffffff]
[    0.033340] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-6.12-x86_64 root=UUID=0112145f-5715-4b71-a6cf-525bdad5b9ba rw quiet splash transparent_hugepage=never udev.log_priority=3 nvidia-drm.modeset=1
[    0.105725] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
[    0.122382] Freeing SMP alternatives memory: 40K
[    0.130278] Memory: 11933200K/12521240K available (18432K kernel code, 2672K rwdata, 14344K rodata, 4284K init, 4280K bss, 578804K reserved, 0K cma-reserved)
[    0.130557] x86/mm: Memory block size: 128MB
[    0.266615] Non-volatile memory driver v1.3
[    0.471682] Freeing initrd memory: 235800K
[    0.702959] Freeing unused decrypted memory: 2028K
[    0.704520] Freeing unused kernel image (initmem) memory: 4284K
[    0.706318] Freeing unused kernel image (rodata/data gap) memory: 2040K
[    8.802198] systemd[1]: Activating swap /swapfile...
[    9.313280] Adding 8388604k swap on /swapfile.  Priority:-2 extents:1693 across:103645184k 
[    9.313443] systemd[1]: Activated swap /swapfile.
[    9.313676] systemd[1]: Reached target Swaps.

===== Key Releases =====
Linux martin-manjaro 6.12.34-1-MANJARO #1 SMP PREEMPT_DYNAMIC Thu, 19 Jun 2025 15:49:06 +0000 x86_64 GNU/Linux
linux612 6.12.34-1
linux-firmware 20250508.788aadc8-2
systemd 257.6-1

I appreciate any advice, suggestions or help, as I am completely lost on how to solve this problem. I can also provide more information if needed.

This is not compliant to your inxi statement.

Why zswap is not enabled?

What provides

swapon --show

I would recommend to recreate the swap file as described in the Archlinux wiki.

1 Like

Thanks for the guidance. I’m happy to report that the swap issue is now fully resolved!

Solution Steps:

  1. Recreated swapfile using Arch Wiki method:
  sudo swapoff /swapfile
   sudo rm /swapfile
   sudo dd if=/dev/zero of=/swapfile bs=1M count=8192 status=progress oflag=direct
   sudo chmod 600 /swapfile
   sudo mkswap /swapfile
   sudo swapon /swapfile
  1. Enabled zswap via kernel module (not GRUB):

echo "options zswap enabled=1 compressor=lz4 max_pool_percent=20 zpool=z3fold" | sudo tee /etc/modprobe.d/zswap.conf echo "zswap" | sudo tee /etc/modules-load.d/zswap.conf sudo mkinitcpio -P

Verification:
After these changes, swap usage under memory pressure works perfectly:

               total       usado       libre  compartido   búf/caché  disponible
Mem:            11Gi        10Gi       216Mi        61Mi       670Mi       689Mi
Inter:         8,0Gi       1,9Gi       6,1Gi

I understand that the root cause of it not working before was that zswap is not enabled correctly through GRUB parameters.

Thanks again. There are some things about Linux/Manjaro I still need to get the hang of, but I’m still learning.

2 Likes

Glad you solved it that quickly.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.