Kworker/u8:#-btrfs and kswapd being... everything hogs, really

I think this was what was freezing my PC before.
All the pictures that I tried to take of conky, which showed them in action are blurry.
Here’s the best photo I could muster before I turned off my PC:


As you can see, it’s taking up all my resources. For a moment, my screen even went black.
At the top is kswapd. It’s using up around 25% of my CPU, but none of my memory.
Below them are the kworker-btrfses. while yes they take up 3-5% each, I’m pretty sure there are quite a ton of them. That would explain my CPU being used up.
Now then, the rest might be kworkers, but they might also be other stuff that I opened. Last I remember, there was one with 8:14 on the list. Thus the feeling that there are 14 of them or more.
What’s using up the memory, I have no idea. It might also be the kworkers and I faintly remember them using up at least SOME of the memory, but that’s faint.
Now then, what you can also see is that my swap usage is also at 100%. That could mean that because I ran out of swap, my entire computer died.
Now then, I don’t want that happening, and I’m not even sure if that’s actually what’s going on, but it’s my best guess.
And as for the solution I seem to have found on the internet, doing btrfs fi show /dev/sda2 (my home drive) brings up this:

Total devices 1 FS bytes used 115.97GiB
devid    1 size 914.01GiB used 123.02GiB path /dev/sda2

and I can’t seem to figure out what to do with it.
I tried looking in journalctl but couldn’t find anything in the moment it happened.
How would I prevent my computer dying like this in the future?

garuda-inxi:

