[pve-devel] [PATCH ksm-control-daemon] ksmtuned: use PSS instead of RSZ for caluculating memory usage

Roland devzero at web.de
Thu Apr 11 12:04:05 CEST 2024


hello,

nice to see some progress here, but keep in mind that memory calculation
is completely wrong on zfs based systems,
where arcsize is not taken into account

https://bugzilla.proxmox.com/show_bug.cgi?id=3859

regards
roland

Am 08.04.24 um 15:25 schrieb Stefan Lendl:
> PSS properly accounts for memory usage of shared libraries and is
> therefore better suited when summing up memory usage of multiple
> processes.
>
> Signed-off-by: Stefan Lendl <s.lendl at proxmox.com>
> ---
>   debian/patches/series                      |  1 +
>   debian/patches/use-pss-instead-of-rsz.diff | 11 +++++++++++
>   2 files changed, 12 insertions(+)
>   create mode 100644 debian/patches/use-pss-instead-of-rsz.diff
>
> diff --git a/debian/patches/series b/debian/patches/series
> index 24e8678..1bdac37 100644
> --- a/debian/patches/series
> +++ b/debian/patches/series
> @@ -2,3 +2,4 @@ init-script.diff
>   ksmtuned.diff
>   adjust-ksm-slepp.diff
>   awk-printf.diff
> +use-pss-instead-of-rsz.diff
> diff --git a/debian/patches/use-pss-instead-of-rsz.diff b/debian/patches/use-pss-instead-of-rsz.diff
> new file mode 100644
> index 0000000..885bf30
> --- /dev/null
> +++ b/debian/patches/use-pss-instead-of-rsz.diff
> @@ -0,0 +1,11 @@
> +--- ksm-control-scripts/ksmtuned	2024-04-08 15:10:04.218449486 +0200
> ++++ ksm-control-scripts.new/ksmtuned	2024-04-08 15:10:16.214620527 +0200
> +@@ -72,7 +72,7 @@
> +     # calculate how much memory is committed to running qemu processes
> +     local progname
> +     progname=${1:-kvm}
> +-    ps -C "$progname" -o rsz | awk '{ sum += $1 }; END { printf ("%.0f", sum) }'
> ++    ps -C "$progname" -o pss= | awk '{ sum += $1 }; END { printf ("%.0f", sum) }'
> + }
> +
> + free_memory () {



More information about the pve-devel mailing list