• Tejun Heo's avatar
    cpuset: break kernfs active protection in cpuset_write_resmask() · 76bb5ab8
    Tejun Heo authored
    Writing to either "cpuset.cpus" or "cpuset.mems" file flushes
    cpuset_hotplug_work so that cpu or memory hotunplug doesn't end up
    migrating tasks off a cpuset after new resources are added to it.
    
    As cpuset_hotplug_work calls into cgroup core via
    cgroup_transfer_tasks(), this flushing adds the dependency to cgroup
    core locking from cpuset_write_resmak().  This used to be okay because
    cgroup interface files were protected by a different mutex; however,
    8353da1f ("cgroup: remove cgroup_tree_mutex") simplified the
    cgroup core locking and this dependency became a deadlock hazard -
    cgroup file removal performed under cgroup core lock tries to drain
    on-going file operation which is trying to flush cpuset_hotplug_work
    blocked on the same cgroup core lock.
    
    The locking simplification was done because kernfs added an a lot
    easier way to deal with circular dependencies involving kernfs active
    protection.  Let's use the same strategy in cpuset and b...
    76bb5ab8
cpuset.c 75 KB