CPU_Set_t * CPU_GetAffinity(void) { struct bitmask *cs = numa_allocate_cpumask(); int res = numa_sched_getaffinity(0, cs); if (res < 0) epanic("numa_sched_getaffinity"); return cs; }
void show_physcpubind(void) { int ncpus = numa_num_configured_cpus(); for (;;) { struct bitmask *cpubuf; cpubuf = numa_bitmask_alloc(ncpus); if (numa_sched_getaffinity(0, cpubuf) < 0) { if (errno == EINVAL && ncpus < 1024*1024) { ncpus *= 2; continue; } err("sched_get_affinity"); } printcpumask("physcpubind", cpubuf); break; } }