diff options
author | Peter Zijlstra <peterz@infradead.org> | 2020-11-10 18:39:04 +0100 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2020-11-10 18:39:04 +0100 |
commit | 12fa97c64dce2f3c2e6eed5dc618bb9046e40bf0 (patch) | |
tree | ab8c2f7728b8fa678fdbca80d5e0206edf3a51bc /lib/cpumask.c | |
parent | b6d37a764a5b852db63101b3f2db0e699574b903 (diff) | |
parent | c777d847107e80df24dae87fc9cf4b4c0bf4dfed (diff) |
Merge branch 'sched/migrate-disable'
Diffstat (limited to 'lib/cpumask.c')
-rw-r--r-- | lib/cpumask.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/cpumask.c b/lib/cpumask.c index 85da6ab4fbb5..35924025097b 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -267,3 +267,21 @@ int cpumask_any_and_distribute(const struct cpumask *src1p, return next; } EXPORT_SYMBOL(cpumask_any_and_distribute); + +int cpumask_any_distribute(const struct cpumask *srcp) +{ + int next, prev; + + /* NOTE: our first selection will skip 0. */ + prev = __this_cpu_read(distribute_cpu_mask_prev); + + next = cpumask_next(prev, srcp); + if (next >= nr_cpu_ids) + next = cpumask_first(srcp); + + if (next < nr_cpu_ids) + __this_cpu_write(distribute_cpu_mask_prev, next); + + return next; +} +EXPORT_SYMBOL(cpumask_any_distribute); |