[x265] [PATCH] threadpool: Fix counting of cpusPerNode for linux

Pradeep Ramachandran pradeep at multicorewareinc.com
Wed Jun 1 10:54:36 CEST 2016


# HG changeset patch
# User Pradeep Ramachandran <pradeep at multicorewareinc.com>
# Date 1464771107 -19800
#      Wed Jun 01 14:21:47 2016 +0530
# Node ID c0f5b6fa11549aadf507b1bb7d7493c32773c187
# Parent  6d3849d648f0be5a8e334f1d75a2f7cf93c86cb3
threadpool: Fix counting of cpusPerNode for linux

diff -r 6d3849d648f0 -r c0f5b6fa1154 source/common/threadpool.cpp
--- a/source/common/threadpool.cpp	Sun May 29 21:50:25 2016 +0800
+++ b/source/common/threadpool.cpp	Wed Jun 01 14:21:47 2016 +0530
@@ -277,16 +277,16 @@
 #elif HAVE_LIBNUMA
     if (bNumaSupport)
     {
+        struct bitmask* bitMask = numa_allocate_cpumask();
         for (int i = 0; i < numNumaNodes; i++)
         {
-            struct bitmask* bitMask = numa_allocate_cpumask();
             int ret = numa_node_to_cpus(i, bitMask);
             if (!ret)
-                cpusPerNode[i] = numa_num_possible_cpus();
+                cpusPerNode[i] = numa_bitmask_weight(bitMask);
             else
                 x265_log(p, X265_LOG_ERROR, "Failed to genrate CPU mask\n");
-            numa_free_cpumask(bitMask);
         }
+        numa_free_cpumask(bitMask);
     }
 #else // NUMA not supported
     cpusPerNode[0] = getCpuCount();


More information about the x265-devel mailing list