Skip to content
  • Tejun Heo's avatar
    cpuset: pin down cpus and mems while a task is being attached · 452477fa
    Tejun Heo authored
    
    
    cpuset is scheduled to be decoupled from cgroup_lock which will make
    configuration updates race with task migration.  Any config update
    will be allowed to happen between ->can_attach() and ->attach().  If
    such config update removes either all cpus or mems, by the time
    ->attach() is called, the condition verified by ->can_attach(), that
    the cpuset is capable of hosting the tasks, is no longer true.
    
    This patch adds cpuset->attach_in_progress which is incremented from
    ->can_attach() and decremented when the attach operation finishes
    either successfully or not.  validate_change() treats cpusets w/
    non-zero ->attach_in_progress like cpusets w/ tasks and refuses to
    remove all cpus or mems from it.
    
    This currently doesn't make any functional difference as everything is
    protected by cgroup_mutex but enables decoupling the locking.
    
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Acked-by: default avatarLi Zefan <lizefan@huawei.com>
    452477fa