This forum has been archived. All content is frozen. Please use KDE Discuss instead.

plasmashell consumes very high amount of VRAM [SOLVED]

Tags: None
(comma "," separated)
User avatar
Lissanro
Registered Member
Posts
3
Karma
0
In the past (many months ago) plasmashell was consuming reasonable amount of VRAM with two FullHD and one 1440p monitors. After logging in, total VRAM usage was always noticeably less than 1GiB. I never payed attention to what plasma version I am using, so I cannot say with what version it worked well. Currently I'm using plasmashell 5.18.4. After logging in 2625MiB of VRAM is used. If I kill plasmashell, then VRAM usage drops to 340MiB (abouth 100MiB used by GIMP, the rest by plasmashell and Xorg). Nowadays I often have to do things without plasmashell if I work with GPU heavy applications such as Blender.

Interesting thing is that extreme memory usage is not caused by plasmashell directly. With plasmashell running, Xorg uses a lot more VRAM than it should:
Code: Select all
% nvidia-smi
...
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     14365      G   /usr/lib/xorg/Xorg                          2336MiB |
|    0     17440      G   /usr/bin/plasmashell                         115MiB |
|    0     17478      G   nvidia-settings                                0MiB |


After killall plasmashell Xorg uses very little VRAM:
Code: Select all
% nvidia-smi
...
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     14365      G   /usr/lib/xorg/Xorg                           168MiB |
|    0     17478      G   nvidia-settings                                0MiB |


I tried to remove all plasma related config files by running "mv ~/.config/plasma* /tmp/" then restarting plasmashell, but it still uses extreme amounts of VRAM. I tried also disconnecting all monitors but one, then start plasmashell. This reduced VRAM usage by Xorg to 605MiB, still way too much for one monitor. However after connecting other two monitors and restarting plasmashell one more time, Xorg VRAM usage became 1306MiB, which is still way too much, but noticeably less than 2336MiB after logging in with three 3 monitors.

I'm using XRender rendering backend, OpenGL backend consumes about 700MiB more VRAM. In the past when plasmashell did not consume this much VRAM, OpenGL backend was consuming noticeably more VRAM too, but I think it was like 100-300MiB more, not 700MiB more.

Out of curiosity, I tried liquidshell instead of plasmashell, and it does not have this issue... but it does not support moving panel to secondary monitor or making the panel vertical, and has issues with maximized windows... in other words, liquidshell does not really support multiple monitors so I cannot really use it in my case even as temporary workaround.

I'm using Ubuntu 20.04 with GTX 2060 SUPER 8GB card and NVidia driver 440.64.

Can someone else with NVidia card reproduce this issue? To check, just run nvidia-smi before and after killing plasmashell. Any ideas what can I try as a workaround? Downgrading was obvious thing to try, but after installing plasma-workspace_5.16.5 which contains plasmashell binary I got error "Plasma cannot start. All shell packages missing. This is an installation issue, please contact your distribution." - perhaps I need to downgrade more packages, but I do not know which ones.

Last edited by Lissanro on Sun May 03, 2020 3:30 am, edited 1 time in total.
User avatar
Lissanro
Registered Member
Posts
3
Karma
0
I managed to downgrade, but this did not solve the issue. First, I tried 5.16.5, to make it worked I installed the following packages:

Code: Select all
sudo dpkg -i libgps23_3.17-7_amd64.deb plasma-workspace_5.16.5-0ubuntu1_amd64.deb plasma-framework_5.62.0-0ubuntu2_amd64.deb libkf5plasma5_5.62.0-0ubuntu2_amd64.deb kde-style-oxygen-qt5_5.16.5-0ubuntu1_amd64.deb plasma-desktop-data_5.16.5-0ubuntu1_all.deb /tmp/plasma-desktop_5.16.5-0ubuntu1_amd64.deb


But nothing changed. Strange, I do not know when things broke, but I think in Ubuntu 20.04 plasmashell did work well in October/December 2019. 5.16.5 included in Ubuntu 19.10 released October 17, 2019 so it should have worked, but it did not fix the issue.

I decided to downgrade to even older version (plasma 5.12.4), I had to even uninstall some packages to make it work:
Code: Select all
sudo dpkg -r kde-full kdeedu qalculate step qalculate-gtk qalc libqalculate20-data libqalculate20 drkonqi
sudo dpkg -i libcln6_1.3.4-2_amd64.deb libqalculate6-data_0.9.10-1_all.deb libqalculate6_0.9.10-1_amd64.deb qml-module-org-kde-extensionplugin_5.44.0-0ubuntu1_all.deb plasma-workspace_5.12.4-0ubuntu3_amd64.deb plasma-desktop-data_5.12.4-0ubuntu1_all.deb plasma-desktop_5.12.4-0ubuntu1_amd64.deb


And then issue was still there. So it seems it is not caused by plasmashell directly, but for some reason Xorg uses way too much VRAM when running plasmashell, and issue is specific to plasmashell, it does not exist with liquidshell (lightweight replacement for KDE plasmashell). Removing ~/.config/plasma* does not help - even with old plasmashell, Xorg becomes 1302MiB large (without plasmashell it is 214MiB large).

