https://bugs.kde.org/show_bug.cgi?id=384515

Arjen Hiemstra <ahiems...@heimr.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|https://commits.kde.org/ksy |https://commits.kde.org/ksy
                   |sguard/62df377051f4b266974d |sguard/7a103a45e3496b57ed76
                   |e5751d5f9363030a6670        |f99e89ea18cbabdba8c7

--- Comment #10 from Arjen Hiemstra <ahiems...@heimr.nl> ---
Git commit 7a103a45e3496b57ed76f99e89ea18cbabdba8c7 by Arjen Hiemstra, on
behalf of Jakob Kummerow.
Committed on 19/02/2020 at 10:49.
Pushed by ahiemstra into branch 'master'.

Linux/cpuinfo.c: grow buffer size as needed for 12+ core CPUs

Summary:
Getting CPU information starts with reading /proc/cpuinfo into a buffer; if
that buffer is too small, then no information will be returned at all
(updateCpuInfo() will return -1, so initCpuInfo() will return early); the
consequence is that ksysguardd/ksysguard/plasmaengineexplorer won't know about
"system/cores" or "cpu/system/AverageClock"; that in turn will make the "System
Load Viewer" plasmoid completely dysfunctional (it won't show *any* data)
because it relies on "system/cores" being available.

The buffer is currently 32KiB large, which is not enough on modern hardware
(e.g. 12-core/24-thread systems exceed it). This patch lowers the initial size
to 8KiB to be as memory-efficient as possible on low-end systems (dual/quadcore
systems shouldn't ever need to grow it), and grows the buffer size as needed to
accommodate arbitrarily many CPUs (tested on a 72-thread system, where the
buffer grows four times, reaching 128KiB final size).

When the buffer needs to grow, its size is doubled, so the overall cost of the
growth scales linearly with the file size (on average, each byte is copied to a
larger buffer at most once). Also, the buffer size is remembered as long as the
process runs, so the cost of the growth is only incurred once on startup (or if
additional CPUs come online, which is probably rare).

I've verified locally that this patch fixes the issue: the System Log Viewer
plasmoid shows data as expected afterwards.

Reviewers: davidedmundson, ahiemstra

Reviewed By: ahiemstra

Subscribers: ngraham, ahiemstra, cfeck, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27362

M  +15   -8    ksysguardd/Linux/cpuinfo.c

https://commits.kde.org/ksysguard/7a103a45e3496b57ed76f99e89ea18cbabdba8c7

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to