Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

smpboot: Remove cpumask from the API

Now that the sole use of the whole smpboot_*cpumask() API is gone,
remove it.

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Peter Zijlstra and committed by
Ingo Molnar
167a8867 9cf57731

+6 -63
+1 -14
include/linux/smpboot.h
··· 25 25 * parked (cpu offline) 26 26 * @unpark: Optional unpark function, called when the thread is 27 27 * unparked (cpu online) 28 - * @cpumask: Internal state. To update which threads are unparked, 29 - * call smpboot_update_cpumask_percpu_thread(). 30 28 * @selfparking: Thread is not parked by the park function. 31 29 * @thread_comm: The base name of the thread 32 30 */ ··· 38 40 void (*cleanup)(unsigned int cpu, bool online); 39 41 void (*park)(unsigned int cpu); 40 42 void (*unpark)(unsigned int cpu); 41 - cpumask_var_t cpumask; 42 43 bool selfparking; 43 44 const char *thread_comm; 44 45 }; 45 46 46 - int smpboot_register_percpu_thread_cpumask(struct smp_hotplug_thread *plug_thread, 47 - const struct cpumask *cpumask); 48 - 49 - static inline int 50 - smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread) 51 - { 52 - return smpboot_register_percpu_thread_cpumask(plug_thread, 53 - cpu_possible_mask); 54 - } 47 + int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread); 55 48 56 49 void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread); 57 - void smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread, 58 - const struct cpumask *); 59 50 60 51 #endif
+5 -49
kernel/smpboot.c
··· 238 238 239 239 mutex_lock(&smpboot_threads_lock); 240 240 list_for_each_entry(cur, &hotplug_threads, list) 241 - if (cpumask_test_cpu(cpu, cur->cpumask)) 242 - smpboot_unpark_thread(cur, cpu); 241 + smpboot_unpark_thread(cur, cpu); 243 242 mutex_unlock(&smpboot_threads_lock); 244 243 return 0; 245 244 } ··· 279 280 } 280 281 281 282 /** 282 - * smpboot_register_percpu_thread_cpumask - Register a per_cpu thread related 283 + * smpboot_register_percpu_thread - Register a per_cpu thread related 283 284 * to hotplug 284 285 * @plug_thread: Hotplug thread descriptor 285 - * @cpumask: The cpumask where threads run 286 286 * 287 287 * Creates and starts the threads on all online cpus. 288 288 */ 289 - int smpboot_register_percpu_thread_cpumask(struct smp_hotplug_thread *plug_thread, 290 - const struct cpumask *cpumask) 289 + int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread) 291 290 { 292 291 unsigned int cpu; 293 292 int ret = 0; 294 - 295 - if (!alloc_cpumask_var(&plug_thread->cpumask, GFP_KERNEL)) 296 - return -ENOMEM; 297 - cpumask_copy(plug_thread->cpumask, cpumask); 298 293 299 294 get_online_cpus(); 300 295 mutex_lock(&smpboot_threads_lock); ··· 296 303 ret = __smpboot_create_thread(plug_thread, cpu); 297 304 if (ret) { 298 305 smpboot_destroy_threads(plug_thread); 299 - free_cpumask_var(plug_thread->cpumask); 300 306 goto out; 301 307 } 302 - if (cpumask_test_cpu(cpu, cpumask)) 303 - smpboot_unpark_thread(plug_thread, cpu); 308 + smpboot_unpark_thread(plug_thread, cpu); 304 309 } 305 310 list_add(&plug_thread->list, &hotplug_threads); 306 311 out: ··· 306 315 put_online_cpus(); 307 316 return ret; 308 317 } 309 - EXPORT_SYMBOL_GPL(smpboot_register_percpu_thread_cpumask); 318 + EXPORT_SYMBOL_GPL(smpboot_register_percpu_thread); 310 319 311 320 /** 312 321 * smpboot_unregister_percpu_thread - Unregister a per_cpu thread related to hotplug ··· 322 331 smpboot_destroy_threads(plug_thread); 323 332 mutex_unlock(&smpboot_threads_lock); 324 333 put_online_cpus(); 325 - free_cpumask_var(plug_thread->cpumask); 326 334 } 327 335 EXPORT_SYMBOL_GPL(smpboot_unregister_percpu_thread); 328 - 329 - /** 330 - * smpboot_update_cpumask_percpu_thread - Adjust which per_cpu hotplug threads stay parked 331 - * @plug_thread: Hotplug thread descriptor 332 - * @new: Revised mask to use 333 - * 334 - * The cpumask field in the smp_hotplug_thread must not be updated directly 335 - * by the client, but only by calling this function. 336 - * This function can only be called on a registered smp_hotplug_thread. 337 - */ 338 - void smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread, 339 - const struct cpumask *new) 340 - { 341 - struct cpumask *old = plug_thread->cpumask; 342 - static struct cpumask tmp; 343 - unsigned int cpu; 344 - 345 - lockdep_assert_cpus_held(); 346 - mutex_lock(&smpboot_threads_lock); 347 - 348 - /* Park threads that were exclusively enabled on the old mask. */ 349 - cpumask_andnot(&tmp, old, new); 350 - for_each_cpu_and(cpu, &tmp, cpu_online_mask) 351 - smpboot_park_thread(plug_thread, cpu); 352 - 353 - /* Unpark threads that are exclusively enabled on the new mask. */ 354 - cpumask_andnot(&tmp, new, old); 355 - for_each_cpu_and(cpu, &tmp, cpu_online_mask) 356 - smpboot_unpark_thread(plug_thread, cpu); 357 - 358 - cpumask_copy(old, new); 359 - 360 - mutex_unlock(&smpboot_threads_lock); 361 - } 362 336 363 337 static DEFINE_PER_CPU(atomic_t, cpu_hotplug_state) = ATOMIC_INIT(CPU_POST_DEAD); 364 338