···217217218218The cpus and mems files in the root (top_cpuset) cpuset are219219read-only. The cpus file automatically tracks the value of220220-cpu_online_map using a CPU hotplug notifier, and the mems file220220+cpu_online_mask using a CPU hotplug notifier, and the mems file221221automatically tracks the value of node_states[N_HIGH_MEMORY]--i.e.,222222nodes with memory--using the cpuset_track_online_nodes() hook.223223
+11-11
Documentation/cpu-hotplug.txt
···4747 other cpus later online, read FAQ's for more info.48484949additional_cpus=n (*) Use this to limit hotpluggable cpus. This option sets5050- cpu_possible_map = cpu_present_map + additional_cpus5050+ cpu_possible_mask = cpu_present_mask + additional_cpus51515252cede_offline={"off","on"} Use this option to disable/enable putting offlined5353 processors to an extended H_CEDE state on···6464on the apicid values in those tables for disabled apics. In the event6565BIOS doesn't mark such hot-pluggable cpus as disabled entries, one could6666use this parameter "additional_cpus=x" to represent those cpus in the6767-cpu_possible_map.6767+cpu_possible_mask.68686969possible_cpus=n [s390,x86_64] use this to set hotpluggable cpus.7070 This option sets possible_cpus bits in7171- cpu_possible_map. Thus keeping the numbers of bits set7171+ cpu_possible_mask. Thus keeping the numbers of bits set7272 constant even if the machine gets rebooted.73737474CPU maps and such···7676[More on cpumaps and primitive to manipulate, please check7777include/linux/cpumask.h that has more descriptive text.]78787979-cpu_possible_map: Bitmap of possible CPUs that can ever be available in the7979+cpu_possible_mask: Bitmap of possible CPUs that can ever be available in the8080system. This is used to allocate some boot time memory for per_cpu variables8181that aren't designed to grow/shrink as CPUs are made available or removed.8282Once set during boot time discovery phase, the map is static, i.e no bits···8484upfront can save some boot time memory. See below for how we use heuristics8585in x86_64 case to keep this under check.86868787-cpu_online_map: Bitmap of all CPUs currently online. Its set in __cpu_up()8787+cpu_online_mask: Bitmap of all CPUs currently online. Its set in __cpu_up()8888after a cpu is available for kernel scheduling and ready to receive8989interrupts from devices. Its cleared when a cpu is brought down using9090__cpu_disable(), before which all OS services including interrupts are9191migrated to another target CPU.92929393-cpu_present_map: Bitmap of CPUs currently present in the system. Not all9393+cpu_present_mask: Bitmap of CPUs currently present in the system. Not all9494of them may be online. When physical hotplug is processed by the relevant9595subsystem (e.g ACPI) can change and new bit either be added or removed9696from the map depending on the event is hot-add/hot-remove. There are currently···9999100100You really dont need to manipulate any of the system cpu maps. They should101101be read-only for most use. When setting up per-cpu resources almost always use102102-cpu_possible_map/for_each_possible_cpu() to iterate.102102+cpu_possible_mask/for_each_possible_cpu() to iterate.103103104104Never use anything other than cpumask_t to represent bitmap of CPUs.105105106106 #include <linux/cpumask.h>107107108108- for_each_possible_cpu - Iterate over cpu_possible_map109109- for_each_online_cpu - Iterate over cpu_online_map110110- for_each_present_cpu - Iterate over cpu_present_map108108+ for_each_possible_cpu - Iterate over cpu_possible_mask109109+ for_each_online_cpu - Iterate over cpu_online_mask110110+ for_each_present_cpu - Iterate over cpu_present_mask111111 for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask.112112113113 #include <linux/cpu.h>114114 get_online_cpus() and put_online_cpus():115115116116The above calls are used to inhibit cpu hotplug operations. While the117117-cpu_hotplug.refcount is non zero, the cpu_online_map will not change.117117+cpu_hotplug.refcount is non zero, the cpu_online_mask will not change.118118If you merely need to avoid cpus going away, you could also use119119preempt_disable() and preempt_enable() for those sections.120120Just remember the critical section cannot call any
···839839early_param("additional_cpus", setup_additional_cpus);840840841841/*842842- * cpu_possible_map should be static, it cannot change as CPUs842842+ * cpu_possible_mask should be static, it cannot change as CPUs843843 * are onlined, or offlined. The reason is per-cpu data-structures844844 * are allocated by some modules at init time, and dont expect to845845 * do this dynamically on cpu arrival/departure.
+1-1
arch/mips/cavium-octeon/smp.c
···7878}79798080/**8181- * Detect available CPUs, populate cpu_possible_map8181+ * Detect available CPUs, populate cpu_possible_mask8282 */8383static void octeon_smp_hotplug_setup(void)8484{
+1-1
arch/mips/pmc-sierra/yosemite/smp.c
···146146}147147148148/*149149- * Detect available CPUs, populate cpu_possible_map before smp_init149149+ * Detect available CPUs, populate cpu_possible_mask before smp_init150150 *151151 * We don't want to start the secondary CPU yet nor do we have a nice probing152152 * feature in PMON so we just assume presence of the secondary core.
+1-1
arch/mips/sibyte/bcm1480/smp.c
···138138139139/*140140 * Use CFE to find out how many CPUs are available, setting up141141- * cpu_possible_map and the logical/physical mappings.141141+ * cpu_possible_mask and the logical/physical mappings.142142 * XXXKW will the boot CPU ever not be physical 0?143143 *144144 * Common setup before any secondaries are started
+1-1
arch/tile/kernel/setup.c
···1100110011011101/*11021102 * cpu_cacheable_map lists all the cpus whose caches the hypervisor can11031103- * flush on our behalf. It is set to cpu_possible_map OR'ed with11031103+ * flush on our behalf. It is set to cpu_possible_mask OR'ed with11041104 * hash_for_home_map, and it is what should be passed to11051105 * hv_flush_remote() to flush all caches. Note that if there are11061106 * dedicated hypervisor driver tiles that have authorized use of their
+1-1
arch/x86/xen/enlighten.c
···967967 xen_setup_mfn_list_list();968968}969969970970-/* This is called once we have the cpu_possible_map */970970+/* This is called once we have the cpu_possible_mask */971971void xen_setup_vcpu_info_placement(void)972972{973973 int cpu;
+2-2
init/Kconfig
···14141414config INIT_ALL_POSSIBLE14151415 bool14161416 help14171417- Back when each arch used to define their own cpu_online_map and14181418- cpu_possible_map, some of them chose to initialize cpu_possible_map14171417+ Back when each arch used to define their own cpu_online_mask and14181418+ cpu_possible_mask, some of them chose to initialize cpu_possible_mask14191419 with all 1s, and others with all 0s. When they were centralised,14201420 it was better to provide this option than to break all the archs14211421 and have several arch maintainers pursuing me down dark alleys.
+5-5
kernel/cpuset.c
···270270 * are online. If none are online, walk up the cpuset hierarchy271271 * until we find one that does have some online cpus. If we get272272 * all the way to the top and still haven't found any online cpus,273273- * return cpu_online_map. Or if passed a NULL cs from an exit'ing274274- * task, return cpu_online_map.273273+ * return cpu_online_mask. Or if passed a NULL cs from an exit'ing274274+ * task, return cpu_online_mask.275275 *276276 * One way or another, we guarantee to return some non-empty subset277277- * of cpu_online_map.277277+ * of cpu_online_mask.278278 *279279 * Call with callback_mutex held.280280 */···867867 int retval;868868 int is_load_balanced;869869870870- /* top_cpuset.cpus_allowed tracks cpu_online_map; it's read-only */870870+ /* top_cpuset.cpus_allowed tracks cpu_online_mask; it's read-only */871871 if (cs == &top_cpuset)872872 return -EACCES;873873···21492149 *21502150 * Description: Returns the cpumask_var_t cpus_allowed of the cpuset21512151 * attached to the specified @tsk. Guaranteed to return some non-empty21522152- * subset of cpu_online_map, even if this means going outside the21522152+ * subset of cpu_online_mask, even if this means going outside the21532153 * tasks cpuset.21542154 **/21552155