fix(inputs.mem): Use vm.Cached as vm.Buffers on OpenBSD#18469
fix(inputs.mem): Use vm.Cached as vm.Buffers on OpenBSD#18469srebhan merged 1 commit intoinfluxdata:masterfrom
Conversation
ca9ffc9 to
e44ab9f
Compare
The problem is that vm.Cached is unavailable on OpenBSD and the nearest equivalent to Linux cache memory is vm.Buffers. Signed-off-by: Atanas Vladimirov <vladimirov.atanas@gmail.com>
e44ab9f to
576fff9
Compare
|
I made a mistake in the commit message - used Any help will be appreciated. Update: Not enough coffee - I have edited the PR title :))) |
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
|
@srebhan Verified the fix against the actual gopsutil v4.26.2 source (
The change correctly maps No test added, but the existing test file only covers the Linux platform case - the lack of OpenBSD/Darwin/FreeBSD test coverage is a pre-existing gap. |
skartikey
left a comment
There was a problem hiding this comment.
@atanas-vladimirov Thanks for the contribution!
|
Thanks, @skartikey. |
Signed-off-by: Atanas Vladimirov <vladimirov.atanas@gmail.com> (cherry picked from commit 249fe86)
On OpenBSD, Cached was hardcoded to 0 with the comment "not available", while Buffers was populated from bcachestats.Numbufpages (buffer cache pages). Since the buffer cache is the closest OpenBSD equivalent to Linux cached memory, populate Cached from the same source. This fixes the Available memory calculation which includes Cached: Available = Inactive + Cached + Free Previously, Available was understated because Cached was always 0. Ref: influxdata/telegraf#18469
Summary
The problem is that vm.Cached is unavailable on OpenBSD and the nearest equivalent to Linux cache memory is vm.Buffers.
I've been testing the change on my OpenBSD server for the last month and here is how it looks like:
Checklist
Related issues
resolves #18382