X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=Documentation%2Fcpu-hotplug.txt;fp=Documentation%2Fcpu-hotplug.txt;h=57a09f99ecb08977d51d883ee5d6caecbc0967ba;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=bc107cb157a8bba060ce65bb9ded734bfbdd15a8;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt index bc107cb15..57a09f99e 100644 --- a/Documentation/cpu-hotplug.txt +++ b/Documentation/cpu-hotplug.txt @@ -97,13 +97,13 @@ at which time hotplug is disabled. You really dont need to manipulate any of the system cpu maps. They should be read-only for most use. When setting up per-cpu resources almost always use -cpu_possible_map/for_each_possible_cpu() to iterate. +cpu_possible_map/for_each_cpu() to iterate. Never use anything other than cpumask_t to represent bitmap of CPUs. #include -for_each_possible_cpu - Iterate over cpu_possible_map +for_each_cpu - Iterate over cpu_possible_map for_each_online_cpu - Iterate over cpu_online_map for_each_present_cpu - Iterate over cpu_present_map for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask. @@ -251,24 +251,16 @@ A: This is what you would need in your kernel code to receive notifications. return NOTIFY_OK; } - static struct notifier_block __cpuinitdata foobar_cpu_notifer = + static struct notifier_block foobar_cpu_notifer = { .notifier_call = foobar_cpu_callback, }; -You need to call register_cpu_notifier() from your init function. -Init functions could be of two types: -1. early init (init function called when only the boot processor is online). -2. late init (init function called _after_ all the CPUs are online). -For the first case, you should add the following to your init function +In your init function, register_cpu_notifier(&foobar_cpu_notifier); -For the second case, you should add the following to your init function - - register_hotcpu_notifier(&foobar_cpu_notifier); - You can fail PREPARE notifiers if something doesn't work to prepare resources. This will stop the activity and send a following CANCELED event back.