• O
    sched: Kill the broken and deadlockable cpuset_lock/cpuset_cpus_allowed_locked code · 897f0b3c
    Oleg Nesterov 提交于
    This patch just states the fact the cpusets/cpuhotplug interaction is
    broken and removes the deadlockable code which only pretends to work.
    
    - cpuset_lock() doesn't really work. It is needed for
      cpuset_cpus_allowed_locked() but we can't take this lock in
      try_to_wake_up()->select_fallback_rq() path.
    
    - cpuset_lock() is deadlockable. Suppose that a task T bound to CPU takes
      callback_mutex. If cpu_down(CPU) happens before T drops callback_mutex
      stop_machine() preempts T, then migration_call(CPU_DEAD) tries to take
      cpuset_lock() and hangs forever because CPU is already dead and thus
      T can't be scheduled.
    
    - cpuset_cpus_allowed_locked() is deadlockable too. It takes task_lock()
      which is not irq-safe, but try_to_wake_up() can be called from irq.
    
    Kill them, and change select_fallback_rq() to use cpu_possible_mask, like
    we currently do without CONFIG_CPUSETS.
    
    Also, with or without this patch, with or without CONFIG_CPUSETS, the
    callers of select_fallback_rq() can race with each other or with
    set_cpus_allowed() pathes.
    
    The subsequent patches try to to fix these problems.
    Signed-off-by: NOleg Nesterov <oleg@redhat.com>
    Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
    LKML-Reference: <20100315091003.GA9123@redhat.com>
    Signed-off-by: NIngo Molnar <mingo@elte.hu>
    897f0b3c
cpuset.c 71.7 KB