Manjaro swapping agressively

I have an 8GB ram and swappiness set to 1, but still I see swap being used at pretty much normal RAM usage.

My inxi -Fazy

System:
  Kernel: 5.11.19-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.11-x86_64 
  root=UUID=76839173-ded3-47ed-b743-7d503298909d rw quiet apparmor=1 
  security=apparmor resume=UUID=0eb2fb6f-7b97-4079-afe0-7595022800e5 
  udev.log_priority=3 
  Desktop: KDE Plasma 5.21.5 tk: Qt 5.15.2 wm: kwin_x11 vt: 1 dm: SDDM 
  Distro: Manjaro Linux base: Arch Linux 
Machine:
  Type: Laptop System: HP product: OMEN by HP Laptop 15-dc1xxx v: N/A 
  serial: <filter> Chassis: type: 10 serial: <filter> 
  Mobo: HP model: 8575 v: 21.16 serial: <filter> UEFI: AMI v: F.21 
  date: 11/13/2020 
Battery:
  ID-1: BAT0 charge: 46.8 Wh (100.0%) condition: 46.8/46.8 Wh (100.0%) 
  volts: 12.9 min: 11.6 model: HP Primary type: Li-ion serial: N/A 
  status: Full 
CPU:
  Info: 6-Core model: Intel Core i7-9750H bits: 64 type: MT MCP 
  arch: Kaby Lake note: check family: 6 model-id: 9E (158) stepping: A (10) 
  microcode: DE cache: L2: 12 MiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
  bogomips: 62431 
  Speed: 1142 MHz min/max: 800/4500 MHz Core speeds (MHz): 1: 1142 2: 3989 
  3: 3101 4: 2252 5: 1331 6: 1444 7: 964 8: 800 9: 800 10: 800 11: 800 12: 800 
  Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled 
  Type: l1tf 
  mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
  Type: meltdown mitigation: PTI 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, 
  IBRS_FW, STIBP: conditional, RSB filling 
  Type: srbds mitigation: Microcode 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: Intel UHD Graphics 630 vendor: Hewlett-Packard driver: i915 
  v: kernel bus-ID: 00:02.0 chip-ID: 8086:3e9b class-ID: 0300 
  Device-2: NVIDIA TU117M [GeForce GTX 1650 Mobile / Max-Q] 
  vendor: Hewlett-Packard driver: nvidia v: 460.80 
  alternate: nouveau,nvidia_drm bus-ID: 01:00.0 chip-ID: 10de:1f91 
  class-ID: 0300 
  Device-3: Quanta HP Wide Vision HD Camera type: USB driver: uvcvideo 
  bus-ID: 1-6:3 chip-ID: 0408:5300 class-ID: 0e02 serial: <filter> 
  Display: x11 server: X.Org 1.20.11 compositor: kwin_x11 driver: 
  loaded: modesetting,nvidia alternate: fbdev,intel,nouveau,nv,vesa 
  display-ID: :0 screens: 1 
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") 
  s-diag: 582mm (22.9") 
  Monitor-1: eDP-1 res: 1920x1080 hz: 60 dpi: 142 size: 344x193mm (13.5x7.6") 
  diag: 394mm (15.5") 
  OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 21.0.3 
  direct render: Yes 
Audio:
  Device-1: Intel Cannon Lake PCH cAVS vendor: Hewlett-Packard 
  driver: snd_hda_intel v: kernel alternate: snd_soc_skl,snd_sof_pci 
  bus-ID: 00:1f.3 chip-ID: 8086:a348 class-ID: 0403 
  Sound Server-1: ALSA v: k5.11.19-1-MANJARO running: yes 
  Sound Server-2: JACK v: 0.125.0 running: no 
  Sound Server-3: PulseAudio v: 14.2 running: yes 
  Sound Server-4: PipeWire v: 0.3.27 running: no 
Network:
  Device-1: Intel Wireless-AC 9560 [Jefferson Peak] driver: iwlwifi v: kernel 
  port: 5000 bus-ID: 00:14.3 chip-ID: 8086:a370 class-ID: 0280 
  IF: wlo1 state: up mac: <filter> 
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet 
  vendor: Hewlett-Packard driver: r8169 v: kernel port: 3000 bus-ID: 03:00.0 
  chip-ID: 10ec:8168 class-ID: 0200 
  IF: eno1 state: down mac: <filter> 
Bluetooth:
  Device-1: Intel Bluetooth 9460/9560 Jefferson Peak (JfP) type: USB 
  driver: btusb v: 0.8 bus-ID: 1-14:4 chip-ID: 8087:0aaa class-ID: e001 
  Report: rfkill ID: hci0 rfk-id: 1 state: up address: see --recommends 
RAID:
  Hardware-1: Intel 82801 Mobile SATA Controller [RAID mode] driver: ahci 
  v: 3.0 port: 5060 bus-ID: 00:17.0 chip-ID: 8086.282a rev: 10 class-ID: 0104 
Drives:
  Local Storage: total: 1.14 TiB used: 62.23 GiB (5.3%) 
  SMART Message: Unable to run smartctl. Root privileges required. 
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital 
  model: PC SN720 SDAPNTW-256G-1006 size: 238.47 GiB block-size: 
  physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 rotation: SSD 
  serial: <filter> rev: 10112006 temp: 44.9 C scheme: GPT 
  ID-2: /dev/sda maj-min: 8:0 vendor: HGST (Hitachi) model: HTS721010A9E630 
  size: 931.51 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s 
  rotation: 7200 rpm serial: <filter> rev: A3T0 scheme: GPT 
Partition:
  ID-1: / raw-size: 40 GiB size: 39.12 GiB (97.80%) used: 15.02 GiB (38.4%) 
  fs: ext4 dev: /dev/nvme0n1p5 maj-min: 259:5 
  ID-2: /boot/efi raw-size: 260 MiB size: 256 MiB (98.46%) 
  used: 82.2 MiB (32.1%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1 
  ID-3: /home raw-size: 196.95 GiB size: 192.86 GiB (97.92%) 
  used: 47.06 GiB (24.4%) fs: ext4 dev: /dev/sda7 maj-min: 8:7 
Swap:
  Kernel: swappiness: 1 (default 60) cache-pressure: 100 (default) 
  ID-1: swap-1 type: partition size: 10 GiB used: 66.9 MiB (0.7%) priority: -2 
  dev: /dev/nvme0n1p6 maj-min: 259:6 
Sensors:
  System Temperatures: cpu: 66.0 C mobo: N/A 
  Fan Speeds (RPM): N/A 
Info:
  Processes: 302 Uptime: 2h 30m wakeups: 2 Memory: 7.58 GiB 
  used: 4.13 GiB (54.5%) Init: systemd v: 247 tool: systemctl Compilers: 
  gcc: 10.2.0 Packages: pacman: 1368 lib: 432 Shell: Bash v: 5.1.8 
  running-in: yakuake inxi: 3.3.04 

I made my swap partition on an Nvme SSD ( which I read later is a pretty bad thing to do) and hence want it to activate when absolutely needed ( so as to not activate OOM).

1 Like

You can use ZRam instead of swap. It compresses a part of RAM inside the RAM itself. While it consumes some CPU cycles, it would be faster than a HDD or SSD based swap.

Quote:

Swap is not generally about getting emergency memory

You can try zswap or zram for compressed swap in ram:
https://wiki.archlinux.org/title/Zswap
https://wiki.archlinux.org/title/Improving_performance#Zram_or_zswap

3 Likes

Is it possible to bring the 10GB I allocated to swap back to Root?


This happened during a game. While I have plenty of RAM left, and swappiness set to 10, still large amount of swap is being used.

The system will page out as the memory contention increases. Swappiness of 10 ain’t gonna prevent that.

Zswap solved it for me, thanks!

1 Like

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