System:
Kernel: 6.6.40-1-lts arch: x86_64 bits: 64 compiler: gcc v: 14.1.1
clocksource: tsc avail: hpet,acpi_pm
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-lts
root=UUID=2e27aff0-7e96-4683-8ac0-9bf4806d5923 rw rootflags=subvol=@
loglevel=3 ibt=off
Desktop: KDE Plasma v: 6.1.2 tk: Qt v: N/A info: frameworks v: 6.4.0
wm: kwin_x11 with: krunner vt: 2 dm: 1: LightDM v: 1.32.0 note: stopped
2: SDDM Distro: Garuda base: Arch Linux
Machine:
Type: Laptop System: HP product: HP ZBook 17 G3 v: N/A
serial: <superuser required> Chassis: type: 10 serial: <superuser required>
Mobo: HP model: 80D6 v: KBC Version 10.75 serial: <superuser required>
part-nu: 1MY26EC#ABA uuid: <superuser required> UEFI: HP v: N81 Ver. 01.45
date: 01/06/2020
Battery:
ID-1: BAT0 charge: 11.9 Wh (15.9%) condition: 74.8/74.8 Wh (100.0%)
volts: 10.2 min: 11.4 model: Hewlett-Packard Primary type: Li-ion
serial: <filter> status: discharging
CPU:
Info: model: Intel Core i5-6440HQ bits: 64 type: MCP arch: Skylake-S
gen: core 6 level: v3 note: check built: 2015 process: Intel 14nm family: 6
model-id: 0x5E (94) stepping: 3 microcode: 0xF0
Topology: cpus: 1x cores: 4 smt: <unsupported> cache: L1: 256 KiB
desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB L3: 6 MiB
desc: 1x6 MiB
Speed (MHz): avg: 2882 high: 3115 min/max: 800/3500 scaling:
driver: intel_pstate governor: powersave cores: 1: 3098 2: 3115 3: 2643
4: 2673 bogomips: 20810
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Vulnerabilities: <filter>
Graphics:
Device-1: Intel HD Graphics 530 vendor: Hewlett-Packard driver: i915
v: kernel arch: Gen-9 process: Intel 14n built: 2015-16 ports: active: eDP-1
empty: DP-1, DP-2, DP-3, HDMI-A-1, HDMI-A-2, HDMI-A-3 bus-ID: 00:02.0
chip-ID: 8086:191b class-ID: 0300
Device-2: NVIDIA GM204GLM [Quadro M3000M] vendor: Hewlett-Packard
driver: N/A alternate: nouveau non-free: 545.xx+ status: current (as of
2024-06; EOL~2026-12-xx) arch: Maxwell code: GMxxx process: TSMC 28nm
built: 2014-2019 pcie: gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 01:00.0
chip-ID: 10de:13fa class-ID: 0300
Device-3: Cheng Uei Precision Industry (Foxlink) HP HD Camera
driver: uvcvideo type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0
bus-ID: 1-7:2 chip-ID: 05c8:0383 class-ID: 0e02
Display: x11 server: X.Org v: 21.1.13 with: Xwayland v: 24.1.1
compositor: kwin_x11 driver: X: loaded: intel unloaded: modesetting
alternate: fbdev,vesa dri: i965 gpu: i915 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: eDP1 model: ChiMei InnoLux 0x1738 built: 2015
res: 1920x1080 hz: 60 dpi: 128 gamma: 1.2 size: 380x210mm (14.96x8.27")
diag: 437mm (17.2") ratio: 16:9 modes: 1920x1080
API: EGL v: 1.5 hw: drv: intel iris platforms: device: 0 drv: iris
device: 1 drv: swrast surfaceless: drv: iris x11: drv: iris
inactive: gbm,wayland
API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 24.1.3-arch1.1
glx-v: 1.4 direct-render: yes renderer: Mesa Intel HD Graphics 530 (SKL GT2)
device-ID: 8086:191b memory: 7.57 GiB unified: yes
API: Vulkan v: 1.3.279 layers: 10 device: 0 type: integrated-gpu
name: Intel HD Graphics 530 (SKL GT2) driver: mesa intel v: 24.1.3-arch1.1
device-ID: 8086:191b surfaces: xcb,xlib device: 1 type: cpu name: llvmpipe
(LLVM 18.1.8 256 bits) driver: mesa llvmpipe v: 24.1.3-arch1.1 (LLVM
18.1.8) device-ID: 10005:0000 surfaces: xcb,xlib
Audio:
Device-1: Intel 100 Series/C230 Series Family HD Audio
vendor: Hewlett-Packard driver: snd_hda_intel v: kernel
alternate: snd_soc_avs bus-ID: 00:1f.3 chip-ID: 8086:a170 class-ID: 0403
Device-2: NVIDIA GM204 High Definition Audio vendor: Hewlett-Packard
driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
bus-ID: 01:00.1 chip-ID: 10de:0fbb class-ID: 0403
API: ALSA v: k6.6.40-1-lts status: kernel-api with: aoss
type: oss-emulator tools: alsactl,alsamixer,amixer
Server-1: PipeWire v: 1.2.1 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: Intel Ethernet I219-LM vendor: Hewlett-Packard driver: e1000e
v: kernel port: N/A bus-ID: 00:1f.6 chip-ID: 8086:15b7 class-ID: 0200
IF: enp0s31f6 state: down mac: <filter>
Device-2: Intel Wireless 8260 driver: iwlwifi v: kernel pcie: gen: 1
speed: 2.5 GT/s lanes: 1 bus-ID: 03:00.0 chip-ID: 8086:24f3 class-ID: 0280
IF: wlp3s0 state: up mac: <filter>
Info: services: NetworkManager, systemd-timesyncd, wpa_supplicant
Bluetooth:
Device-1: Intel Bluetooth wireless interface driver: btusb v: 0.8 type: USB
rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-12:4 chip-ID: 8087:0a2b
class-ID: e001
Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 4.2
lmp-v: 8 status: discoverable: no pairing: no class-ID: 6c010c
Drives:
Local Storage: total: 1.14 TiB used: 152.91 GiB (13.1%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: SanDisk model: THNSN5256GPUK
NVMe TOSHIBA 256GB size: 238.47 GiB block-size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
fw-rev: 5KDA4103 temp: 52.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
tech: HDD rpm: 7200 serial: <filter> fw-rev: A3T0 scheme: GPT
Partition:
ID-1: / raw-size: 237.97 GiB size: 237.97 GiB (100.00%)
used: 35.2 GiB (14.8%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 513 MiB size: 512 MiB (99.80%)
used: 454.9 MiB (88.9%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 914.01 GiB size: 914.01 GiB (100.00%)
used: 117.26 GiB (12.8%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
ID-4: /var/log raw-size: 237.97 GiB size: 237.97 GiB (100.00%)
used: 35.2 GiB (14.8%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-5: /var/tmp raw-size: 237.97 GiB size: 237.97 GiB (100.00%)
used: 35.2 GiB (14.8%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
ID-1: swap-1 type: zram size: 15.5 GiB used: 0 KiB (0.0%) priority: 100
comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 4 dev: /dev/zram0
Sensors:
System Temperatures: cpu: 63.0 C pch: 61.5 C mobo: N/A
Fan Speeds (rpm): N/A
Info:
Memory: total: 16 GiB available: 15.51 GiB used: 5.77 GiB (37.2%)
Processes: 342 Power: uptime: 4m states: freeze,mem,disk suspend: deep
avail: s2idle wakeups: 0 hibernate: platform avail: shutdown, reboot,
suspend, test_resume image: 6.19 GiB services: org_kde_powerdevil,
power-profiles-daemon, upowerd Init: systemd v: 256 default: graphical
tool: systemctl
Packages: 2164 pm: pacman pkgs: 2138 libs: 596 tools: paru,yay pm: flatpak
pkgs: 26 Compilers: clang: 18.1.8 gcc: 14.1.1 Shell: garuda-inxi
default: fish v: 3.7.1 running-in: konsole inxi: 3.3.35
Garuda (2.6.26-1):
System install date:     2024-06-13
Last full system update: 2024-07-16
Is partially upgraded:   Yes
Relevant software:       snapper NetworkManager dracut(custom) mkinitcpio
Windows dual boot:       No/Undetected
Failed units:

As who can see?

Are you suggesting whatever is on that laptop screen is legible?

This is an easy issue to fix; just follow the instruction on the screen here:

Instructions for fix

image


Please add relevant information to the thread with text only, by copying and pasting out of the terminal. Screenshots should be avoided, and pictures of the screen are even worse.

You can print memory diagnostics to the terminal using something like top or ps aux, like this:

top -b -o +%MEM | head -n 20
ps aux --sort=-%mem | head -n 20

Investigate swap usage:

swapon --show
free -h

High kswapd usage could indicate a problem with memory or I/O. Use iostat to check for disk I/O:

iostat -x 1

Check if Btrfs is doing anything weird:

sudo btrfs device stats /

Yes, since your swap device is zram you will crash if swap and memory are both fully expended.

It’s possible you have a memory leak. Use the monitoring tools to identify the guilty process and try to figure out what is happening, or configure a OOM killer to take down applications that run wild with memory use.

https://wiki.archlinux.org/title/Improving_performance#Improving_system_responsiveness_under_low-memory_conditions

This should be addressed before doing any troubleshooting. Who knows, maybe this is the cause of your issue.

What’s going on here? Are you using dracut, or mkinitcpio? Probably not related to this specific issue, but I would advise configuring one or the other and get rid of the one you are not using to avoid conflicts, or complications with image generation.

4 Likes

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