cpus_allowed: use __NRPROCESSORS_CONF instead of __SC_NPROCESSORS_ONLN for non-sequen...
[fio.git] / os / windows / posix.c
index a3a6c89fd0786240bbe50fffeec7777542d91cb5..a47223daaf761e0a5ae5f0843195ea93de62d011 100644 (file)
@@ -216,10 +216,18 @@ long sysconf(int name)
        MEMORYSTATUSEX status;
 
        switch (name) {
-       case _SC_NPROCESSORS_ONLN:
-               val = GetNumLogicalProcessors();
+       case _SC_NPROCESSORS_CONF:
+               /*
+                * Using GetMaximumProcessorCount introduces a problem in
+                * gettime.c because Windows does not have
+                * fio_get_thread_affinity. Log sample (see #1479):
+                *
+                *   CPU mask contains processor beyond last active processor index (2)
+                *   clock setaffinity failed: No error
+                */
+               val = GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
                if (val == -1)
-                       log_err("sysconf(_SC_NPROCESSORS_ONLN) failed\n");
+                       log_err("sysconf(_SC_NPROCESSORS_CONF) failed\n");
 
                break;
 
@@ -1201,4 +1209,4 @@ cleanup:
        DisconnectNamedPipe(hpipe);
        CloseHandle(hpipe);
        return ret;
-}
\ No newline at end of file
+}