Skip to content
Permalink
Browse files
cpumask: use find_first_and_bit()
cpumask_first_and() is an alias to cpumask_next_and(). Now we
efficient implementation for find_first_and_bit(), so switch
cpumask_first_and() to use it.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
  • Loading branch information
YuryNorov committed Jun 10, 2021
1 parent ccb220a commit 50128e2f5132bd1f35ecb626628a6ea1cdeb8779
Showing 1 changed file with 11 additions and 1 deletion.
@@ -123,6 +123,12 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp)
return 0;
}

static inline unsigned int cpumask_first_and(const struct cpumask *srcp1,
const struct cpumask *srcp2)
{
return 0;
}

static inline unsigned int cpumask_last(const struct cpumask *srcp)
{
return 0;
@@ -592,7 +598,11 @@ static inline void cpumask_copy(struct cpumask *dstp,
*
* Returns >= nr_cpu_ids if no cpus set in both. See also cpumask_next_and().
*/
#define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p))
static inline
unsigned int cpumask_first_and(const struct cpumask *srcp1, const struct cpumask *srcp2)
{
return find_first_and_bit(cpumask_bits(srcp1), cpumask_bits(srcp2), nr_cpumask_bits);
}

/**
* cpumask_any_and - pick a "random" cpu from *mask1 & *mask2

0 comments on commit 50128e2

Please sign in to comment.