smp_rendezvous_cpus() vs sched_bind()

Andriy Gapon avg at freebsd.org
Tue Nov 23 06:16:40 UTC 2010


If I need to call a function func on a specific CPU which one of the following I
should use?

1.
smp_rendezvous_cpus(1 << cpuid, ..., func, ...);

2.
sched_bind(cpuid);
func();
sched_unbind();

Or does it depend on some additional factors?
What are the main differences here?

And also by extension.
If I need to execute func() on all CPUs - which one is better again -
smp_rendezvous_cpus() or CPU_FOREACH+sched_bind?

Thanks a lot!
-- 
Andriy Gapon


More information about the freebsd-hackers mailing list