فهرست منبع

HPCC-19870 Fix some minor dynamic affinity issues

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 7 سال پیش
والد
کامیت
5015395292
3فایلهای تغییر یافته به همراه5 افزوده شده و 5 حذف شده
  1. 3 0
      roxie/ccd/ccdlistener.cpp
  2. 1 1
      roxie/ccd/ccdstate.cpp
  3. 1 4
      system/jlib/jsort.cpp

+ 3 - 0
roxie/ccd/ccdlistener.cpp

@@ -920,6 +920,9 @@ extern void updateAffinity(unsigned __int64 affinity)
                 CPU_SET(core, &cpus);
             affinity >>= 1;
         }
+
+        //MORE: I think this only sets the affinity of the process, not of the threads.
+        //It would require code to iterate through /proc/<pid>/task/*
         if (sched_setaffinity(0, sizeof(cpu_set_t), &cpus))
             throw makeStringException(errno, "Failed to set affinity");
         clearAffinityCache();

+ 1 - 1
roxie/ccd/ccdstate.cpp

@@ -2606,7 +2606,7 @@ private:
         case 'S':
             if (stricmp(queryName, "control:setAffinity")==0)
             {
-                __uint64 affinity = control->getPropBool("@val", true);
+                __uint64 affinity = control->getPropInt64("@val", 0); // by default just refresh cached settings
                 topology->setPropInt64("@affinity", affinity);
                 updateAffinity(affinity);
             }

+ 1 - 4
system/jlib/jsort.cpp

@@ -41,10 +41,7 @@
 
 static bool sortParallel(unsigned &numcpus)
 {
-    static unsigned numCPUs = 0;
-    if (numCPUs==0) {
-        numCPUs = getAffinityCpus();
-    }
+    unsigned numCPUs = getAffinityCpus();
     if ((numcpus==0)||(numcpus>numCPUs))
         numcpus = numCPUs;
 #ifdef TESTPARSORT