Seemingly random massive lag spikes

Hi, I have had this really annoying issue for quite a while now : sometimes, my laptop just starts lagging heavily for maybe 5 minutes (the mouse cursor is stuttering, the keyboard is basically unresponsive, if i listened to music the sound stutters, etc…)

Most of the time, it occurs after i started a program, but not always, and i do not have many programs open (like Firefox with 4-5 tabs, Discord, VSCode and Thunderbird)

I think this may have something to do with my amount of RAM, but I bought my laptop this year so I don’t think this is normal for my laptop to lag as much, and when i was on Microsoft Windows this behavior did not occured

I tried several things, from rebooting my laptop to reinstall Manjaro completely, but it didn’t work

I understand that this is quite vague, but I hope that some of you can help me fix it

Thanks in advance !!

The output of inxi --admin --verbosity=7 --filter --width on my machine :

System:
  Kernel: 5.15.53-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 12.1.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-5.15-x86_64
    root=UUID=64c7e4aa-2dae-4fbe-83d2-3f806bd40ac8 rw quiet
    udev.log_priority=3
  Desktop: KDE Plasma v: 5.24.6 tk: Qt v: 5.15.5 wm: kwin_wayland vt: 2
    dm: SDDM Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 82LN v: IdeaPad 5 15ALC05
    serial: <superuser required> Chassis: type: 10 v: IdeaPad 5 15ALC05
    serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: SDK0J40709WIN
    serial: <superuser required> UEFI: LENOVO v: H2CN23WW date: 12/13/2021
Battery:
  ID-1: BAT0 charge: 32.6 Wh (52.7%) condition: 61.9/70.0 Wh (88.4%)
    volts: 15.3 min: 15.2 model: Celxpert L19C4PF1 type: Li-poly
    serial: <filter> status: discharging cycles: 166
Memory:
  RAM: total: 5.66 GiB used: 4.72 GiB (83.4%)
  RAM Report:
    permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: AMD Ryzen 7 5700U with Radeon Graphics bits: 64 type: MT MCP
    arch: Zen 2 gen: 3 built: 2020-22 process: TSMC n7 (7nm) family: 0x17 (23)
    model-id: 0x68 (104) stepping: 1 microcode: 0x8608102
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB L3: 8 MiB
    desc: 2x4 MiB
  Speed (MHz): avg: 1561 high: 2563 min/max: 1400/4370 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 2438 2: 2563
    3: 1602 4: 1623 5: 1400 6: 1394 7: 1395 8: 1397 9: 1397 10: 1397 11: 1397
    12: 1397 13: 1397 14: 1397 15: 1397 16: 1397 bogomips: 57516
  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 cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total
    cqm_occup_llc cr8_legacy cx16 cx8 de decodeassists extapic extd_apicid
    f16c flushbyasid fma fpu fsgsbase fxsr fxsr_opt ht hw_pstate ibpb ibrs ibs
    irperf lahf_lm lbrv lm mba 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 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 vgif vmcb_clean vme vmmcall
    wbnoinvd 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: mmio_stale_data 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: Retpolines, IBPB: conditional, IBRS_FW,
    STIBP: conditional, RSB filling
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Lucienne vendor: Lenovo driver: amdgpu v: kernel arch: GCN 5.1
    process: TSMC n7 (7nm) built: 2018-21 pcie: gen: 3 speed: 8 GT/s lanes: 16
    link-max: gen: 4 speed: 16 GT/s ports: active: eDP-1 empty: DP-1,HDMI-A-1
    bus-ID: 03:00.0 chip-ID: 1002:164c class-ID: 0300
  Device-2: Syntek Integrated Camera type: USB driver: uvcvideo
    bus-ID: 1-3:2 chip-ID: 174f:2459 class-ID: fe01 serial: <filter>
  Display: wayland server: X.org v: 1.21.1.4 with: Xwayland v: 22.1.3
    compositor: kwin_wayland driver: X: loaded: amdgpu unloaded: modesetting
    alternate: fbdev,vesa gpu: amdgpu display-ID: 0
  Monitor-1: eDP-1 res: 1920x1080 size: N/A modes: N/A
  OpenGL: renderer: AMD RENOIR (LLVM 14.0.6 DRM 3.42 5.15.53-1-MANJARO)
    v: 4.6 Mesa 22.1.3 direct render: Yes
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: 03:00.1 chip-ID: 1002:1637
    class-ID: 0403
  Device-2: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Lenovo driver: N/A
    pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s
    bus-ID: 03: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: 03:00.6 chip-ID: 1022:15e3 class-ID: 0403
  Sound Server-1: ALSA v: k5.15.53-1-MANJARO running: yes
  Sound Server-2: JACK v: 1.9.21 running: no
  Sound Server-3: PulseAudio v: 16.1 running: yes
  Sound Server-4: PipeWire v: 0.3.55 running: yes
