- Subject: find the node that a cpu belongs to
- From: Kornilios Kourtis <kkourt@xxxxxxxxxxxxxxxxx>
- Date: Tue, 17 Mar 2009 03:09:10 +0200
- User-agent: Mutt/1.5.18 (2008-05-17)
Hi,
I was wondering if you would be interested in adding a libnuma function
for determing the node that a cpu belongs to.
Something like this maybe ?
I could write a more complete patch if needed
(libnuma.h,version.ldscript,numa.3 ?)
--- libnuma.c.2 2009-03-16 23:32:52.000000000 +0000
+++ libnuma.c 2009-03-17 00:28:21.000000000 +0000
@@ -1784,3 +1784,34 @@ err:
numa_bitmask_free(mask);
return NULL;
}
+
+int numa_node_from_cpu_v2(int cpu)
+{
+ struct bitmask *bmp;
+ int ncpus, nnodes, node, ret;
+
+ ncpus = numa_num_possible_cpus();
+ if (cpu > ncpus){
+ errno = ERANGE;
+ return -1;
+ }
+
+ bmp = numa_bitmask_alloc(ncpus);
+ nnodes = numa_num_configured_nodes();
+ for (node = 0; node < nnodes; node++){
+ numa_node_to_cpus_v2(node, bmp);
+ if (numa_bitmask_isbitset(bmp, cpu)){
+ ret = node;
+ goto end;
+ }
+ }
+
+ /* I don't think this is supposed to happen */
+ ret = -1;
+ errno = EINVAL;
+end:
+ numa_bitmask_free(bmp);
+ return ret;
+}
+__asm__(".symver numa_node_from_cpu_v2,numa_node_from_cpu@@libnuma_1.2");
--
Kornilios Kourtis
--
To unsubscribe from this list: send the line "unsubscribe linux-numa" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Home]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]
[Devices]