Re: [PATCH 3/4] 2.6.2-rc2-mm2 CPU Hotplug: The Core

Ingo Molnar
2004-02-02T09:13:22Z

On Sun, 1 Feb 2004, Rusty Russell wrote:

> D: - kernel/sched.c: Add wake_idle_cpu() for i386 hotplug.
> D:
> D: Check everywhere to make sure we never move tasks onto an
> D: offline cpu: we'll just be fighting migrate_all_tasks().
> D:
> D: Change sched_migrate_task() to migrate_to_cpu and expose it
> D: for hotplug cpu.
> D:
> D: Take hotplug lock in sys_sched_setaffinity.
> D:
> D: Return cpus_allowed masked by cpu_possible_map, not
> D: cpu_online_map in sys_sched_getaffinity, otherwise tasks can't
> D: know about whether they can run on currently-offline cpus.
> D:
> D: Implement migrate_all_tasks() to push tasks off the dying cpu.
> D:
> D: Add callbacks to stop migration thread.

the sched.c bits look good. A question: why is the migrate_all_tasks()
code nonatomic? If you run this code in the context of the migration
thread of the downed CPU then all of the migration can be done in one big
atomic locked section which holds all runqueue locks and just moves all
tasks off the current CPU. If it were done this way then eg. the
__migrate_task() race-avoidance check (cpu_is_offline()) could go away and
the whole thing would be more robust i believe.

Ingo