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

Configure Feed

Select the types of activity you want to include in your feed.

cpumask: introduce cpumask_random()

Propagate find_random_bit() to cpumask API.

CC: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: "Yury Norov [NVIDIA]" <yury.norov@gmail.com>

+12
+12
include/linux/cpumask.h
··· 355 355 } 356 356 357 357 /** 358 + * cpumask_random - get random cpu in *src. 359 + * @src: cpumask pointer 360 + * 361 + * Return: random set bit, or >= nr_cpu_ids if @src is empty. 362 + */ 363 + static __always_inline 364 + unsigned int cpumask_random(const struct cpumask *src) 365 + { 366 + return find_random_bit(cpumask_bits(src), nr_cpu_ids); 367 + } 368 + 369 + /** 358 370 * for_each_cpu - iterate over every cpu in a mask 359 371 * @cpu: the (optionally unsigned) integer iterator 360 372 * @mask: the cpumask pointer