Network:
  Device-1: Realtek RTL8822CE 802.11ac PCIe Wireless Network Adapter
    vendor: Lenovo driver: rtw_8822ce v: N/A pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 port: 2000 bus-ID: 01:00.0 chip-ID: 10ec:c822 class-ID: 0280
  IF: wlp1s0 state: up mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: noprefixroute scope: link
  WAN IP: <filter>
Bluetooth:
  Device-1: Realtek Bluetooth Radio type: USB driver: btusb v: 0.8
    bus-ID: 3-3:2 chip-ID: 0bda:c123 class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 29 state: up address: see --recommends
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 476.94 GiB used: 240.22 GiB (50.4%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Lenovo
    model: UMIS RPJTJ512MEE1OWX size: 476.94 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
    rev: 2.1C0628 temp: 39.9 C scheme: GPT
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 237.85 GiB size: 233.05 GiB (97.99%)
    used: 98.92 GiB (42.4%) fs: ext4 dev: /dev/nvme0n1p5 maj-min: 259:5
    label: N/A uuid: 64c7e4aa-2dae-4fbe-83d2-3f806bd40ac8
  ID-2: /boot/efi raw-size: 260 MiB size: 256 MiB (98.46%)
    used: 28.6 MiB (11.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
    label: SYSTEM_DRV uuid: 4ED7-C9AA
  ID-3: /run/media/nora/Windows-SSD raw-size: 237.85 GiB
    size: 237.85 GiB (100.00%) used: 141.28 GiB (59.4%) fs: ntfs
    dev: /dev/nvme0n1p3 maj-min: 259:3 label: Windows-SSD
    uuid: 466CDAAD6CDA9751
Swap:
  Alert: No swap data was found.
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: 1000 MiB fs: ntfs
    label: WINRE_DRV uuid: 5802DBE802DBC960
USB:
  Hub-1: 1-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
  Device-1: 1-3:2 info: Syntek Integrated Camera type: Video
    driver: uvcvideo interfaces: 3 rev: 2.0 speed: 480 Mb/s power: 500mA
    chip-ID: 174f:2459 class-ID: fe01 serial: <filter>
  Hub-2: 2-0:1 info: Super-speed hub ports: 2 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
  Device-1: 3-3:2 info: Realtek Bluetooth Radio type: Bluetooth
    driver: btusb interfaces: 2 rev: 1.0 speed: 12 Mb/s power: 500mA
    chip-ID: 0bda:c123 class-ID: e001 serial: <filter>
  Hub-4: 4-0:1 info: Super-speed hub ports: 2 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: 43.0 C
  Fan Speeds (RPM): N/A
Info:
  Processes: 348 Uptime: 9d 6h 12m wakeups: 30 Init: systemd v: 251
  default: graphical tool: systemctl Compilers: gcc: 12.1.0 clang: 14.0.6
  Packages: pacman: 1375 lib: 383 Shell: Zsh v: 5.9 default: Bash v: 5.1.16
  running-in: konsole inxi: 3.3.19

:cold_face:

I can’t ignore that. Not only do you have under 6 GiB of RAM total (almost 85% used), but to say “It worked fine on Windows” is not much of a hint, since we just have to assume that was the case under the exact same situations and circumstances, for the same amount of time and usage.

If you upgrade your system to 16 GiB of RAM, I am quite confident you’ll notice a substantial performance boost and consistency.

UPDATE: Apparently that laptop model has the memory modules soldered onto the board, which means you cannot swap them nor upgrade them. :frowning_face:

In addition to that, the AMD GPU on this laptop shares the system memory, unlike a discrete GPU with its own memory. This might explain why you do not see 8 GiB of total RAM.


Reconsider using Xfce as the desktop environment, as KDE might be a bit heavy for a system with just over 5 GiB of total RAM.

3 Likes

I agree with winnie, KDE is a bad choice for a system with that little ram. Gnome would be another bad choice. But there are good choices still left. Winnie suggested Xfce, but Mate and LXQT would be good alternates. Lxqt has the advantage of being a Qt based desktop like KDE and has one of the smallest memory footprints.

2 Likes

Use swap, preferably on an SSD.

Your hardware should have no issues running KDE or another full blown DE like Gnome or Cinnamon. As you’ve mentioned, you’re not running many apps.

Processes: 348 Uptime: 9d 6h 12m wakeups: 30 Init: systemd v: 251

KDE or an app that you’re running may be leaking memory; uptime of 9 days.
Try rebooting then check and monitor your system’s memory usage.
Tip: monitor your system log for errors and warnings when you experience response time and other system performance issues.

dmesg -H --level=err,warn

Sorry for the late answer, i was away from my computer for a while

I had a lag spike yesterday (after opening a firefox window) and tried to see the memory usage (with vtop), but it wasn’t that high (about 50%, and CPU was about 10%)

I ran dmesg -H --level=err,warn, and below is the output (the part of the output corresponding to the period where i had a lag spike) (i don’t see anything weird, but i’m really not sure)

[25août 18:05] [drm:dc_dmub_srv_wait_idle [amdgpu]] *ERROR* Error waiting for DMUB idle: status=3
[25août 18:08] Bluetooth: hci0: Timed out waiting for suspend events
[  +0,000010] Bluetooth: hci0: Suspend timeout bit: 6
[  +0,000035] Bluetooth: hci0: Suspend notifier action (3) failed: -110
[  +0,324930] pci 0000:00:00.2: can't derive routing for PCI INT A
[  +0,000005] pci 0000:00:00.2: PCI INT A: no GSI
[  +0,168227] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:363
[  +0,002284] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:371
[  +0,002356] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:379
[  +0,243063] done.
[25août 18:22] [drm:dc_dmub_srv_wait_idle [amdgpu]] *ERROR* Error waiting for DMUB idle: status=3
[25août 18:25] pci 0000:00:00.2: can't derive routing for PCI INT A
[  +0,000002] pci 0000:00:00.2: PCI INT A: no GSI
[  +0,167714] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:363
[  +0,002361] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:371
[  +0,002364] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:379
[25août 18:30] [drm:dc_dmub_srv_wait_idle [amdgpu]] *ERROR* Error waiting for DMUB idle: status=3
[  +0,223920] pci 0000:00:00.2: can't derive routing for PCI INT A
[  +0,000005] pci 0000:00:00.2: PCI INT A: no GSI
[  +0,166917] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:363
[  +0,002353] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:371
[  +0,002355] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:379
[  +0,247504] done.
[25août 18:31] pci 0000:00:00.2: can't derive routing for PCI INT A
[  +0,000005] pci 0000:00:00.2: PCI INT A: no GSI
[  +0,165848] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:363
[  +0,002318] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:371
[  +0,002331] [drm] REG_WAIT timeout 1us * 1000 tries - dcn20_dsc_pg_control line:379
[  +0,249133] done.

I also searched how to create a swap partition, but all that i could find was guides about how to mark a partition as swap, how can i create a new partition ? (i know that repartitioning a disk can cause issues if i’m not careful, so i didn’t want to do anything without being sure)

there is a description how to setup a swap. i would recommend to use a swapfile. this is the new, modern way to use swap because it allocates the space dynamically and isn’t restricted to a partition-size. also check the wiki for “baloo” and how to disable this service. it’s a resource-wasting service that no average-user needs but a waste of cpu-payload.

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

btw.: what a shame to sell a computer with 6 GB-RAM. That’s slapstick, if your able do a upgrade for more RAM.

The 8GB models of Ideapads 5 should only use the 512 (or max 1024MB) bios option for the graphic, other settings will make the machines act erratic. Looks like yours is set to 2048MB.

Go in your Bios and open Configuration tab. On the bottom set ‘Frame and Buffer size’ to 512MB and you should have 7.5GB ram which should be ok for KDE but turning eye candy down will make a difference on 512MB vram.

Nevertheless, using Xfce is a good tip; should fly on this fairly new piece of kit. And definitely set up swap.

The most recent kernel is 5.15.60 on stable branch.
Can you update the system with pacman -Syyu ?