Bug 364384

Summary: Ksysguard should use "MemAvailable" to correctly report application memory usage
Product: [Applications] ksysguard Reporter: Terry Barnaby <terry>
Component: ksysguardAssignee: KSysGuard Developers <ksysguard-bugs>
Status: CONFIRMED ---    
Severity: normal CC: albin.e.engstrom, bugseforuns, kde, kde, kishore96, lukebenes
Priority: NOR    
Version: 5.6.4   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Initial idea for a patch

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.