• Andrew Morton's avatar
    [PATCH] Don't let processes be scheduled on CPU-less nodes (3/3) · 946ac12e
    Andrew Morton authored
    From: Matthew Dobson <colpatch@us.ibm.com>
    
    This patch implements a generic version of the nr_cpus_node(node) macro
    implemented for ppc64 by the previous patch.
    
    The generic version simply computes an hweight of the bitmask returned by
    node_to_cpumask(node) topology macro.
    
    This patch also adds a generic_hweight64() function and an hweight_long()
    function which are used as helpers for the generic nr_cpus_node() macro.
    
    This patch also adds a for_each_node_with_cpus() macro, which is used in
    sched_best_cpu() in kernel/sched.c to fix the original problem of
    scheduling processes on CPU-less nodes.  This macro should also be used in
    the future to avoid similar problems.
    
    Test compiled and booted by Andrew Theurer (habanero@us.ibm.com) on both
    x440 and ppc64.
    946ac12e
sched.c 62.1 KB