linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] cpumask: Remove unnecessary cpumask_nth_andnot()
@ 2025-06-23  7:46 Shaopeng Tan
  2025-06-23 16:18 ` Yury Norov
  0 siblings, 1 reply; 2+ messages in thread
From: Shaopeng Tan @ 2025-06-23  7:46 UTC (permalink / raw)
  To: linux-kernel, Yury Norov, Rasmus Villemoes
  Cc: Reinette Chatre, James Morse, Dave Martin, fenghuay

Commit 94f753143028("x86/resctrl: Optimize cpumask_any_housekeeping()")
switched the only user of cpumask_nth_andnot() to other cpumask
functions, but left the function cpumask_nth_andnot() unused.
This makes function find_nth_andnot_bit() unused as well. Delete them.

Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
---
 include/linux/cpumask.h | 16 ----------------
 include/linux/find.h    | 27 ---------------------------
 2 files changed, 43 deletions(-)

diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 7ae80a7ca81e..498790f74fa8 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -546,22 +546,6 @@ unsigned int cpumask_nth_and(unsigned int cpu, const struct cpumask *srcp1,
 				small_cpumask_bits, cpumask_check(cpu));
 }
 
-/**
- * cpumask_nth_andnot - get the Nth cpu set in 1st cpumask, and clear in 2nd.
- * @srcp1: the cpumask pointer
- * @srcp2: the cpumask pointer
- * @cpu: the Nth cpu to find, starting from 0
- *
- * Return: >= nr_cpu_ids if such cpu doesn't exist.
- */
-static __always_inline
-unsigned int cpumask_nth_andnot(unsigned int cpu, const struct cpumask *srcp1,
-							const struct cpumask *srcp2)
-{
-	return find_nth_andnot_bit(cpumask_bits(srcp1), cpumask_bits(srcp2),
-				small_cpumask_bits, cpumask_check(cpu));
-}
-
 /**
  * cpumask_nth_and_andnot - get the Nth cpu set in 1st and 2nd cpumask, and clear in 3rd.
  * @srcp1: the cpumask pointer
diff --git a/include/linux/find.h b/include/linux/find.h
index 5a2c267ea7f9..dc93fc35dcac 100644
--- a/include/linux/find.h
+++ b/include/linux/find.h
@@ -267,33 +267,6 @@ unsigned long find_nth_and_bit(const unsigned long *addr1, const unsigned long *
 	return __find_nth_and_bit(addr1, addr2, size, n);
 }
 
-/**
- * find_nth_andnot_bit - find N'th set bit in 2 memory regions,
- *			 flipping bits in 2nd region
- * @addr1: The 1st address to start the search at
- * @addr2: The 2nd address to start the search at
- * @size: The maximum number of bits to search
- * @n: The number of set bit, which position is needed, counting from 0
- *
- * Returns the bit number of the N'th set bit.
- * If no such, returns @size.
- */
-static __always_inline
-unsigned long find_nth_andnot_bit(const unsigned long *addr1, const unsigned long *addr2,
-				unsigned long size, unsigned long n)
-{
-	if (n >= size)
-		return size;
-
-	if (small_const_nbits(size)) {
-		unsigned long val =  *addr1 & (~*addr2) & GENMASK(size - 1, 0);
-
-		return val ? fns(val, n) : size;
-	}
-
-	return __find_nth_andnot_bit(addr1, addr2, size, n);
-}
-
 /**
  * find_nth_and_andnot_bit - find N'th set bit in 2 memory regions,
  *			     excluding those set in 3rd region
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] cpumask: Remove unnecessary cpumask_nth_andnot()
  2025-06-23  7:46 [PATCH v2] cpumask: Remove unnecessary cpumask_nth_andnot() Shaopeng Tan
@ 2025-06-23 16:18 ` Yury Norov
  0 siblings, 0 replies; 2+ messages in thread
