ksysguard: handle multiple mounts to the same mountpoint gracefully
AcceptedPublic

Authored by jpalecek on Sat, Aug 31, 1:40 AM.

Details

Reviewers
davidedmundson
Summary

On Linux, it may happen that two mounts are mounted to the same mount point. Two different devices or the same device twice, doesn't matter. As it currently is, ksysguardd handles this case badly. When updating sensors, the checkDiskStat fuction searches the previously known mounts for the items from the current list, by comparing the mount points only. If found, the item from the old list is deleted and the new item is deemed to be preexisting.

However, if there are two items with the same mountpoint, both get deleted on the first occurence of the mountpoint in the list. Therefore, the second one doesn't have any corresponding "old" entry, and is deemed to be newly existing. This means that ksysguardd signals to its client that there are new sensors, and, atop of that, registers the "new" monitors. This eventually leads to the list of monitors expanding to tens of thousands of items. This can cause quite a cpu load eg. in Plasma.

This patch changes the logic so that every mount will only delete one corresponding item from the old list. Thus, the bloat of the list of sensors, at least in case of disk sensors, is prevented.

Part of T11473: #407526: plasma + ksysguardd causing high cpu load.

Diff Detail

Repository
R106 KSysguard
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15878
Build 15896: arc lint + arc unit
jpalecek created this revision.Sat, Aug 31, 1:40 AM
Restricted Application added a project: Plasma. · View Herald TranscriptSat, Aug 31, 1:40 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
jpalecek requested review of this revision.Sat, Aug 31, 1:40 AM
davidedmundson accepted this revision.Sat, Aug 31, 4:49 AM
This revision is now accepted and ready to land.Sat, Aug 31, 4:49 AM