summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Schmaus <flow@gentoo.org>2022-10-19 10:38:35 +0200
committerFlorian Schmaus <flow@gentoo.org>2022-10-19 10:38:35 +0200
commit4a9cd4d8a4efd8f2e52483117b4009122393c6a6 (patch)
tree8a467d1618431f5353fa676ca58b32bb18ba21aa /0025-xl-move-freemem-s-credit-expired-loop-exit.patch
parentXen 4.15.4-pre-patchset-0.1 (diff)
downloadxen-upstream-patches-4a9cd4d8a4efd8f2e52483117b4009122393c6a6.tar.gz
xen-upstream-patches-4a9cd4d8a4efd8f2e52483117b4009122393c6a6.tar.bz2
xen-upstream-patches-4a9cd4d8a4efd8f2e52483117b4009122393c6a6.zip
Xen 4.15.4-pre-patchset-14.15.4-pre-patchset-1
Signed-off-by: Florian Schmaus <flow@gentoo.org>
Diffstat (limited to '0025-xl-move-freemem-s-credit-expired-loop-exit.patch')
-rw-r--r--0025-xl-move-freemem-s-credit-expired-loop-exit.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/0025-xl-move-freemem-s-credit-expired-loop-exit.patch b/0025-xl-move-freemem-s-credit-expired-loop-exit.patch
new file mode 100644
index 0000000..c3a1965
--- /dev/null
+++ b/0025-xl-move-freemem-s-credit-expired-loop-exit.patch
@@ -0,0 +1,55 @@
+From c37099426ea678c1d5b6c99ae5ad6834f4edd2e6 Mon Sep 17 00:00:00 2001
+From: Jan Beulich <jbeulich@suse.com>
+Date: Wed, 27 Jul 2022 09:29:31 +0200
+Subject: [PATCH 25/67] xl: move freemem()'s "credit expired" loop exit
+
+Move the "credit expired" loop exit to the middle of the loop,
+immediately after "return true". This way having reached the goal on the
+last iteration would be reported as success to the caller, rather than
+as "timed out".
+
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
+master commit: d8f8cb8bdd02fad3b6986ae93511f750fa7f7e6a
+master date: 2022-07-18 17:48:18 +0200
+---
+ tools/xl/xl_vmcontrol.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
+index 5dee7730ca76..d1c6f8aae67a 100644
+--- a/tools/xl/xl_vmcontrol.c
++++ b/tools/xl/xl_vmcontrol.c
+@@ -332,7 +332,7 @@ static bool freemem(uint32_t domid, libxl_domain_config *d_config)
+ if (rc < 0)
+ return false;
+
+- do {
++ for (;;) {
+ time_t start;
+
+ rc = libxl_get_free_memory(ctx, &free_memkb);
+@@ -342,6 +342,9 @@ static bool freemem(uint32_t domid, libxl_domain_config *d_config)
+ if (free_memkb >= need_memkb)
+ return true;
+
++ if (credit <= 0)
++ return false;
++
+ rc = libxl_set_memory_target(ctx, 0, free_memkb - need_memkb, 1, 0);
+ if (rc < 0)
+ return false;
+@@ -354,9 +357,7 @@ static bool freemem(uint32_t domid, libxl_domain_config *d_config)
+ return false;
+
+ credit -= difftime(time(NULL), start);
+- } while (credit > 0);
+-
+- return false;
++ }
+ }
+
+ static void reload_domain_config(uint32_t domid,
+--
+2.37.3
+