I tried disabling full compositing pipeline and restarting sddm - issue is still there, even with old plasmashell. Maybe I needed to downgrade more KDE packages... it is not obvious what exactly in plasmashell causes this, since it causes it indirectly, and everything worked well with the same hardware in the past. I do not know what else to try at the moment.

I would appreciate if somebody with NVidia card and Ubuntu 20.04 would post nvidia-smi output before and after killing plasmashell, and mention if they are using XRender or OpenGL compositor backend, and what monitor(s) they are using and NVidia driver version. This way I know if it is just me with this issue or others have it too.
User avatar
Lissanro
Registered Member
Posts
3
Karma
0
I think I solved it, but I'm still not sure exactly what the root cause was, so I will describe everything I did.

I knew that at least in February everything worked well since I had a screenshot where with plasmashell running memory usage in nvidia-settings was reasonable. I was using NVidia driver 440.33 back then. Since it was clear that plasmashell is not causing the issue by itself but because of external dependency, I decided to try downgrading NVidia driver and see what happens. I tried 435 version, but issue remained the same. I returned to 440.66, issue was still there. I decided to reinstall everything nvidia driver related by running sudo apt-get remove nvidia-\*, and then install NVidia driver again (I could have used --reinstall option, but by removing everything nvidia related I could make sure that I get rid of any nvidia packages I do not actually need and which may be causing issues).

While doing all that, I noticed that if /lib/x86_64-linux-gnu/libGLX_nvidia.so.0 is missing, then plasmashell does not use VRAM at all, but runs just fine, at least with XRender backend. If after starting plasmashell I put libGLX_nvidia.so.0 to its expected place, all other application work well too, including Blender, without any performance issues. This is nvidia-smi output with plasmashell running if it was unable to find libGLX_nvidia.so.0:
Code: Select all
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64.00    Driver Version: 440.64.00    CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| 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 RTX 206...  Off  | 00000000:01:00.0  On |                  N/A |
| 38%   51C    P0    41W / 175W |    408MiB /  7981MiB |      6%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     26113      G   /usr/lib/xorg/Xorg                           332MiB |
|    0     26732      G   nvidia-settings                                0MiB |
+-----------------------------------------------------------------------------+


This was acceptable workaround, so I just used my system for a while since yesterday. Today, I decided to investigate further, but I was surprised that now plasmashell does not consume excess VRAM anymore, in fact if I run plasmashell with /lib/x86_64-linux-gnu/libGLX_nvidia.so.0 this causes Xorg to consume less VRAM; plasmashell itself consumes a bit of VRAM but it saves more VRAM in Xorg than consumes itself, so running it with libGLX_nvidia.so.0 is the most efficient way both performance and memory wise.

Code: Select all
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64.00    Driver Version: 440.64.00    CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| 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 RTX 206...  Off  | 00000000:01:00.0  On |                  N/A |
| 38%   51C    P0    41W / 175W |    288MiB /  7981MiB |      5%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     26113      G   /usr/lib/xorg/Xorg                           206MiB |
|    0     26732      G   nvidia-settings                                0MiB |
|    0    732732      G   plasmashell                                    5MiB |
+-----------------------------------------------------------------------------+


I tried few more times killing and restarting plasmashell, and this remained true - total VRAM usage was less when plasmashell was able to find libGLX_nvidia.so.0 even though it used 5MiB for itself. I'm also using full compositor pipeline in Xorg.conf to prevent tearing on all three monitors, not sure if it affects VRAM consumption by Xorg.

I do not know if this issue is solved for good or it will come back, but hopefully it will not. Why previously plasmashell was using 115MiB instead of 5MiB and forced Xorg to grow beyond 2GiB I do not know. Now Xorg uses about 200-300MiB with plasmashell running, which is about order of magnitude better, and I assume it was like that originally before the issue appeared. My Ubuntu 20.04 was installed few months ago from scratch to take advantage of ZFS root support, so my installation is relatively fresh, I have no idea why it screwed up in this weird way and why only plasmashell was affected. Since I cannot reproduce the issue anymore (it was 100% reproducible before yesterday), there is no way to investigate this farther, but it is clear the issue was somehow related to NVidia driver packages.

If somebody have similar issue with plasmashell using too much video memory, I suggest switching to XRender backend in Compositor settings and then running
Code: Select all
sudo mv /lib/x86_64-linux-gnu/libGLX_nvidia.so.0 /tmp/; killall plasmashell; sleep 2; plasmashell &> /dev/null& disown; sleep 10; sudo mv /tmp/libGLX_nvidia.so.0 /lib/x86_64-linux-gnu/
and see if it helps. Removing everything NVidia related and installing NVidia driver again also may be a good idea. These steps helped me to get plasmashell working well even with libGLX_nvidia.so.0 present.

UPDATE:
I finally was able to find the cause. At some point, the issue happened again, and above workarounds did not work for me anymore. But running the following command and choosing "Software" Rendering Backend fixed the issue:
Code: Select all
kcmshell5 qtquicksettings

My guess, previous workaround triggered Software Rendering Backend (I was not aware of qtquicksettings at the time), but at some point it was reset to OpenGL. Only noticeable difference when using Software backend is that plasmashell does not consume gigabytes of VRAM for no reason. I did not notice higher CPU usage and I did not notice any performance issues in 3D applications such as Blender or video players.


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]