[pve-devel] [PATCH ksm-control-daemon] ksmtuned: fix large number processing

Roland devzero at web.de
Fri Mar 1 00:55:03 CET 2024


> FWIW, depending on how the sum is used it might actually make even more
> sense to use PSS, i.e., the proportional set size which better accounts
> for shared memory by dividing that part between all its users, as if
> e.g. 10 QEMU processes have 100 MB of shared code and what not in their
> RSS, using RSS one would sum up 900 MB to much compared using PSS, but
> what's the correct one here is then depending on how they result is
> used.
>
> @Stefan, as you checked this out, would you care checking out the VSS
> vs. RSS vs. PSS matter too? I.e. checking what should make more sense to
> use and actually testing that out in a somewhat defined workload.

yes, i think PSS looks better for summing up then RSS.

> The ZFS ARC thing is something else and might be a bit more complicated,
> so I'd focus first one above at that seems to provide better
> improvements for less work, or at least with less potential to build an
> unstable control system.

mind , that the patch from
https://www.mail-archive.com/pve-devel@lists.proxmox.com/msg02453.html
is not yet complete, imho.

shouldn't we also take arc_min into account , as this can't be
freed/reclaimed  from arc ?

i have reworked the memory calculation routine from free_memory ()
little bit

root at s740:~# free
                total        used        free      shared buff/cache  
available
Mem:        16165308    15489260      787056       30588 165628      676048
Swap:              0           0           0

root at s740:~# ./getfreemem.sh
Memfree:    763 MB
Buffers:      0 MB
Cached:     122 MB
arc_min:    493 MB
arc_size:  4732 MB
Free = Memfree + Buffers + Cached + arc_size - arc_min = 5124 MB

root at s740:~# arcstat
     time  read  ddread  ddh%  dmread  dmh%  pread  ph%   size c  avail
00:45:50     0       0     0       0     0      0    0   4.6G 4.7G   156M

#!/bin/bash

exec awk '
       {
           if ($1 == "MemFree:") {memfree = int($2/1024); printf
"Memfree:  %5d MB\n",memfree}
           if ($1 == "Buffers:") {buffers = int($2/1024); printf
"Buffers:  %5d MB\n",buffers}
           if ($1 == "Cached:")  {cached  = int($2/1024); printf
"Cached:   %5d MB\n",cached}
           if ($1 == "c_min")    {arcmin  = int($3/1024/1024); printf
"arc_min:  %5d MB\n",arcmin}
           if ($1 == "size")     {arcsize = int($3/1024/1024); printf
"arc_size: %5d MB\n",arcsize}
       }
       END {print "Free = Memfree + Buffers + Cached + arc_size -
arc_min = " memfree + buffers + cached + arcsize - arcmin " MB"}
       ' /proc/meminfo /proc/spl/kstat/zfs/arcstats


More information about the pve-devel mailing list