]> xenbits.xensource.com Git - osstest.git/commitdiff
Planner: Remove O(n^2) problem from plan restart
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 4 Sep 2015 16:44:21 +0000 (17:44 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 8 Sep 2015 10:29:20 +0000 (11:29 +0100)
Change `./ms-planner unprocessed' to take a file of infos on stdin,
and when we restart the planning, invoke it once.

(This would be an incompatible change to the planner, needing a
queuedaemon restart, if this patch were applied separately from the
previous "Report unprocessed planning clients".)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: New patch

ms-planner
ms-queuedaemon

index 495c8ffe2670898a46db8b5daf4a8103cffddb79..47e0ea710b8d25e92feac4a4e3c57c745f4f5b64 100755 (executable)
@@ -756,11 +756,15 @@ sub cmd_show_html () {
 }
 
 sub cmd_unprocessed () {
-    die unless @ARGV==1;
-    my ($baseinfo) = @ARGV;
+    die unless @ARGV==0;
 
     get_current_plan();
-    push @{ $plan->{Unprocessed} }, { Info => $baseinfo };
+
+    while (<STDIN>) {
+       chomp;
+       push @{ $plan->{Unprocessed} }, { Info => $_ };
+    }
+
     check_write_new_plan();
 }
 
index 29b906fc68c9f00781b397722a50e3fa2c35a28e..a249b50326f271ce8b90948d692041f172f9c175 100755 (executable)
@@ -483,10 +483,10 @@ proc restarter-restart-now {} {
        log-event "restarter-restart-now projection-running"
     }
 
-    foreach skip [set plan/queue_running] {
-       for-chan $skip {
-           chan-note-unprocessed plan $skip
-       }
+    if {[catch {
+       chans-note-unprocessed plan [set plan/queue_running]
+    } emsg]} {
+       log "INTERNAL ERROR setting unprocessed: $emsg"
     }
     report-plan plan plan
 
@@ -494,8 +494,12 @@ proc restarter-restart-now {} {
     runneeded-ensure-will 2
 }
 
-proc chan-note-unprocessed {w chan} {
-    exec ./ms-planner -w$w unprocessed [chan-plan-info $chan]
+proc chans-note-unprocessed {w chans} {
+    set data {}
+    foreach chan $chans {
+       append data [chan-plan-info $chan] "\n"
+    }
+    exec ./ms-planner -w$w unprocessed << $data
 }
 
 proc notify-to-think {w thinking} {
@@ -506,7 +510,7 @@ proc notify-to-think {w thinking} {
            projection.1 { puts-chan $thinking "!OK think noalloc" }
            projection.* {
                # oh well, can't include it in the projection; too bad
-               chan-note-unprocessed $w $thinking
+               chans-note-unprocessed $w [list $thinking]
                queuerun-step-done $w "!feature-noalloc"
            }
        }