Swap is not working as intended

Hi there.
I am using Manjaro i3wm with a 20GB SWAP partition. free - m does show my swap partition, and hibernation is working well.
However, when I am actually running RAM-consuming tasks, the swap usage would always be 0.
Sometimes the RAM usage is even hitting 99% and the SWAP usage remains 0%.

Anyone got any ideas?

please post the output of

inxi --admin --verbosity=7 --filter --no-host --width

use the option “preformatted text” (the 3 ticks) and paste it inside them

And here it is.

charles@ThinkPad-S2 ~> inxi --admin --verbosity=7 --filter --no-host --width
System:
  Kernel: 6.1.60-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: hpet available: acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.1-x86_64
    root=UUID=b3449a8f-c72d-4b0c-b8cd-23a73ff03025 rw
    resume=UUID=2c2afe6c-2805-4a56-9208-93f394d4ea96 apparmor=1
    security=apparmor udev.log_priority=3
  Desktop: i3 v: 4.23 info: i3bar vt: 7 dm: LightDM v: 1.32.0
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 21AFA008CD v: ThinkPad S2 Gen 6a
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: LENOVO model: 21AFA008CD serial: <superuser required> UEFI: LENOVO
    v: R1QET34W (1.20 ) date: 03/01/2022
Battery:
  ID-1: BAT0 charge: 41.8 Wh (98.6%) condition: 42.4/46.0 Wh (92.2%)
    volts: 17.2 min: 15.4 model: Sunwoda LNV-5B10W13935 type: Li-poly
    serial: <filter> status: not charging cycles: 62
