From 092780a878a999b3f5150800ca81b82c486f5039 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Tue, 8 Sep 2009 15:55:52 +0100 Subject: [PATCH] set affinity carefully for each cpus specified after building domain. --- xenvm/vmact.ml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xenvm/vmact.ml b/xenvm/vmact.ml index 6a41563..a24a82f 100644 --- a/xenvm/vmact.ml +++ b/xenvm/vmact.ml @@ -270,6 +270,21 @@ let set_cpuid xc domid cfg = with exn -> warn "exception ignored during cpuid: %s" (Printexc.to_string exn) +let set_affinity xc domid cfg = + try + List.iter (fun (id, l) -> + let cpumap = Array.make 64 false in + (* make the bitmap *) + List.iter (fun x -> + if x >= 0 && x < 64 then + cpumap.(x) <- true + ) l; + (* and dump in into xen *) + Domain.vcpu_affinity_set ~xc domid id cpumap + ) cfg.cpus_affinity; + with exn -> + warn "exception ignored during affinity setting: %s" (Printexc.to_string exn) + let do_trigger xc state args = match args with | "s3resume" :: _ -> @@ -453,6 +468,7 @@ let build_vm xc xs state f restore = try f state cfg; set_cpuid xc domid cfg; + set_affinity xc domid cfg; add_devices xc xs domid state restore; with exn -> warn "receive exception building vm: %s" (Printexc.to_string exn); -- 2.39.5