Setting CPU affinity to process( Freebsd smp kernel)

Kunze, Aaron aaron.kunze at intel.com
Fri Feb 23 16:36:21 UTC 2007


Thanks for the info.  The Linux equivalent would be sched_setaffinity
which takes a bitmask as input, allowing the user to define which
processors will run a particular thread.  Here's a link:

http://ibm5.ma.utexas.edu/cgi-bin/man-cgi?sched_setaffinity+2

> > There's a potential for 
> > conflict between the kernel's use of pinning and binding for kernel 
> > synchronization and the user space affinity model, which will be 

Can you elaborate on this?  Some of my colleagues and I are considering
tackling this and would like to avoid such pitfalls, if possible.

Aaron

--------------------------
Aaron Kunze
Advanced Visual Computing
aaron.kunze at intel.com
--PGP Key ID: 0x81124B7C--
--NOT SPEAKING FOR INTEL--
-------GO BOILERS!!-------


 

> -----Original Message-----
> From: Daniel Eischen [mailto:deischen at freebsd.org] 
> Sent: Friday, February 23, 2007 8:09 AM
> To: Robert Watson
> Cc: Kunze, Aaron; atmblr at gmail.com; freebsd-smp at freebsd.org
> Subject: Re: Setting CPU affinity to process( Freebsd smp kernel)
> 
> On Fri, 23 Feb 2007, Robert Watson wrote:
> 
> > On Wed, 21 Feb 2007, Kunze, Aaron wrote:
> >
> >> Does anyone know if this will change any time soon?  For 
> example, is 
> >> anyone working on exposing affinity to user-space applications via 
> >> extensions of the pthreads interface?
> >> 
> >> Sorry to reply to such an old thread...
> >
> > I know of no work along these lines currently, but it's something a 
> > lot of people would like to see happen.  There's a potential for 
> > conflict between the kernel's use of pinning and binding for kernel 
> > synchronization and the user space affinity model, which will be 
> > entirely avoided if done right. :-) For now, it's quite 
> easy to add a 
> > sysctl/syscall that allows user space to send the kernel 
> scheduler's 
> > notion of thread binding, but this isn't really the right 
> approach.  
> > As I understand it, some systems support setting CPU 
> affinity for a thread as a set of CPUs it is willing to run on ?
> 
> I know Solaris has processor_bind(2) and pset_bind(2):
> 
>    http://docs.sun.com/app/docs/doc/816-5167/6mbb2jaeu?a=expand#P
> 
> --
> DE
> 


More information about the freebsd-smp mailing list