Nick Piggin wrote: > > > Rusty Russell wrote: > >> >> A few things need work: >> >> 1) There's a race between sys_sched_setaffinity() and >> sched_migrate_task() (this is nothing to do with your patch). >> > > Yep. They should both take the task's runqueue lock. Easier said than done... anyway, how does this patch look? It should also cure a possible and not entirely unlikely use after free of the task_struct in sched_migrate_task on NUMA AFAIKS. Patch is on top of a few other changes so might not apply, just for review. I'll release a new rollup with this included soon. > > >> >> 2) Please change those #defines into an enum for idle (patch follows, >> untested but trivial) >> > > Thanks, I'll take the patch. done > >> >> 3) conditional locking in load_balance is v. bad idea. >> > > Yeah... I'm thinking about this. I don't think it should be too hard > to break out the shared portion. done > > >> >> 4) load_balance returns "(!failed && !balanced)", but callers stop >> calling it when it returns true. Why not simply return "balanced", >> or at least "balanced && !failed"? >> >> > > No, the idle balancer stops calling it when it returns true, the periodic > balancer sets idle to 0 when it returns true. > > !balanced && !failed means it has moved a task. > > I'll either comment that, or return it in a more direct way. > done