Bug 364384 - Ksysguard should use "MemAvailable" to correctly report application memory usage
Summary: Ksysguard should use "MemAvailable" to correctly report application memory usage
Status: CONFIRMED
Alias: None
Product: ksysguard
Classification: Applications
Component: ksysguard (show other bugs)
Version: 5.6.4
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-16 15:13 UTC by Terry Barnaby
Modified: 2020-11-12 11:40 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Initial idea for a patch (1.51 KB, patch)
2016-06-16 15:17 UTC, Terry Barnaby
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Terry Barnaby 2016-06-16 15:13:58 UTC
The ksysguard application and the "System Load" widget both report incorrect values for application memory usage. They have not been updated to use the latest kernel's /proc/meminfo's MemAvailable parameter. This means the Application memory value can be significantly larger than it should be (seen 11G rather than 4G on a server running NFS/SMB) as it includes memory that is effectively being used for caching rather than actually needed and in use by applications. Other applications such as top are ok.
I will attach a patch that tries to fix this. This needs looking at to make sure it functions as desired and correctly.

Reproducible: Always
Comment 1 Terry Barnaby 2016-06-16 15:17:44 UTC
Created attachment 99533 [details]
Initial idea for a patch

This patches ksysguard so that the application memory usage is calculated better. It may be wrong/have issues and other KDE code (System Load) may also need changing. It is supplied as an example of what I think needs to be done, but it will likely need more work.
Comment 2 lukebenes 2019-09-22 17:03:38 UTC
This is a valid problem.  Linux kernel >= 3.14 provides a "MemAvailable" field in /proc/meminfo[1] which gives the estimated amount of memory available for applications.

The patch needs some work. Take a look at how libgtop added support[2].


[1] https://github.com/torvalds/linux/commit/34e431b0ae398fc54ea69ff85ec700722c9da773
[2] https://gitlab.gnome.org/GNOME/libgtop/commit/0580b2fb2ca8fdde2031c8aba991bafac64d8dbd
Comment 3 lukebenes 2019-09-22 17:12:16 UTC
John,
Could you please take a look at this patch?
Comment 4 David Edmundson 2019-09-22 17:51:36 UTC
Could you put patches on phabricator? They tend to get lost otherwise.