Re: [patch] sched_[set|get]_affinity() syscall, 2.4.15-pre9

Robert Love
2001-11-27T21:01:48Z

On Tue, 2001-11-27 at 02:32, Andi Kleen wrote:
> Could you quickly explain an use case where it makes a difference if
> CPU affinity settings for multiple processes are done atomically or not ?
>
> The only way to make CPU affinity settings of processes really atomically
> without a "consolidation window" is to
> do them before the process starts up. This is easy when they're inherited --
> just set them for the parent before starting the other processes. This
> works with any interface; proc based or not as long as it inherits.

I assume he meant to prevent the case of setting affinity _after_ a
process forks. In other words, "atomically" in the sense that it occurs
prior to some action, in order to affect properly all children.

This could be done in program with by writing to the proc entry before
forking, or can be done in a wrapper script (set affinity of self, exec
new task).

cpus_allowed is inherited by all children so this works fine.

Robert Love