Question about zram

Hello. I just configured zram in my system. My question is why zramctl reports less swap data than swapon. I used fedora 34 for a while and if I remember correctly it showed the total amount of swap used in the “Data” section in zramctl.

Is this happening because zramctl is only reporting compressible data? here are some captures and my system info:

inxi --full --admin --verbosity=7 --filter --no-host                                                                                                        22 ✘ 
System:
  Kernel: 5.15.8-228-tkg-pds x86_64 bits: 64 compiler: gcc v: 11.1.0
    parameters: intel_pstate=passive
    BOOT_IMAGE=/@/boot/vmlinuz-linux515-tkg-pds
    root=UUID=d0cc26bc-d2c9-4c05-b4dd-d7e8620ef6c3 rw rootflags=subvol=@
    quiet resume=UUID=288be438-2ace-4b1b-92da-8c8a37131910
    udev.log_priority=3
  Desktop: KDE Plasma 5.23.4 tk: Qt 5.15.2 wm: kwin_x11 vt: 1 dm: SDDM
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Desktop Mobo: ASUSTeK model: PRIME A320M-K v: Rev X.0x
    serial: <superuser required> UEFI: American Megatrends v: 5602
    date: 07/14/2020
Battery:
  Message: No system battery data found. Is one present?
Memory:
  RAM: total: 5.79 GiB used: 3.02 GiB (52.2%)
  RAM Report:
    permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: AMD Ryzen 5 3400G with Radeon Vega Graphics bits: 64
    type: MT MCP arch: Zen/Zen+ note: check family: 0x17 (23)
    model-id: 0x18 (24) stepping: 1 microcode: 0x8108109
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache:
    L1: 384 KiB desc: d-4x32 KiB; i-4x64 KiB L2: 2 MiB desc: 4x512 KiB
    L3: 4 MiB desc: 1x4 MiB
  Speed (MHz): avg: 1502 high: 2284 min/max: 1400/3700 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 1252 2: 2284
    3: 1397 4: 1397 5: 1609 6: 1285 7: 1397 8: 1401 bogomips: 59090
  Flags: 3dnowprefetch abm adx aes aperfmperf apic arat avic avx avx2 bmi1
    bmi2 bpext clflush clflushopt clzero cmov cmp_legacy constant_tsc cpb cpuid
    cr8_legacy cx16 cx8 de decodeassists extapic extd_apicid f16c flushbyasid
    fma fpu fsgsbase fxsr fxsr_opt ht hw_pstate ibpb irperf lahf_lm lbrv lm
    mca mce misalignsse mmx mmxext monitor movbe msr mtrr mwaitx nonstop_tsc
    nopl npt nrip_save nx osvw overflow_recov pae pat pausefilter pclmulqdq
    pdpe1gb perfctr_core perfctr_llc perfctr_nb pfthreshold pge pni popcnt
    pse pse36 rapl rdrand rdseed rdtscp rep_good sep sev sev_es sha_ni skinit
    smap smca sme smep ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3 succor svm
    svm_lock syscall tce topoext tsc tsc_scale v_vmsave_vmload vgif
    vmcb_clean vme vmmcall wdt xgetbv1 xsave xsavec xsaveerptr xsaveopt
    xsaves
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  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 AMD retpoline, IBPB: conditional,
    STIBP: disabled, RSB filling
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Picasso vendor: ASUSTeK driver: amdgpu v: kernel
    bus-ID: 07:00.0 chip-ID: 1002:15d8 class-ID: 0300
  Display: x11 server: X.Org 1.21.1.2 compositor: kwin_x11 driver:
    loaded: amdgpu 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: HDMI-A-0 res: 1920x1080 hz: 72 dpi: 102
    size: 477x268mm (18.8x10.6") diag: 547mm (21.5")
  OpenGL: renderer: AMD Radeon Vega 11 Graphics (RAVEN DRM 3.42.0
    5.15.8-228-tkg-pds LLVM 13.0.0)
    v: 4.6 Mesa 21.2.5 direct render: Yes
Audio:
  Device-1: AMD Raven/Raven2/Fenghuang HDMI/DP Audio
    vendor: ASUSTeK PRIME B450M-A driver: snd_hda_intel v: kernel
    bus-ID: 07:00.1 chip-ID: 1002:15de class-ID: 0403
  Device-2: AMD Family 17h HD Audio vendor: ASUSTeK PRIME B450M-A
    driver: snd_hda_intel v: kernel bus-ID: 07:00.6 chip-ID: 1022:15e3
    class-ID: 0403
  Sound Server-1: ALSA v: k5.15.8-228-tkg-pds running: yes
  Sound Server-2: JACK v: 1.9.19 running: no
  Sound Server-3: PulseAudio v: 15.0 running: yes
  Sound Server-4: PipeWire v: 0.3.40 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: ASUSTeK PRIME B450M-A driver: r8169 v: kernel port: f000
    bus-ID: 05:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp5s0 state: up speed: 100 Mbps duplex: full mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: noprefixroute scope: link
  WAN IP: <filter>
