[lkml]   [2002]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: set_cpus_allowed() optimization
n Fri, 2002-05-10 at 13:09, Mike Kravetz wrote: 
> Please consider the following optimization to set_cpus_allowed().
> In the case where the task does not reside on a runqueue, is it
> not safe/sufficient to simply set the task's cpu field? This
> would avoid scheduling the migration thread to perform the task.
> Previously, set_cpus_allowed() was always called for a task that
> resides on a runqueue. With the introduction of the 'cpu affinity'
> system calls, this is no longer the case.

I like! I agree, if the task is not runnable then it should be
sufficient to just set task->cpu as when it is activated it will be put
into the runqueue based on ->cpu.

There was a chance even without the CPU affinity runqueues a process
would dequeue before set_cpus_allowed returned. Look at the case in
migration_thread where exactly what your patch does is done. If !array,
then the code just sets task->cpu and returns.

Ingo? Good?

Robert Love

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:26    [W:0.025 / U:5.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site