Re: [PATCH 04/40] sched: implement __set_cpus_allowed()

Tejun Heo
2010-01-24T08:14:39Z

Hello,

On 01/20/2010 05:35 PM, Tejun Heo wrote:
> Wouldn't it make more sense to share the backend implementation
> between kthread_bind() and set_cpus_allowed_ptr() instead of making
> kthread_bind() a special case? The goals of the two functions are
> basically identical. Why have two separate implementations?
> kthread_bind() implementation as it currently stands is pretty fragile
> too. Making kthread_bind() backed by set_cpus_allowed_ptr() will make
> it more robust and less error-prone and all that's necessary to
> achieve that is modifying sanity checks.

I gave it shot. The interface is cleaner this way but I couldn't
figure out where to set PF_THREAD_BOUND as actual migration may happen
in different places and p->flags can only be set while it's known the
process is not running. At this point, I can't think of a better way
to do this than the current patch. :-(

Thanks.

--
tejun