public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 ksm-control-daemon 1/2] ksmtuned: revert to use rsz instead of vsz to compute memory usage
@ 2024-04-08 12:17 Stefan Lendl
  2024-04-08 12:17 ` [pve-devel] [PATCH v2 ksm-control-daemon 2/2] ksmtuned: fix formatting when summing up large numbers Stefan Lendl
  2024-04-08 12:43 ` [pve-devel] applied: [PATCH v2 ksm-control-daemon 1/2] ksmtuned: revert to use rsz instead of vsz to compute memory usage Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Lendl @ 2024-04-08 12:17 UTC (permalink / raw)
  To: pve-devel

For summing up actual memory usage of precesses rsz is more suitable
then vsz.

This reverts commit cd5cf20cc8af53427dcb9b08486c68f376ce8743.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
---
 debian/patches/series                      |  1 -
 debian/patches/use-vsz-instead-of-rsz.diff | 13 -------------
 2 files changed, 14 deletions(-)
 delete mode 100644 debian/patches/use-vsz-instead-of-rsz.diff

diff --git a/debian/patches/series b/debian/patches/series
index 7aaec2c..32d3a35 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
 init-script.diff
 ksmtuned.diff
 adjust-ksm-slepp.diff
-use-vsz-instead-of-rsz.diff
diff --git a/debian/patches/use-vsz-instead-of-rsz.diff b/debian/patches/use-vsz-instead-of-rsz.diff
deleted file mode 100644
index 6cc4544..0000000
--- a/debian/patches/use-vsz-instead-of-rsz.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: new/ksmtuned
-===================================================================
---- new.orig/ksmtuned	2011-09-23 12:05:44.000000000 +0200
-+++ new/ksmtuned	2011-09-23 12:06:34.000000000 +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 { print sum }'
-+    ps -C "$progname" -o vsz= | awk '{ sum += $1 }; END { print sum }'
- }
- 
- free_memory () {
-- 
2.44.0





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH v2 ksm-control-daemon 2/2] ksmtuned: fix formatting when summing up large numbers
  2024-04-08 12:17 [pve-devel] [PATCH v2 ksm-control-daemon 1/2] ksmtuned: revert to use rsz instead of vsz to compute memory usage Stefan Lendl
@ 2024-04-08 12:17 ` Stefan Lendl
  2024-04-08 12:43 ` [pve-devel] applied: [PATCH v2 ksm-control-daemon 1/2] ksmtuned: revert to use rsz instead of vsz to compute memory usage Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Lendl @ 2024-04-08 12:17 UTC (permalink / raw)
  To: pve-devel

awk internally uses float for every calculation, printing a large float
with awk results in 1.233e+09 format which causes the script to fail afterwards.
Instead I am printing the float without decimals.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
---
 debian/patches/awk-printf.diff | 16 ++++++++++++++++
 debian/patches/series          |  1 +
 2 files changed, 17 insertions(+)
 create mode 100644 debian/patches/awk-printf.diff

diff --git a/debian/patches/awk-printf.diff b/debian/patches/awk-printf.diff
new file mode 100644
index 0000000..8502068
--- /dev/null
+++ b/debian/patches/awk-printf.diff
@@ -0,0 +1,16 @@
+--- ksm-control-scripts/ksmtuned	2024-01-25 11:33:03.485039813 +0100
++++ ksm-control-scripts.new/ksmtuned	2024-01-25 11:37:40.544751316 +0100
+@@ -72,11 +72,11 @@
+     # calculate how much memory is committed to running qemu processes
+     local progname
+     progname=${1:-kvm}
+-    ps -C "$progname" -o rsz | awk '{ sum += $1 }; END { print sum }'
++    ps -C "$progname" -o rsz | awk '{ sum += $1 }; END { printf ("%.0f", sum) }'
+ }
+ 
+ free_memory () {
+-    awk '/^(MemFree|Buffers|Cached):/ {free += $2}; END {print free}' \
++    awk '/^(MemFree|Buffers|Cached):/ {free += $2}; END { printf ("%.0f", free) }' \
+                 /proc/meminfo
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 32d3a35..24e8678 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 init-script.diff
 ksmtuned.diff
 adjust-ksm-slepp.diff
+awk-printf.diff
-- 
2.44.0





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied: [PATCH v2 ksm-control-daemon 1/2] ksmtuned: revert to use rsz instead of vsz to compute memory usage
  2024-04-08 12:17 [pve-devel] [PATCH v2 ksm-control-daemon 1/2] ksmtuned: revert to use rsz instead of vsz to compute memory usage Stefan Lendl
  2024-04-08 12:17 ` [pve-devel] [PATCH v2 ksm-control-daemon 2/2] ksmtuned: fix formatting when summing up large numbers Stefan Lendl
@ 2024-04-08 12:43 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2024-04-08 12:43 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Lendl

Am 08/04/2024 um 14:17 schrieb Stefan Lendl:
> For summing up actual memory usage of precesses rsz is more suitable
> then vsz.
> 
> This reverts commit cd5cf20cc8af53427dcb9b08486c68f376ce8743.
> 
> Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
> ---
>  debian/patches/series                      |  1 -
>  debian/patches/use-vsz-instead-of-rsz.diff | 13 -------------
>  2 files changed, 14 deletions(-)
>  delete mode 100644 debian/patches/use-vsz-instead-of-rsz.diff
> 
>

applied both patches, thanks!

Please still re-look into using PSS as metric, like asked in my reply to
the previous discussion thread twenty minutes ago – if that works through
`ps -C kvm -o pss` as it does on my machines, the change could be sent as
a follow-up.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-08 12:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08 12:17 [pve-devel] [PATCH v2 ksm-control-daemon 1/2] ksmtuned: revert to use rsz instead of vsz to compute memory usage Stefan Lendl
2024-04-08 12:17 ` [pve-devel] [PATCH v2 ksm-control-daemon 2/2] ksmtuned: fix formatting when summing up large numbers Stefan Lendl
2024-04-08 12:43 ` [pve-devel] applied: [PATCH v2 ksm-control-daemon 1/2] ksmtuned: revert to use rsz instead of vsz to compute memory usage Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal