Merge tag 'bitmap-for-6.17' of https://github.com/norov/linux
Pull bitmap updates from Yury Norov: - find_random_bit() series (Yury) - GENMASK() consolidation (Vincent) - random cleanups (Shaopeng, Ben, Yury) * tag 'bitmap-for-6.17' of https://github.com/norov/linux: bitfield: Ensure the return values of helper functions are checked test_bits: add tests for __GENMASK() and __GENMASK_ULL() bits: unify the non-asm GENMASK*() bits: split the definition of the asm and non-asm GENMASK*() cpumask: Remove unnecessary cpumask_nth_andnot() watchdog: fix opencoded cpumask_next_wrap() in watchdog_next_cpu() clocksource: Improve randomness in clocksource_verify_choose_cpus() cpumask: introduce cpumask_random() bitmap: generalize node_random()
This commit is contained in:
@@ -340,10 +340,7 @@ static void clocksource_verify_choose_cpus(void)
|
||||
* CPUs that are currently online.
|
||||
*/
|
||||
for (i = 1; i < n; i++) {
|
||||
cpu = get_random_u32_below(nr_cpu_ids);
|
||||
cpu = cpumask_next(cpu - 1, cpu_online_mask);
|
||||
if (cpu >= nr_cpu_ids)
|
||||
cpu = cpumask_first(cpu_online_mask);
|
||||
cpu = cpumask_random(cpu_online_mask);
|
||||
if (!WARN_ON_ONCE(cpu >= nr_cpu_ids))
|
||||
cpumask_set_cpu(cpu, &cpus_chosen);
|
||||
}
|
||||
|
||||
@@ -12,10 +12,7 @@ static unsigned int watchdog_next_cpu(unsigned int cpu)
|
||||
{
|
||||
unsigned int next_cpu;
|
||||
|
||||
next_cpu = cpumask_next(cpu, &watchdog_cpus);
|
||||
if (next_cpu >= nr_cpu_ids)
|
||||
next_cpu = cpumask_first(&watchdog_cpus);
|
||||
|
||||
next_cpu = cpumask_next_wrap(cpu, &watchdog_cpus);
|
||||
if (next_cpu == cpu)
|
||||
return nr_cpu_ids;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user