Compositor High CPU Usage when enabled

Hello,

I recently installed on an older machine the latest Manjaro KDE. I have been experiencing high CPU usage from kwin_x11 and Xorg (like 25-30% each). I have disabled compositor and it the usage is back to normal. I am pasting the output of inxi -Fayz and mhwd -li. Is there any way to have it enabled and not consume so much CPU? CPU is a bit old and GPU is a bit newer (both are old…)

EDIT 1: I also tried changing to the 5.4 kernel and there is no change

  Kernel: 5.9.16-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.9-x86_64 
  root=UUID=7bfdb4c1-aa47-4066-aadd-928bda6643f9 rw quiet apparmor=1 
  security=apparmor udev.log_priority=3 
  Desktop: KDE Plasma 5.20.4 tk: Qt 5.15.2 wm: kwin_x11 dm: SDDM 
  Distro: Manjaro Linux 
Machine:
  Type: Desktop Mobo: ASUSTeK model: P5K-E v: Rev 1.xx serial: <filter> 
  BIOS: American Megatrends v: 1305 date: 06/19/2009 
CPU:
  Info: Quad Core model: Intel Core2 Quad Q6600 bits: 64 type: MCP 
  arch: Core Merom family: 6 model-id: F (15) stepping: B (11) microcode: BA 
  L2 cache: 4 MiB 
  flags: lm nx pae sse sse2 sse3 ssse3 vmx bogomips: 19255 
  Speed: 2405 MHz min/max: 1596/2394 MHz Core speeds (MHz): 1: 2405 2: 2405 
  3: 2406 4: 2406 
  Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled 
  Type: l1tf mitigation: PTE Inversion; VMX: EPT disabled 
  Type: mds 
  status: Vulnerable: Clear CPU buffers attempted, no microcode; SMT disabled 
  Type: meltdown mitigation: PTI 
  Type: spec_store_bypass status: Vulnerable 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 
  mitigation: Full generic retpoline, STIBP: disabled, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: NVIDIA GF116 [GeForce GTX 550 Ti] driver: nvidia v: 390.138 
  alternate: nouveau,nvidia_drm bus ID: 01:00.0 chip ID: 10de:1244 
  Display: x11 server: X.Org 1.20.10 compositor: kwin_x11 driver: nvidia 
  display ID: :0 screens: 1 
  Screen-1: 0 s-res: 2960x1050 s-dpi: 85 s-size: 885x310mm (34.8x12.2") 
  s-diag: 938mm (36.9") 
  Monitor-1: DVI-I-2 res: 1280x1024 hz: 60 dpi: 86 
  size: 376x301mm (14.8x11.9") diag: 482mm (19") 
  Monitor-2: DVI-I-3 res: 1680x1050 hz: 60 dpi: 90 
  size: 474x296mm (18.7x11.7") diag: 559mm (22") 
  OpenGL: renderer: llvmpipe (LLVM 11.0.0 128 bits) v: 4.5 Mesa 20.3.1 
  compat-v: 3.1 direct render: Yes 
Audio:
  Device-1: Intel 82801I HD Audio vendor: ASUSTeK driver: snd_hda_intel 
  v: kernel bus ID: 00:1b.0 chip ID: 8086:293e 
  Device-2: NVIDIA GF116 High Definition Audio driver: snd_hda_intel v: kernel 
  bus ID: 01:00.1 chip ID: 10de:0bee 
  Device-3: VIA ICE1712 [Envy24] PCI Multi-Channel I/O driver: snd_ice1712 
  v: kernel bus ID: 06:02.0 chip ID: 1412:1712 
  Device-4: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo 
  bus ID: 3-4:3 chip ID: 046d:0825 serial: <filter> 
  Sound Server: ALSA v: k5.9.16-1-MANJARO 
Network:
  Device-1: Marvell 88E8056 PCI-E Gigabit Ethernet vendor: ASUSTeK 
  driver: sky2 v: 1.30 port: c800 bus ID: 02:00.0 chip ID: 11ab:4364 
  IF: enp2s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
  Device-2: Realtek RTL8187 Wireless Adapter type: USB driver: rtl8187 
  bus ID: 1-3:2 chip ID: 0bda:8187 serial: <filter> 
  IF: wlp0s26f7u3 state: down mac: <filter> 
Drives:
  Local Storage: total: 2.05 TiB used: 83.2 GiB (4.0%) 
  SMART Message: Unable to run smartctl. Root privileges required. 
  ID-1: /dev/sda maj-min: 8:0 vendor: Western Digital model: WD10EARS-00Y5B1 
  size: 931.51 GiB block size: physical: 512 B logical: 512 B speed: 3.0 Gb/s 
  serial: <filter> rev: 0A80 
  ID-2: /dev/sdb maj-min: 8:16 vendor: Samsung model: HD501LJ size: 465.76 GiB 
  block size: physical: 512 B logical: 512 B speed: 3.0 Gb/s serial: <filter> 
  rev: 0-11 
  ID-3: /dev/sdc maj-min: 8:32 vendor: Seagate model: ST3250410AS 
  size: 232.89 GiB block size: physical: 512 B logical: 512 B speed: 1.5 Gb/s 
  serial: <filter> rev: C 
  ID-4: /dev/sdd maj-min: 8:48 vendor: Samsung model: SSD 850 EVO 500GB 
  size: 465.76 GiB block size: physical: 512 B logical: 512 B speed: 3.0 Gb/s 
  serial: <filter> rev: 2B6Q 
Partition:
  ID-1: / raw size: 50.91 GiB size: 49.86 GiB (97.94%) used: 13.45 GiB (27.0%) 
  fs: ext4 dev: /dev/sdd5 maj-min: 8:53 
  ID-2: /home raw size: 51 GiB size: 49.95 GiB (97.94%) used: 1.16 GiB (2.3%) 
  fs: ext4 dev: /dev/sdd6 maj-min: 8:54 
Swap:
  Kernel: swappiness: 10 (default 60) cache pressure: 50 (default 100) 
  ID-1: swap-1 type: partition size: 4 GiB used: 0 KiB (0.0%) priority: -2 
  dev: /dev/sdd7 maj-min: 8:55 
Sensors:
  System Temperatures: cpu: 52.0 C mobo: 45.0 C gpu: nvidia temp: 61 C 
  Fan Speeds (RPM): cpu: 2410 case-1: 0 case-2: 0 case-3: 0 gpu: nvidia 
  fan: 41% 
  Power: 12v: 12.04 5v: N/A 3.3v: 3.25 vbat: N/A 
Info:
  Processes: 240 Uptime: 3m wakeups: 0 Memory: 7.77 GiB used: 1.84 GiB (23.6%) 
  Init: systemd v: 247 Compilers: gcc: 10.2.0 Packages: 1306 pacman: 1298 
  lib: 402 flatpak: 4 snap: 4 Shell: Zsh v: 5.8 running in: konsole 
  inxi: 3.2.01 

and

> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
           video-linux            2018.05.04                true            PCI
    video-nvidia-390xx            2020.11.30               false            PCI


Warning: No installed USB configs!
1 Like

First of all, install kernel 5.10, 5.9 is EOL.

Now running in Kernel 5.4 LTS and the problem is still the same as mentioned in the EDIT

I am also seeing that nvidia-smi outputs this

| NVIDIA-SMI 390.138                Driver Version: 390.138                   |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 550 Ti  Off  | 00000000:01:00.0 N/A |                  N/A |
| 41%   56C    P0    N/A /  N/A |     72MiB /   959MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0                    Not Supported                                       |
+-----------------------------------------------------------------------------+

which usually there I see processes such as xorg, kwin_x11 and other gpu accelerated applications

Uhm, so you have downgraded your kernel… Any reason you avoid just released 5.10 which will be new LTS? Your problem could have been resolved months ago in new kernel but we don’t know that unless it’s tested. And if it’s not, then at least bug report will have strong grounds as existing in newest kernel version.

Also, how is CPU usage on nouveau driver, no proprietary driver installed at all?

Remove video-linux

Install 5.4 LTS kernel and if needed then reinstall video-nvidia-390xx
If you have a custom /etc/X11/mhwd.d/nvidia.conf you should make a backup of it, and restore it later, or simply leave it be generated again.

I have been running on 5.4 LTS kernel to avoid any new bugs. (I have not tested yet 5.10 but I doubt that newer kernels will fix a problem on such an old machine).

I removed video-linux (with mhwd -r pci video-linux) and cleared any custom files from /etc/X11

Still nvidia-smi states that there is no GPU acceleration and enabling compositor increases kwin_x11 and Xorg cpu usage to 15-20%. I think that it is not even using the GPU to be honest (but I am yet a noob).

> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
    video-nvidia-390xx            2020.11.30               false            PCI


Warning: No installed USB configs!
System:
  Kernel: 5.4.85-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.4-x86_64 
  root=UUID=7bfdb4c1-aa47-4066-aadd-928bda6643f9 rw quiet apparmor=1 
  security=apparmor udev.log_priority=3 
  Desktop: KDE Plasma 5.20.4 tk: Qt 5.15.2 wm: kwin_x11 dm: SDDM 
  Distro: Manjaro Linux 
Machine:
  Type: Desktop Mobo: ASUSTeK model: P5K-E v: Rev 1.xx serial: <filter> 
  BIOS: American Megatrends v: 1305 date: 06/19/2009 
CPU:
  Info: Quad Core model: Intel Core2 Quad Q6600 bits: 64 type: MCP 
  arch: Core Merom family: 6 model-id: F (15) stepping: B (11) microcode: BA 
  L2 cache: 4 MiB 
  flags: lm nx pae sse sse2 sse3 ssse3 vmx bogomips: 19254 
  Speed: 2224 MHz min/max: 1596/2394 MHz Core speeds (MHz): 1: 2224 2: 2229 
  3: 2251 4: 2244 
  Vulnerabilities: Type: itlb_multihit status: KVM: Split huge pages 
  Type: l1tf mitigation: PTE Inversion; VMX: EPT disabled 
  Type: mds 
  status: Vulnerable: Clear CPU buffers attempted, no microcode; SMT disabled 
  Type: meltdown mitigation: PTI 
  Type: spec_store_bypass status: Vulnerable 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 
  mitigation: Full generic retpoline, STIBP: disabled, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: NVIDIA GF116 [GeForce GTX 550 Ti] driver: nvidia v: 390.138 
  alternate: nouveau,nvidia_drm bus ID: 01:00.0 chip ID: 10de:1244 
  Display: x11 server: X.Org 1.20.10 compositor: kwin_x11 driver: nvidia 
  display ID: :0 screens: 1 
  Screen-1: 0 s-res: 2960x1050 s-dpi: 85 s-size: 885x310mm (34.8x12.2") 
  s-diag: 938mm (36.9") 
  Monitor-1: DVI-I-2 res: 1280x1024 hz: 60 dpi: 86 
  size: 376x301mm (14.8x11.9") diag: 482mm (19") 
  Monitor-2: DVI-I-3 res: 1680x1050 hz: 60 dpi: 90 
  size: 474x296mm (18.7x11.7") diag: 559mm (22") 
  OpenGL: renderer: llvmpipe (LLVM 11.0.0 128 bits) v: 4.5 Mesa 20.3.1 
  compat-v: 3.1 direct render: Yes 
Audio:
  Device-1: Intel 82801I HD Audio vendor: ASUSTeK driver: snd_hda_intel 
  v: kernel bus ID: 00:1b.0 chip ID: 8086:293e 
  Device-2: NVIDIA GF116 High Definition Audio driver: snd_hda_intel v: kernel 
  bus ID: 01:00.1 chip ID: 10de:0bee 
  Device-3: VIA ICE1712 [Envy24] PCI Multi-Channel I/O driver: snd_ice1712 
  v: kernel bus ID: 06:02.0 chip ID: 1412:1712 
  Device-4: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo 
  bus ID: 3-4:3 chip ID: 046d:0825 serial: <filter> 
  Sound Server: ALSA v: k5.4.85-1-MANJARO 
Network:
  Device-1: Marvell 88E8056 PCI-E Gigabit Ethernet vendor: ASUSTeK 
  driver: sky2 v: 1.30 port: c800 bus ID: 02:00.0 chip ID: 11ab:4364 
  IF: enp2s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
  Device-2: Realtek RTL8187 Wireless Adapter type: USB driver: rtl8187 
  bus ID: 1-3:2 chip ID: 0bda:8187 serial: <filter> 
  IF: wlp0s26f7u3 state: down mac: <filter> 
Drives:
  Local Storage: total: 2.05 TiB used: 85.56 GiB (4.1%) 
  SMART Message: Unable to run smartctl. Root privileges required. 
  ID-1: /dev/sda maj-min: 8:0 vendor: Western Digital model: WD10EARS-00Y5B1 
  size: 931.51 GiB block size: physical: 512 B logical: 512 B speed: 3.0 Gb/s 
  serial: <filter> rev: 0A80 
  ID-2: /dev/sdb maj-min: 8:16 vendor: Samsung model: HD501LJ size: 465.76 GiB 
  block size: physical: 512 B logical: 512 B speed: 3.0 Gb/s serial: <filter> 
  rev: 0-11 
  ID-3: /dev/sdc maj-min: 8:32 vendor: Seagate model: ST3250410AS 
  size: 232.89 GiB block size: physical: 512 B logical: 512 B speed: 1.5 Gb/s 
  serial: <filter> rev: C 
  ID-4: /dev/sdd maj-min: 8:48 vendor: Samsung model: SSD 850 EVO 500GB 
  size: 465.76 GiB block size: physical: 512 B logical: 512 B speed: 3.0 Gb/s 
  serial: <filter> rev: 2B6Q 
Partition:
  ID-1: / raw size: 50.91 GiB size: 49.86 GiB (97.94%) used: 14.73 GiB (29.6%) 
  fs: ext4 dev: /dev/sdd5 maj-min: 8:53 
  ID-2: /home raw size: 51 GiB size: 49.95 GiB (97.94%) used: 2.03 GiB (4.1%) 
  fs: ext4 dev: /dev/sdd6 maj-min: 8:54 
Swap:
  Kernel: swappiness: 10 (default 60) cache pressure: 50 (default 100) 
  ID-1: swap-1 type: partition size: 4 GiB used: 0 KiB (0.0%) priority: -2 
  dev: /dev/sdd7 maj-min: 8:55 
Sensors:
  System Temperatures: cpu: 48.0 C mobo: 42.0 C gpu: nvidia temp: 58 C 
  Fan Speeds (RPM): cpu: 2205 case-1: 0 case-2: 0 case-3: 0 gpu: nvidia 
  fan: 41% 
  Power: 12v: 11.98 5v: N/A 3.3v: 3.25 vbat: N/A 
Info:
  Processes: 233 Uptime: 3m wakeups: 0 Memory: 7.78 GiB used: 2.71 GiB (34.9%) 
  Init: systemd v: 247 Compilers: gcc: 10.2.0 Packages: 1299 pacman: 1289 
  lib: 396 flatpak: 6 snap: 4 Shell: Zsh v: 5.8 running in: terminator 
  inxi: 3.2.01```

Definitely there is something wrong on your end.
Care to share:
cat /etc/X11/mhwd.d/nvidia.conf

There is no such file now after I deleted it. And I remember that I had to generate that file by myself. Yes OpenGL renderer is always set like that from the start

And why would you delete it? No, a default is generated automatically … and for custom things, edited carefully.
Also you should have /etc/modules-load.d/mhwd-gpu.conf with this content in it:

nvidia
nvidia-drm

and inside /etc/modprobe.d/mhwd-gpu.conf you should have:

blacklist nouveau
blacklist ttm
blacklist drm_kms_helper
blacklist drm

I gather you did not install the nvidia driver properly. Try this:
sudo pacman-mirrors -f5 && sudo pacman -Syyu
then
sudo mhwd -f -i pci video-nvidia-390xx
And let us know if the /etc/X11/mhwd.d/nvidia.conf is generated … share it unaltered, we might try something to it to test it…Then reboot.

/etc/modules-load.d/mhwd-gpu.conf has only
nvidia
/etc/modprobe.d/mhwd-gpu.conf is as you stated

I executed both commands (I did not see anything new being installed) and the newly generated /etc/X11/mhwd.d/nvidia.conf is

# nvidia-xconfig:  version 390.138  (buildmeister@swio-display-x64-rhel04-01)  Thu May 14 05:09:33 PDT 2020


Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
	Option "NoLogo" "1"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "AllowEmptyInitialConfiguration"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Extensions"
    Option         "COMPOSITE" "Enable"
EndSection

 
Section "InputClass"
    Identifier          "Keyboard Defaults"
    MatchIsKeyboard        "yes"
    Option              "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

Also I noted that nvidia-smi never reports any processes but nvidia-settings shows GPU utilization when viewing a video in browser. Still with enabled compositor, the problem persists. Maybe the KDE compositor cannot use the GPU by default and we are searching for nothing? I don’t know…

EDIT: Still renderer shows up as OpenGL: renderer: llvmpipe (LLVM 11.0.0 128 bits)

I’m going to follow this thread because I have a similar problem. But mine manifests its self when I use Vivaldi. It calms down when I close Vivaldi and use Firefox.

Vivaldi, Chrome and any Chromium-based browsers use more CPU than Firefox generally I think. In this case with the wrong OpenGL renderer, the difference is higher as I can observe.

But my main problem still stands with the wrong OpenGL renderer and the compositor using too many resources when on.

SOLUTION: I fixed the problem by referring to some old arch forum posts.
I had this

$ cat /var/log/Xorg.0.log | grep EE
[     3.130] (EE) NVIDIA: Failed to load module "glxserver_nvidia" (module does not exist, 0)
[     3.130] (EE) NVIDIA(0): Failed to initialize the GLX module; please check in your X
[     3.130] (EE) NVIDIA(0):     log file that the GLX module has been loaded in your X
[     3.130] (EE) NVIDIA(0):     server, and that the module is the NVIDIA GLX module.  If
[     3.130] (EE) NVIDIA(0):     you continue to encounter problems, Please try
[     3.130] (EE) NVIDIA(0):     reinstalling the NVIDIA driver.

and after adding these lines to /etc/X11/mhwd.d/nvidia.conf

Section "Files"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection

the renderer has switched to the GPU! Thank you very much for your help @bogdancovaciu and helping me understand the nvidia.conf and other .conf files differences.

1 Like

Kernel 5.10 (today, 5 january 2021) stable branch does not have video-nvidia-390xx!

Yep, I’ve read about it. Fortunately, I don’t have Nvidia GPU - never again I will buy one, from now on only AMD.

I may be ignorant but I see a linux510-nvidia-390xx package.

nvidia drivers have unresolved bugs for a few months and are not so stable … in combination with chromium based browsers it causes driver crashes … turning off hw acceleration in these browsers helps with this … drivers still not entirely stable, but much better overall while not under heavy load by browser

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