[pve-devel] [PATCH common 4/4] metrics: add buffer and cache to meminfo
Aaron Lauterer
a.lauterer at proxmox.com
Wed Jun 11 17:17:56 CEST 2025
On 2025-06-02 16:07, Thomas Lamprecht wrote:
> Am 23.05.25 um 18:37 schrieb Aaron Lauterer:
>> From: Folke Gleumes <f.gleumes at proxmox.com>
>>
>> Expose buffers and cache as separate metrics instead of including them
>> in memfree and memused.
>>
>> Originally-by: Folke Gleumes <f.gleumes at proxmox.com>
>> [AL: rebased and adapted to changes that happened in the meantime]
>> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
>> ---
>> src/PVE/ProcFSTools.pm | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
>> index 185b2b3..91a69be 100644
>> --- a/src/PVE/ProcFSTools.pm
>> +++ b/src/PVE/ProcFSTools.pm
>> @@ -303,6 +303,8 @@ sub read_meminfo {
>> memfree => 0,
>> memavailable => 0,
>> memused => 0,
>> + membuffers => 0,
>> + memcached => 0,
>> memshared => 0,
>> swaptotal => 0,
>> swapfree => 0,
>> @@ -328,6 +330,8 @@ sub read_meminfo {
>> # available for a new workload, without pushing the system into swap, no amount of calculating
>> # with BUFFER, CACHE, .. will get you there, only the kernel can know this.
>> $res->{memused} = $res->{memtotal} - $d->{memavailable};
>> + $res->{membuffers} = $d->{buffers};
>> + $res->{memcached} = $d->{cached};
>
> Note the comment above the line you add this, which was recently added.
>
> After reading would it make more sense to expose memavailable instead?
>
> As that, e.g., also includes things like SReclaimable, which can be huge,
> see [0] for some more background.
Yeah, I've been toying with the idea of dropping the individual cache
and buffer infos and use memavailable and maybe also the ZFS arc usage.
I'll change that in the next version of this series.
>
> [0]: https://lore.kernel.org/all/20131107101345.14d7be90@annuminas.surriel.com/#t
More information about the pve-devel
mailing list