Bug 525481 - GPU Memory usage is inflated
Summary: GPU Memory usage is inflated
Status: RESOLVED FIXED
Alias: None
Product: ksystemstats
Classification: Frameworks and Libraries
Component: General (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-09-10 12:40 UTC by Roan Bukaci
Modified: 2026-10-02 19:16 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.8.0
Sentry Crash Report:


Attachments
Plasmashell VRAM usage: System Monitor on the left and drm-total-vram from plasmashell's FD. (21.30 KB, image/png)
2026-09-10 12:40 UTC, Roan Bukaci
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roan Bukaci 2026-09-10 12:40:03 UTC
Created attachment 195943 [details]
Plasmashell VRAM usage: System Monitor on the left and drm-total-vram from plasmashell's FD.

DESCRIPTION
Ksystemstats reports inflated VRAM usage. This is caused by libksysguard summing multiple DRM entries even though they are explicitly aliases (drm-memory-* and drm-resident-*). plasma-systemmonitor is especially impacted by this.

STEPS TO REPRODUCE
1. Open any program that uses GPU memory (plasmashell also reproduces this).
2. Note the GPU Memory column in plasma-systemmonitor for that process (Applications or Processes tab).
3. Compare against `cat /proc/<pid>/fdinfo/* | grep -E 'drm-total-vram|drm-total-gtt'` for the same process (may not produce anything as this information is optional).

OBSERVED RESULT
Processes appear to be using double the amount of VRAM they should be.

EXPECTED RESULT
libksysguard should only count either drm-total-vram and drm-total-gtt or drm-memory-vram and drm-memory-gtt (drm-memory-* is deprecated and only used by amdgpu).

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 44
KDE Plasma Version: 6.7.4
KDE Frameworks Version: 6.29.0
Qt Version: 6.11.2
GPU: Radeon RX 6600
Kernel: 7.1.13-200.fc44.x86_64

ADDITIONAL INFORMATION
Doc for DRM: https://www.kernel.org/doc/html/latest/gpu/drm-usage-stats.html#memory
I have a fix in progress and will link a merge request here shortly.
Comment 1 David Edmundson 2026-09-10 13:30:37 UTC
>I have a fix in progress and will link a merge request here shortly.

Nice.
Comment 2 Bug Janitor Service 2026-09-10 14:47:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/libksysguard/-/merge_requests/485
Comment 3 Nate Graham 2026-10-02 19:06:18 UTC
Git commit f40f6ad77a46585948de4c0cf1c81bf6309dcb7d by Nate Graham, on behalf of Roan Bukaci.
Committed on 02/10/2026 at 18:42.
Pushed by ngraham into branch 'master'.

processcore/gpu: don't double count GPU memory total/resident/memory drm keys

The fdinfo interface can produce multiple drm keys that reference the same memory region, namely:
drm-total-<region>, drm-resident-<region>, and the deprecated drm-memory-<region> (which is an alias to drm-resident-<region>, exposed by amdgpu).
The code previously summed any drm entry based on certain prefixes,
we now ignore drm-resident-<region>, and only consider drm-memory-<region> if no drm-total-<region> was found.

M  +36   -13   processcore/plugins/gpu/gpu.cpp

https://invent.kde.org/plasma/libksysguard/-/commit/f40f6ad77a46585948de4c0cf1c81bf6309dcb7d
Comment 4 Nate Graham 2026-10-02 19:16:24 UTC
Git commit 689c7b6112fca1558611013d8d90530c40b73009 by Nate Graham, on behalf of Roan Bukaci.
Committed on 02/10/2026 at 19:12.
Pushed by ngraham into branch 'Plasma/6.8'.

processcore/gpu: don't double count GPU memory total/resident/memory drm keys

The fdinfo interface can produce multiple drm keys that reference the same memory region, namely:
drm-total-<region>, drm-resident-<region>, and the deprecated drm-memory-<region> (which is an alias to drm-resident-<region>, exposed by amdgpu).
The code previously summed any drm entry based on certain prefixes,
we now ignore drm-resident-<region>, and only consider drm-memory-<region> if no drm-total-<region> was found.
(cherry picked from commit f40f6ad77a46585948de4c0cf1c81bf6309dcb7d)

M  +36   -13   processcore/plugins/gpu/gpu.cpp

https://invent.kde.org/plasma/libksysguard/-/commit/689c7b6112fca1558611013d8d90530c40b73009