[Xen-devel] [OSSTEST PATCH 20/21] hostalloc_maxwait_max: Use starvation most_optimistic

Ian Jackson posted 21 patches 6 years, 9 months ago
[Xen-devel] [OSSTEST PATCH 20/21] hostalloc_maxwait_max: Use starvation most_optimistic
Posted by Ian Jackson 6 years, 9 months ago
Now that we have a more sophisticated estimate of our likely scheduled
time, use it here too.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 ts-hosts-allocate-Executive | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 7ea3c4af..b75927c1 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -865,10 +865,15 @@ sub attempt_allocation {
 	    # We quit if:
 	    #  * we have been waiting at least $maxwait/2
 	    #  * we estimate it will take at least $maxwait overall
-	    my $wait_sofar = $now - $alloc_start_time;
-	    if ($wait_sofar > $maxwait/2
-		&& $wait_sofar + $best->{Start} > $maxwait) {
-		logm "timed out: $wait_sofar, $best->{Start}, $maxwait";
+	    my $est_abs = most_optimistic($best, $now, $maxwait/2);
+	    if (defined $est_abs) {
+		my $wait_sofar = $now - $alloc_start_time;
+		my $wait_exp = $est_abs - $alloc_start_time;
+		if ($wait_exp > $maxwait) {
+		    logm "timed out: $wait_exp > $maxwait ($wait_sofar)",
+		    return 2;
+		}
+	    }
 	} elsif (%$starvation_p) {
 	    my $est_abs = most_optimistic($best, $now, $starvation_p->{I});
 	    my ($starving, $m) = starving($est_abs);
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel