• Andrew Morton's avatar
    [PATCH] Revisited: ia64-cpu-hotplug-cpu_present.patch · fda94eff
    Andrew Morton authored
    From: Paul Jackson <pj@sgi.com>
    
    With a hotplug capable kernel, there is a requirement to distinguish a
    possible CPU from one actually present.  The set of possible CPU numbers
    doesn't change during a single system boot, but the set of present CPUs
    changes as CPUs are physically inserted into or removed from a system.  The
    cpu_possible_map does not change once initialized at boot, but the
    cpu_present_map changes dynamically as CPUs are inserted or removed.
    
    
    Paul Jackson <pj@sgi.com> provided an expanded explanation:
    
    
    Ashok's cpu hot plug patch adds a cpu_present_map, resulting in the following
    cpu maps being available.  All the following maps are fixed size bitmaps of
    size NR_CPUS.
    
    #ifdef CONFIG_HOTPLUG_CPU
    	cpu_possible_map - map with all NR_CPUS bits set
    	cpu_present_map - map with bit 'cpu' set iff cpu is populated
    	cpu_online_map - map with bit 'cpu' set iff cpu available to scheduler
    #else
    	cpu_possible_map - map with bit 'cpu' set iff cpu is populated
    	cpu_present_map - copy of cpu_possible_map
    	cpu_online_map - map with bit 'cpu' set iff cpu available to scheduler
    #endif
    
    In either case, NR_CPUS is fixed at compile time, as the static size of these
    bitmaps.  The cpu_possible_map is fixed at boot time, as the set of CPU id's
    that it is possible might ever be plugged in at anytime during the life of
    that system boot.  The cpu_present_map is dynamic(*), representing which CPUs
    are currently plugged in.  And cpu_online_map is the dynamic subset of
    cpu_present_map, indicating those CPUs available for scheduling.
    
    If HOTPLUG is enabled, then cpu_possible_map is forced to have all NR_CPUS
    bits set, otherwise it is just the set of CPUs that ACPI reports present at
    boot.
    
    If HOTPLUG is enabled, then cpu_present_map varies dynamically, depending on
    what ACPI reports as currently plugged in, otherwise cpu_present_map is just a
    copy of cpu_possible_map.
    
    (*) Well, cpu_present_map is dynamic in the hotplug case.  If not hotplug,
        it's the same as cpu_possible_map, hence fixed at boot.
    fda94eff
smp.h 2.76 KB