* export numa_init
@ 2013-10-12 10:31 Daniel Kozak
2013-10-13 1:12 ` Andi Kleen
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Kozak @ 2013-10-12 10:31 UTC (permalink / raw)
To: linux-numa
Hello,
when I compile latest libnuma.so, the numa_init symbol is not exported.
So it is not possible to linked against this lib with code which called
numa_init directly from code. One of affected program is HipHop Virtual
Machine (HHVM)
https://github.com/facebook/hiphop-php/blob/master/hphp/util/alloc.cpp#L135
So it is possible to add numa_init into global section in
versions.ldscript?
With kind regards
Daniel Kozak
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: export numa_init
2013-10-12 10:31 export numa_init Daniel Kozak
@ 2013-10-13 1:12 ` Andi Kleen
0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2013-10-13 1:12 UTC (permalink / raw)
To: Daniel Kozak; +Cc: linux-numa
On Sat, Oct 12, 2013 at 12:31:18PM +0200, Daniel Kozak wrote:
> Hello,
>
> when I compile latest libnuma.so, the numa_init symbol is not exported.
> So it is not possible to linked against this lib with code which called
> numa_init directly from code. One of affected program is HipHop Virtual
> Machine (HHVM)
> https://github.com/facebook/hiphop-php/blob/master/hphp/util/alloc.cpp#L135
>
> So it is possible to add numa_init into global section in
> versions.ldscript?
Ah makes sense:
// numa_init is called automatically, but is probably called after
// JEMallocInitializer(). its idempotent, so call it here.
numa_init();
When libnuma code is called from a constructor then the function
may need to be called explicitely to avoid ordering problems.
So yes exporting this is ok I guess.
This is also interesting. I'm surprised this doesn't work
(maybe for an old version?)
/*
* libnuma is only partially aware of taskset. If on entry,
* you have completely disabled a node via taskset, the node
* will not be available, and calling numa_run_on_node will
* not work for that node. But if only some of the cpu's on a
* node were disabled, then calling numa_run_on_node will enable
* them all. To prevent this, compute the actual masks up front
*/
bitmask* enabled = numa_allocate_cpumask();
if (numa_sched_getaffinity(0, enabled) < 0) {
return;
}
node_to_cpu_mask = new std::vector<bitmask*>;
int num_cpus = numa_num_configured_cpus();
int max_node = numa_max_node();
for (int i = 0; i <= max_node; i++) {
bitmask* cpus_for_node = numa_allocate_cpumask();
numa_node_to_cpus(i, cpus_for_node);
for (int j = 0; j < num_cpus; j++) {
if (!numa_bitmask_isbitset(enabled, j)) {
numa_bitmask_clearbit(cpus_for_node, j);
}
}
assert(node_to_cpu_mask->size() == i);
node_to_cpu_mask->push_back(cpus_for_node);
}
numa_bitmask_free(enabled);
-andi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-13 1:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-12 10:31 export numa_init Daniel Kozak
2013-10-13 1:12 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).