Memory:
  System RAM: total: 16 GiB note: est. available: 14.46 GiB
    used: 4.36 GiB (30.2%)
  RAM Report: permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: AMD Ryzen 5 PRO 5650U with Radeon Graphics bits: 64 type: MT MCP
    arch: Zen 3 gen: 4 level: v3 note: check built: 2021-22
    process: TSMC n7 (7nm) family: 0x19 (25) model-id: 0x50 (80) stepping: 0
    microcode: 0xA50000C
  Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
    L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 3 MiB desc: 6x512 KiB L3: 16 MiB
    desc: 1x16 MiB
  Speed (MHz): avg: 1490 high: 2009 min/max: 1600/4288 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 1600 2: 1397 3: 0
    4: 1600 5: 1562 6: 1600 7: 1720 8: 1600 9: 1600 10: 1600 11: 1600 12: 2009
    bogomips: 55125
  Flags: 3dnowprefetch abm adx aes aperfmperf apic arat avic avx avx2 bmi1
    bmi2 bpext cat_l3 cdp_l3 clflush clflushopt clwb clzero cmov cmp_legacy
    constant_tsc cpb cppc cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total
    cqm_occup_llc cr8_legacy cx16 cx8 de decodeassists erms extapic
    extd_apicid f16c flushbyasid fma fpu fsgsbase fsrm fxsr fxsr_opt ht
    hw_pstate ibpb ibrs ibs invpcid irperf lahf_lm lbrv lm mba mca mce
    misalignsse mmx mmxext monitor movbe msr mtrr mwaitx nonstop_tsc nopl npt
    nrip_save nx ospke osvw overflow_recov pae pat pausefilter pclmulqdq
    pdpe1gb perfctr_core perfctr_llc perfctr_nb pfthreshold pge pku pni popcnt
    pse pse36 rapl rdpid rdpru rdrand rdseed rdt_a rdtscp rep_good sep sha_ni
    skinit smap smca smep ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3 stibp succor
    svm svm_lock syscall tce topoext tsc tsc_scale umip v_spec_ctrl
    v_vmsave_vmload vaes vgif vmcb_clean vme vmmcall vpclmulqdq wbnoinvd wdt
    xgetbv1 xsave xsavec xsaveerptr xsaveopt xsaves
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow mitigation: safe RET, no microcode
  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: always-on, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Cezanne [Radeon Vega Series / Radeon Mobile Series]
    vendor: Lenovo driver: amdgpu v: kernel arch: GCN-5 code: Vega
    process: GF 14nm built: 2017-20 pcie: gen: 3 speed: 8 GT/s lanes: 16
    link-max: gen: 4 speed: 16 GT/s ports: active: eDP-1
    empty: DP-1,DP-2,HDMI-A-1 bus-ID: 07:00.0 chip-ID: 1002:1638 class-ID: 0300
    temp: 45.0 C
  Device-2: Chicony ThinkPad T490 Webcam driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-3:2 chip-ID: 04f2:b681
    class-ID: 0e02 serial: <filter>
  Display: x11 server: X.Org v: 21.1.9 compositor: Picom v: git-b700a driver:
    X: loaded: amdgpu unloaded: modesetting alternate: fbdev,vesa dri: radeonsi
    gpu: amdgpu display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
    s-diag: 582mm (22.93")
  Monitor-1: eDP-1 mapped: eDP model: AU Optronics 0x222d built: 2018
    res: 1920x1080 hz: 60 dpi: 166 gamma: 1.2 size: 293x165mm (11.54x6.5")
    diag: 336mm (13.2") ratio: 16:9 modes: max: 1920x1080 min: 640x480
  API: EGL v: 1.5 hw: drv: amd radeonsi platforms: device: 0 drv: radeonsi
    device: 1 drv: swrast gbm: drv: kms_swrast surfaceless: drv: radeonsi x11:
    drv: radeonsi inactive: wayland
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: amd mesa v: 23.1.9-manjaro1.1
    glx-v: 1.4 direct-render: yes renderer: AMD Radeon Graphics (renoir LLVM
    16.0.6 DRM 3.49 6.1.60-1-MANJARO) device-ID: 1002:1638 memory: 1000 MiB
    unified: no
Audio:
  Device-1: AMD Renoir Radeon High Definition Audio vendor: Lenovo
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    link-max: gen: 4 speed: 16 GT/s bus-ID: 07:00.1 chip-ID: 1002:1637
    class-ID: 0403
  Device-2: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Lenovo driver: N/A
    alternate: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x, snd_pci_acp6x,
    snd_acp_pci, snd_rpl_pci_acp6x, snd_pci_ps, snd_sof_amd_renoir,
    snd_sof_amd_rembrandt pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4
    speed: 16 GT/s bus-ID: 07:00.5 chip-ID: 1022:15e2 class-ID: 0480
  Device-3: AMD Family 17h/19h HD Audio vendor: Lenovo driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4
    speed: 16 GT/s bus-ID: 07:00.6 chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.1.60-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 0.3.83 status: off tools: pw-cli
  Server-3: PulseAudio v: 16.1 status: active with: pulseaudio-alsa
    type: plugin tools: pacat,pactl,pavucontrol
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Lenovo driver: r8168 v: 8.052.01-NAPI modules: r8169 pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: 3000 bus-ID: 03:00.0 chip-ID: 10ec:8168
    class-ID: 0200
  IF: enp3s0f0 state: down mac: <filter>
  Device-2: Realtek RTL8852AE 802.11ax PCIe Wireless Network Adapter
    vendor: Lenovo driver: rtw89_8852ae v: kernel pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 port: 2000 bus-ID: 06:00.0 chip-ID: 10ec:8852 class-ID: 0280
  IF: wlp6s0 state: down mac: <filter>
  IF-ID-1: utun state: unknown speed: 10 Mbps duplex: full mac: N/A
  IP v4: <filter> scope: global
  IP v6: <filter> virtual: stable-privacy proto kernel_ll scope: link
  WAN IP: No WAN IP found. Connected to web? SSL issues? Try enabling dig
Bluetooth:
  Device-1: Realtek [] driver: btusb v: 0.8 type: USB rev: 1.0 speed: 12 Mb/s
    lanes: 1 mode: 1.1 bus-ID: 3-3:2 chip-ID: 0bda:4852 class-ID: e001
    serial: <filter>
  Report: btmgmt ID: hci0 rfk-id: 3 state: up address: <filter> bt-v: 5.2
    lmp-v: 11 status: discoverable: no pairing: no class-ID: 7c010c
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.


Drives:
  Local Storage: total: 476.94 GiB used: 227.55 GiB (47.7%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: MZVLB512HBJQ-000L7
    size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: 5M2QEXF7 temp: 31.9 C
    scheme: GPT
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 100.14 GiB size: 98.01 GiB (97.87%) used: 29.4 GiB (30.0%)
    fs: ext4 dev: /dev/nvme0n1p6 maj-min: 259:6 label: N/A
    uuid: b3449a8f-c72d-4b0c-b8cd-23a73ff03025
  ID-2: /boot/efi raw-size: 100 MiB size: 96 MiB (96.00%)
    used: 29.1 MiB (30.3%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1 label: N/A
    uuid: AC55-0E56
  ID-3: /home/<filter>/OneDrive raw-size: N/A size: 5 GiB
    used: 3.8 GiB (76.0%) fs: fuse.rclone remote: OneDrive:
  ID-4: /run/media/charles/Data raw-size: 206.38 GiB
    size: 206.38 GiB (100.00%) used: 123.34 GiB (59.8%) fs: ntfs
    dev: /dev/nvme0n1p5 maj-min: 259:5 label: Data uuid: F8740B0D740ACE76
  ID-5: /run/media/charles/Windows raw-size: 150.09 GiB
    size: 150.09 GiB (100.00%) used: 74.74 GiB (49.8%) fs: ntfs
    dev: /dev/nvme0n1p3 maj-min: 259:3 label: Windows uuid: 02C8566EC8565FC9
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default) zswap: yes
    compressor: zstd max-pool: 20%
  ID-1: swap-1 type: partition size: 19.53 GiB used: 36.6 MiB (0.2%)
    priority: 1 dev: /dev/nvme0n1p7 maj-min: 259:7 label: N/A
    uuid: 2c2afe6c-2805-4a56-9208-93f394d4ea96
Unmounted:
  ID-1: /dev/nvme0n1p2 maj-min: 259:2 size: 16 MiB fs: <superuser required>
    label: N/A uuid: N/A
  ID-2: /dev/nvme0n1p4 maj-min: 259:4 size: 687 MiB fs: ntfs label: N/A
    uuid: 86E8EADEE8EACC0D
USB:
  Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 4 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Device-1: 1-2:5 info: Areson Corp [] type: keyboard,mouse
    driver: hid-generic,usbhid interfaces: 2 rev: 1.1 speed: 12 Mb/s (1.4 MiB/s)
    lanes: 1 mode: 1.1 power: 100mA chip-ID: 25a7:fa70 class-ID: 0301
  Device-2: 1-3:2 info: Chicony ThinkPad T490 Webcam type: video
    driver: uvcvideo interfaces: 4 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s) lanes: 1
    mode: 2.0 power: 500mA chip-ID: 04f2:b681 class-ID: 0e02 serial: <filter>
  Device-3: 1-4:4 info: Synaptics Prometheus MIS Touch Fingerprint Reader
    type: <vendor specific> driver: N/A interfaces: 1 rev: 2.0
    speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1 power: 100mA
    chip-ID: 06cb:00bd class-ID: ff00 serial: <filter>
  Hub-2: 2-0:1 info: super-speed hub ports: 2 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-3: 3-0:1 info: hi-speed hub with single TT ports: 4 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Device-1: 3-2:9 info: Logitech Logi Bolt Receiver type: keyboard,mouse,HID
    driver: hid-generic,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s)
    lanes: 1 mode: 1.1 power: 98mA chip-ID: 046d:c548 class-ID: 0300
  Device-2: 3-3:2 info: Realtek [] type: bluetooth driver: btusb
    interfaces: 2 rev: 1.0 speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1
    power: 500mA chip-ID: 0bda:4852 class-ID: e001 serial: <filter>
  Hub-4: 3-4:3 info: Terminus Hub ports: 4 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 power: 100mA
    chip-ID: 1a40:0101 class-ID: 0900
  Device-1: 3-4.3:4 info: Raydium [] type: HID driver: hid-multitouch,usbhid
    interfaces: 1 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1
    power: 96mA chip-ID: 2386:4338 class-ID: 0300
  Hub-5: 4-0:1 info: super-speed hub ports: 2 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
Sensors:
  System Temperatures: cpu: 53.0 C mobo: N/A gpu: amdgpu temp: 48.0 C
  Fan Speeds (rpm): fan-1: 3096
Info:
  Processes: 289 Uptime: 1d 18h 40m wakeups: 0 Init: systemd v: 254
  default: graphical tool: systemctl Compilers: gcc: 13.2.1 clang: 16.0.6
  Packages: pm: pacman pkgs: 1407 libs: 411 tools: pamac,yay Shell: fish
  v: 3.6.1 running-in: alacritty inxi: 3.3.31

thanks for the fast reply. first things first, you’re running a system with 16GB RAM.

Memory:
  System RAM: total: 16 GiB note: est. available: 14.46 GiB
    used: 4.36 GiB (30.2%)

as you can see only 30% of ram is used actually. there is no need to use swap-space.
the use of swap is controlled via the setting of swappiness, that is set to default-value (60). usually these settings have become very accurate for the most users and you shouldn’t worry. if you wanna play around check the link below about swap and settings of it.
also check the use of preload that optimizes the system.

https://wiki.archlinux.org/title/Swap
https://wiki.archlinux.org/title/Preload

It’s kind of you to volunteer your time to help a green guy like me.
However I must say, when I am using 80% or higher of my RAM, the swap usage is still low, which seems not so reasonable.

yes, it’s the intention to use RAM as much as possible because it is the fastest storage possible. if you want to change the behaviour play around with the setting of “swappiness” that is described in the link about swap.

1 Like

Sure, thanks. I’ll go and check that out.

a little tip to boost the performance is to simple install and use the preload-service.

pamac install preload
sudo systemctl enable preload
sudo systemctl start preload

this will analyze your use of applications and with ongoing time will preload applications you are using most. nice improvement that i suggest to use.

1 Like

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