cpuset: enable onlined cpu/node in effective masks
authorLi Zefan <lizefan@huawei.com>
Wed, 9 Jul 2014 08:49:04 +0000 (16:49 +0800)
committerTejun Heo <tj@kernel.org>
Wed, 9 Jul 2014 19:56:17 +0000 (15:56 -0400)
commitbe4c9dd7aee5ecf3e748da68c27b38bdca70d444
tree0db06f07a41e43275123f29771580d00872ce372
parent390a36aadf39e241c83035469aae48ed1a144088
cpuset: enable onlined cpu/node in effective masks

Firstly offline cpu1:

  # echo 0-1 > cpuset.cpus
  # echo 0 > /sys/devices/system/cpu/cpu1/online
  # cat cpuset.cpus
  0-1
  # cat cpuset.effective_cpus
  0

Then online it:

  # echo 1 > /sys/devices/system/cpu/cpu1/online
  # cat cpuset.cpus
  0-1
  # cat cpuset.effective_cpus
  0-1

And cpuset will bring it back to the effective mask.

The implementation is quite straightforward. Instead of calculating the
offlined cpus/mems and do updates, we just set the new effective_mask
to online_mask & congifured_mask.

This is a behavior change for default hierarchy, so legacy hierarchy
won't be affected.

v2:
- make refactoring of cpuset_hotplug_update_tasks() as seperate patch,
  suggested by Tejun.
- make hotplug_update_tasks_insane() use @new_cpus and @new_mems as
  hotplug_update_tasks_sane() does.

Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cpuset.c