diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2019-07-22 21:47:24 +0300 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2019-07-25 16:47:37 +0300 |
commit | b9fa6442f7043e2cdd247905d4f3b80f2e9605cb (patch) | |
tree | 94f8a7ccb98e93e675a71730da84c8a77cf9389d /include/linux/cpumask.h | |
parent | e797bda3fd29137f6c151dfa10ea6a61c17895ce (diff) | |
download | linux-b9fa6442f7043e2cdd247905d4f3b80f2e9605cb.tar.xz |
cpumask: Implement cpumask_or_equal()
The IPI code of x86 needs to evaluate whether the target cpumask is equal
to the cpu_online_mask or equal except for the calling CPU.
To replace the current implementation which requires the usage of a
temporary cpumask, which might involve allocations, add a new function
which compares a cpumask to the result of two other cpumasks which are
or'ed together before comparison.
This allows to make the required decision in one go and the calling code
then can check for the calling CPU being set in the target mask with
cpumask_test_cpu().
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20190722105220.585449120@linutronix.de
Diffstat (limited to 'include/linux/cpumask.h')
-rw-r--r-- | include/linux/cpumask.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 693124900f0a..0c7db5efe66c 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -476,6 +476,20 @@ static inline bool cpumask_equal(const struct cpumask *src1p, } /** + * cpumask_or_equal - *src1p | *src2p == *src3p + * @src1p: the first input + * @src2p: the second input + * @src3p: the third input + */ +static inline bool cpumask_or_equal(const struct cpumask *src1p, + const struct cpumask *src2p, + const struct cpumask *src3p) +{ + return bitmap_or_equal(cpumask_bits(src1p), cpumask_bits(src2p), + cpumask_bits(src3p), nr_cpumask_bits); +} + +/** * cpumask_intersects - (*src1p & *src2p) != 0 * @src1p: the first input * @src2p: the second input |