Bluetooth:
  Message: No bluetooth data found.
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 1.83 TiB used: 736.1 GiB (39.2%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: Seagate model: ST1000DM010-2EP102
    size: 931.51 GiB block-size: physical: 4096 B logical: 512 B
    speed: 6.0 Gb/s type: HDD rpm: 7200 serial: <filter> rev: CC43
    scheme: GPT
  ID-2: /dev/sdb maj-min: 8:16 vendor: Crucial model: CT250MX500SSD1
    size: 232.89 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
    type: SSD serial: <filter> rev: 023 scheme: GPT
  ID-3: /dev/sdc maj-min: 8:32 vendor: Western Digital
    model: WD7500BPVX-60JC3T0 size: 698.64 GiB block-size: physical: 4096 B
    logical: 512 B speed: 6.0 Gb/s type: HDD rpm: 5400 serial: <filter>
    rev: 1A01 scheme: GPT
  ID-4: /dev/sdd maj-min: 8:48 type: USB vendor: Kingston
    model: DataTraveler 2.0 size: 14.54 GiB block-size: physical: 512 B
    logical: 512 B type: N/A serial: <filter> rev: PMAP scheme: MBR
  SMART Message: Unknown USB bridge. Flash drive/Unsupported enclosure?
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 31.25 GiB size: 31.25 GiB (100.00%)
    used: 13.97 GiB (44.7%) fs: btrfs dev: /dev/sdb7 maj-min: 8:23 label: root
    uuid: d0cc26bc-d2c9-4c05-b4dd-d7e8620ef6c3
  ID-2: /boot/efi raw-size: 512 MiB size: 511 MiB (99.80%)
    used: 568 KiB (0.1%) fs: vfat dev: /dev/sdb5 maj-min: 8:21 label: BOOT
    uuid: 08E6-2E46
  ID-3: /home raw-size: 102.66 GiB size: 102.66 GiB (100.00%)
    used: 83.44 GiB (81.3%) fs: btrfs dev: /dev/sdb8 maj-min: 8:24 label: home
    uuid: 0e609bad-a95f-43fb-a9f0-68d1cda65108
  ID-4: /mnt/01D764BB364BACB0 raw-size: 818.88 GiB
    size: 818.88 GiB (100.00%) used: 619.66 GiB (75.7%) fs: ntfs dev: /dev/sda1
    maj-min: 8:1 label: N/A uuid: 01D764BB364BACB0
  ID-5: /mnt/2cb67755-7f36-49e4-a090-7a02cf4a6c78 raw-size: 112.63 GiB
    size: 112.63 GiB (100.00%) used: 19.03 GiB (16.9%) fs: btrfs dev: /dev/sda2
    maj-min: 8:2 label: N/A uuid: 2cb67755-7f36-49e4-a090-7a02cf4a6c78
  ID-6: /var/cache raw-size: 31.25 GiB size: 31.25 GiB (100.00%)
    used: 13.97 GiB (44.7%) fs: btrfs dev: /dev/sdb7 maj-min: 8:23 label: root
    uuid: d0cc26bc-d2c9-4c05-b4dd-d7e8620ef6c3
  ID-7: /var/log raw-size: 31.25 GiB size: 31.25 GiB (100.00%)
    used: 13.97 GiB (44.7%) fs: btrfs dev: /dev/sdb7 maj-min: 8:23 label: root
    uuid: d0cc26bc-d2c9-4c05-b4dd-d7e8620ef6c3
Swap:
  Kernel: swappiness: 100 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 8.98 GiB used: 0 KiB (0.0%)
    priority: -2 dev: /dev/sdb9 maj-min: 8:25 label: N/A
    uuid: 288be438-2ace-4b1b-92da-8c8a37131910
  ID-2: swap-2 type: zram size: 5.79 GiB used: 738.7 MiB (12.5%)
    priority: 100 dev: /dev/zram0
Unmounted:
  ID-1: /dev/sdb1 maj-min: 8:17 size: 580 MiB fs: ntfs label: Recovery
    uuid: 01D59DCC4A40D630
  ID-2: /dev/sdb2 maj-min: 8:18 size: 330.6 MiB fs: vfat label: N/A
    uuid: 4AFD-6F70
  ID-3: /dev/sdb3 maj-min: 8:19 size: 16 MiB fs: <superuser required>
    label: N/A uuid: N/A
  ID-4: /dev/sdb4 maj-min: 8:20 size: 88.09 GiB fs: ntfs label: N/A
    uuid: 01D74A8D47F4F900
  ID-5: /dev/sdb6 maj-min: 8:22 size: 511.2 MiB fs: vfat label: EFI
    uuid: 804C-4160
  ID-6: /dev/sdc1 maj-min: 8:33 size: 658.33 GiB fs: ntfs label: N/A
    uuid: 01D6DD483DFD42C0
  ID-7: /dev/sdc2 maj-min: 8:34 size: 40.31 GiB fs: btrfs label: N/A
    uuid: f60dd6df-e2bd-40fe-976d-512c2599cbdd
  ID-8: /dev/sdd1 maj-min: 8:49 size: 14.54 GiB fs: ntfs label: N/A
    uuid: 54AB541B1D57AED5
USB:
  Hub-1: 1-0:1 info: Hi-speed hub with single TT ports: 9 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Device-1: 1-4:2 info: Kingston Digital DataTraveler SE9
    type: Mass Storage driver: usb-storage interfaces: 1 rev: 2.0
    speed: 480 Mb/s power: 200mA chip-ID: 0951:1665 class-ID: 0806
    serial: <filter>
  Device-2: 1-6:3 info: Razer USA Razer DeathAdder V2 Mini
    type: Mouse,Keyboard driver: hid-generic,usbhid interfaces: 3 rev: 2.0
    speed: 12 Mb/s power: 500mA chip-ID: 1532:008c class-ID: 0300
  Device-3: 1-9:4 info: China Resource Semico USB Keyboard
    type: Keyboard,Mouse driver: hid-generic,usbhid interfaces: 2 rev: 1.1
    speed: 1.5 Mb/s power: 500mA chip-ID: 1a2c:4c5e class-ID: 0301
  Hub-2: 2-0:1 info: Super-speed hub ports: 3 rev: 3.1 speed: 10 Gb/s
    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 chip-ID: 1d6b:0002 class-ID: 0900
  Hub-4: 4-0:1 info: Super-speed hub ports: 4 rev: 3.1 speed: 10 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
  Hub-5: 5-0:1 info: Hi-speed hub with single TT ports: 1 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Hub-6: 6-0:1 info: Super-speed hub ports: 1 rev: 3.1 speed: 10 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
Sensors:
  System Temperatures: cpu: N/A mobo: N/A gpu: amdgpu temp: 35.0 C
  Fan Speeds (RPM): N/A
Info:
  Processes: 348 Uptime: 1h 30m wakeups: 0 Init: systemd v: 249
  tool: systemctl Compilers: gcc: 11.1.0 Packages: pacman: 1319 lib: 386
  flatpak: 0 Shell: Zsh v: 5.8 default: Bash v: 5.1.12 running-in: konsole
  inxi: 3.3.11

swapon                                                                                                                                                 ✔  16s  
NAME       TYPE      SIZE USED PRIO
/dev/sdb9  partition   9G   0B   -2
/dev/zram0 partition 5.8G   2G  100

zramctl                                                                                                                                                        ✔ 
NAME       ALGORITHM DISKSIZE  DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd          5.8G 50.6M 28.6M 29.3M       8 [SWAP]


Noticed the same here! Just an educated guess, maybe it’s probably a matter of compressed value vs raw ram measurement. Check this out.

Hi.That was the first thread I looked at and it left me even more confused lol. I searched a lot about this but the only similar situation I found was an old thread in russian asking the same question, the answers said something about a bug that was affecting the values reported in zramctl but it was already fixed in a new version I don’t speak russian so I used google translator so I didn’t trust what I was reading that much.

The good news is that I “feel” it is working because my pc is not trashing anymore, warframe became unplayable in certain areas because the low amount of ram in my pc, not to mention my apu uses my ram as vram wich makes everything worse, with zram I don’t have problems though.

Please do not post screenshots of text.
Copy + Paste and use appropriate formatting via </> button or adding three backticks ` above and below the text.

Forgot about that. Just changed it.

1 Like

Nevermind- I rebooted 4 times in a row testing swappiness values higher than the default 60 and it is reporting the correct values now. I don’t know what happened.

Out of curiosity, what are your settings now?

Hello, my settings for zram are:

/usr/lib/systemd/zram-generator.conf 
zram-fraction = 1.0
max-zram-size = 5940
compression-algorithm = zstd

I have 8gb of ram but 2GB are reserver for video memory.

Swappiness settings:

/etc/sysctl.d/99-swappiness.conf  
vm.swappiness=100
vm.vfs_cache_pressure=100

1 Like