• Tejun Heo's avatar
    memcg: don't register hotcpu notifier from ->css_alloc() · 154b454e
    Tejun Heo authored
    Commit 648bb56d ("cgroup: lock cgroup_mutex in cgroup_init_subsys()")
    made cgroup_init_subsys() grab cgroup_mutex before invoking
    ->css_alloc() for the root css.  Because memcg registers hotcpu notifier
    from ->css_alloc() for the root css, this introduced circular locking
    dependency between cgroup_mutex and cpu hotplug.
    
    Fix it by moving hotcpu notifier registration to a subsys initcall.
    
      ======================================================
      [ INFO: possible circular locking dependency detected ]
      3.7.0-rc4-work+ #42 Not tainted
      -------------------------------------------------------
      bash/645 is trying to acquire lock:
       (cgroup_mutex){+.+.+.}, at: [<ffffffff8110c5b7>] cgroup_lock+0x17/0x20
    
      but task is already holding lock:
       (cpu_hotplug.lock){+.+.+.}, at: [<ffffffff8109300f>] cpu_hotplug_begin+0x2f/0x60
    
      which lock already depends on the new lock.
    
      the existing dependency chain (in reverse order) is:
    
     -> #1 (cpu_hotplug.loc...
    154b454e
memcontrol.c 179 KB