The issue is CPU_SETSIZE ( in glibc ) is 1024 for may distros, however a linux machine will run with 4096 cpus.
The issue is nicely contained to oprofile/daemon/opd_perfmon.c: set_affinity
The standard way of solving this is with dynamic cpu sets and using the CPU_*_S macros.
Something like
#ifdef _SC_NPROCESSORS_CONF int nr_cpus = sysconf(_SC_NPROCESSORS_CONF); cpu_set_t * set = CPU_ALLOC(nr_cpus); int size = CPU_ALLOC_SIZE(nr_cpus); int err; CPU_ZERO_S(size, &set); CPU_SET_S(size, cpu, &set); err = sched_setaffinity(getpid(), size, &set); if (err == -1) { perror("Failed to set affinity"); exit(EXIT_FAILURE); } CPU_FREE(set);
#else
...
#endif
The suggested code change above looks OK (I think), but I have no easy way of testing it. I presume you do. Please put together a proper patch following the guidelines laid out in http://oprofile.sourceforge.net/contribute/ and attach it to this bug. And please include any observable symptoms you see when operating without the patch, including the system information used for testing. Thanks!
All the code in daemon directory was removed by commit 0c142c3a096d3e9ec42cc9b0ddad994fea60d135
The code in libpe_utils/op_pe_utils.cpp, libperf_events/operf_counter.cpp, and pe_counting/ocount_counter.cpp do use the sysconf(_SC_NPROCESSORS_CONF) to get the number of processors.