Skip to content
  • Max Krasnyansky's avatar
    cpu hotplug, sched: Introduce cpu_active_map and redo sched domain managment (take 2) · e761b772
    Max Krasnyansky authored
    
    
    This is based on Linus' idea of creating cpu_active_map that prevents
    scheduler load balancer from migrating tasks to the cpu that is going
    down.
    
    It allows us to simplify domain management code and avoid unecessary
    domain rebuilds during cpu hotplug event handling.
    
    Please ignore the cpusets part for now. It needs some more work in order
    to avoid crazy lock nesting. Although I did simplfy and unify domain
    reinitialization logic. We now simply call partition_sched_domains() in
    all the cases. This means that we're using exact same code paths as in
    cpusets case and hence the test below cover cpusets too.
    Cpuset changes to make rebuild_sched_domains() callable from various
    contexts are in the separate patch (right next after this one).
    
    This not only boots but also easily handles
    	while true; do make clean; make -j 8; done
    and
    	while true; do on-off-cpu 1; done
    at the same time.
    (on-off-cpu 1 simple does echo 0/1 > /sys/.../cpu1/online thing).
    
    Suprisingly the box (dual-core Core2) is quite usable. In fact I'm typing
    this on right now in gnome-terminal and things are moving just fine.
    
    Also this is running with most of the debug features enabled (lockdep,
    mutex, etc) no BUG_ONs or lockdep complaints so far.
    
    I believe I addressed all of the Dmitry's comments for original Linus'
    version. I changed both fair and rt balancer to mask out non-active cpus.
    And replaced cpu_is_offline() with !cpu_active() in the main scheduler
    code where it made sense (to me).
    
    Signed-off-by: default avatarMax Krasnyanskiy <maxk@qualcomm.com>
    Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
    Acked-by: default avatarGregory Haskins <ghaskins@novell.com>
    Cc: dmitry.adamushko@gmail.com
    Cc: pj@sgi.com
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    e761b772