[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC 54/59] controller/run: Add RunConfig.NumaDisable



From: George Dunlap <george.dunlap@xxxxxxxxxx>

If RunConfig.NumaDisable is set, get each worker's
WorkerConfig.SoftAffinity to the cpumap of the cpupool the VM is going
to be running in.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
 benchmark.go |  4 ++++
 run.go       | 35 ++++++++++++++++++++++++++++++++---
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/benchmark.go b/benchmark.go
index d5a0ac8..abe2dfb 100644
--- a/benchmark.go
+++ b/benchmark.go
@@ -142,6 +142,7 @@ type RunConfig struct {
        Scheduler string
        Pool string
        Cpus []int
+       NumaDisable *bool `json:",omitempty"`
 }
 
 // Propagate unset values from a higher level
@@ -155,6 +156,9 @@ func (l *RunConfig) PropagateFrom(g RunConfig) {
        if l.Cpus == nil {
                l.Cpus = g.Cpus
        }
+       if l.NumaDisable == nil {
+               l.NumaDisable = g.NumaDisable
+       }
 }
 
 type BenchmarkRun struct {
diff --git a/run.go b/run.go
index 2d0db01..d1c5d95 100644
--- a/run.go
+++ b/run.go
@@ -312,14 +312,43 @@ func (run *BenchmarkRun) Prep() (ready bool, why string) {
        return 
 }
 
+func (run *BenchmarkRun) GetCpumap() (Cpumap Bitmap) {
+       if run.RunConfig.Pool == "" {
+               fmt.Printf("Run.Prep: No pool set, using 0\n")
+               pool := Ctx.CpupoolInfo(0)
+               Cpumap = pool.Cpumap
+       } else {
+               pool, poolPresent := Ctx.CpupoolFindByName(run.RunConfig.Pool)
+               if poolPresent {
+                       Cpumap = pool.Cpumap
+               } else {
+                       panic("run.GetCpumap(): Pool "+run.RunConfig.Pool+" not 
found!")
+               }
+       }
+       return
+}
+
 func (run *BenchmarkRun) Run() (err error) {
        for wsi := range run.WorkerSets {
-               run.WorkerSets[wsi].Config.PropagateFrom(run.WorkerConfig)
-               if run.WorkerSets[wsi].Config.Pool == "" {
-                       run.WorkerSets[wsi].Config.Pool = run.RunConfig.Pool
+               conf := &run.WorkerSets[wsi].Config
+               
+               conf.PropagateFrom(run.WorkerConfig)
+               if conf.Pool == "" {
+                       conf.Pool = run.RunConfig.Pool
                }
                run.WorkerSets[wsi].Params.SetkHZ(CpukHZ)
                
+               if *run.RunConfig.NumaDisable {
+                       if conf.SoftAffinity != "" {
+                               err = fmt.Errorf("Cannot disable Numa if 
SoftAffinity is set!")
+                               return
+                       }
+                       // Disable libxl NUMA by setting the soft
+                       // affinity to the set of cpus in the cpupool
+                       conf.SoftAffinity = run.GetCpumap().String()
+                       fmt.Printf("Setting SoftAffinity to %s to disable NUMA 
placement\n",
+                               conf.SoftAffinity)
+               }
        }
        
        Workers, err := NewWorkerList(run.WorkerSets, WorkerXen)
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.