[RFC] numactl doesn't work as expected with --phycpubind III

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

 



This is another related patch, submitted by Anton Blanchard,

============================================================
Problem Statement:
	numactl is failing to bind to cpus >= 64.
executing numactl shows
# numactl --physcpubind=64 /bin/true
	sched_setaffinity: Invalid argument

============================================================
configuration:
   Any machine with more than 64 threads
   numactl version 0.9.6
============================================================
Problem AnalysisL
strace shows the problem:
sched_setaffinity(0, 8,  { 0, 0 })      = -1 EINVAL (Invalid argument)
The second argument is the size of the bitmask, and numactl has it set at 8 bytes which is only good enough for 64bits.

cpumask was returning cpubufsize, the size in bytes of a cpumask that can cover all cpus. It should be returning the number of cpus.
	This fixes a fail with numactl --physcpubind for cpus >= 64.
============================================================

I am attaching the fix, please review and let me know your thoughts and suggestions

Thanks
Yeehaw
--- util.c~	2008-04-13 00:54:21.000000000 -0500
+++ util.c	2008-04-13 00:55:07.000000000 -0500
@@ -110,7 +110,7 @@ unsigned long *cpumask(char *s, int *ncp
 				set_bit(i, cpubuf);
 		}
 	} 
-	*ncpus = cpubufsize;
+	*ncpus = cpubufsize * 8;
 	return cpubuf;	
 }
 


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]     [Devices]

  Powered by Linux