From: Yury Norov @ 2025-06-23 16:18 UTC (permalink / raw)
  To: Shaopeng Tan
  Cc: linux-kernel, Rasmus Villemoes, Reinette Chatre, James Morse,
	Dave Martin, fenghuay

On Mon, Jun 23, 2025 at 04:46:45PM +0900, Shaopeng Tan wrote:
> Commit 94f753143028("x86/resctrl: Optimize cpumask_any_housekeeping()")
> switched the only user of cpumask_nth_andnot() to other cpumask
> functions, but left the function cpumask_nth_andnot() unused.
> This makes function find_nth_andnot_bit() unused as well. Delete them.
> 
> Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>

Applied in bitmap-for-next. Thanks!

> ---
>  include/linux/cpumask.h | 16 ----------------
>  include/linux/find.h    | 27 ---------------------------
>  2 files changed, 43 deletions(-)
> 
> diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
> index 7ae80a7ca81e..498790f74fa8 100644
> --- a/include/linux/cpumask.h
> +++ b/include/linux/cpumask.h
> @@ -546,22 +546,6 @@ unsigned int cpumask_nth_and(unsigned int cpu, const struct cpumask *srcp1,
>  				small_cpumask_bits, cpumask_check(cpu));
>  }
>  
> -/**
> - * cpumask_nth_andnot - get the Nth cpu set in 1st cpumask, and clear in 2nd.
> - * @srcp1: the cpumask pointer
> - * @srcp2: the cpumask pointer
> - * @cpu: the Nth cpu to find, starting from 0
> - *
> - * Return: >= nr_cpu_ids if such cpu doesn't exist.
> - */
> -static __always_inline
> -unsigned int cpumask_nth_andnot(unsigned int cpu, const struct cpumask *srcp1,
> -							const struct cpumask *srcp2)
> -{
> -	return find_nth_andnot_bit(cpumask_bits(srcp1), cpumask_bits(srcp2),
> -				small_cpumask_bits, cpumask_check(cpu));
> -}
> -
>  /**
>   * cpumask_nth_and_andnot - get the Nth cpu set in 1st and 2nd cpumask, and clear in 3rd.
>   * @srcp1: the cpumask pointer
> diff --git a/include/linux/find.h b/include/linux/find.h
> index 5a2c267ea7f9..dc93fc35dcac 100644
> --- a/include/linux/find.h
> +++ b/include/linux/find.h
> @@ -267,33 +267,6 @@ unsigned long find_nth_and_bit(const unsigned long *addr1, const unsigned long *
>  	return __find_nth_and_bit(addr1, addr2, size, n);
>  }
>  
> -/**
> - * find_nth_andnot_bit - find N'th set bit in 2 memory regions,
> - *			 flipping bits in 2nd region
> - * @addr1: The 1st address to start the search at
> - * @addr2: The 2nd address to start the search at
> - * @size: The maximum number of bits to search
> - * @n: The number of set bit, which position is needed, counting from 0
> - *
> - * Returns the bit number of the N'th set bit.
> - * If no such, returns @size.
> - */
> -static __always_inline
> -unsigned long find_nth_andnot_bit(const unsigned long *addr1, const unsigned long *addr2,
> -				unsigned long size, unsigned long n)
> -{
> -	if (n >= size)
> -		return size;
> -
> -	if (small_const_nbits(size)) {
> -		unsigned long val =  *addr1 & (~*addr2) & GENMASK(size - 1, 0);
> -
> -		return val ? fns(val, n) : size;
> -	}
> -
> -	return __find_nth_andnot_bit(addr1, addr2, size, n);
> -}
> -
>  /**
>   * find_nth_and_andnot_bit - find N'th set bit in 2 memory regions,
>   *			     excluding those set in 3rd region
> -- 
> 2.43.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-23 16:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-23  7:46 [PATCH v2] cpumask: Remove unnecessary cpumask_nth_andnot() Shaopeng Tan
2025-06-23 16:18 ` Yury Norov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).