Re: processor affinity
"Nathan J. Williams" <[email protected]> 31 May 2003 13:13:39 -0400
| Newsgroups | gmane.os.netbsd.devel.smp |
|---|---|
| Organization | Wasabi Systems, Inc. |
| Message-ID | <[email protected]> |
Anil Gopinath <[email protected]> writes: > I have a dual CPU i386 box running the MP kernel. I am trying to > attach (schedule) a user process to *always* run on the same CPU. > > Any suggestions on how to do this would be greatly appreciated. There's currently no way to do this. If you wanted to experiment with developing some code to do this it, here are a couple of ideas: (1) Add a data structure to struct proc describing the desired processor affinity, syscalls to manipulate it, decide on how it is inherited, etc. (2a) Rearrange cpu_switch to examine this field when picking the next LWP to run, and to put back LWPs that don't want to run on the current processor. -or- (2b) Create per-CPU run queues in addition to the global run queue. Alter cpu_switch() (probably less than in 2a) to pick the higest priority LWP from either its run queue or the global run queue. Alter setrunqueue() to use the affinity data to choose what run queue to put LWPs on. -or- (2c) Only have per-CPU run queues. Use affinity data to pick on in setrunqueue() and round-robin otherwise. I suspect that (2b) would be the easiest to play with without disrupting everything else. - Nathan