All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage
@ 2025-01-28 16:46 Yury Norov
  2025-01-28 16:46 ` [PATCH v2 01/13] objpool: rework objpool_pop() Yury Norov
                   ` (13 more replies)
  0 siblings, 14 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, linuxppc-dev, linux-s390, netdev, virtualization,
	linux-nvme, linux-hyperv, linux-pci, linux-scsi, linux-crypto,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Haren Myneni, Rick Lindsley, Nick Child, Thomas Falcon,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
	Eugenio Pérez, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
	Dexuan Cui, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, James Smart,
	Dick Kennedy, James E.J. Bottomley, Martin K. Petersen,
	Yury Norov, Rasmus Villemoes, Matt Wu, Steffen Klassert,
	Daniel Jordan, Andrew Morton, Greg Kurz, Peter Xu,
	Shrikanth Hegde, Hendrik Brueckner

cpumask_next_wrap() is overly complicated, comparing to it's generic
version find_next_bit_wrap(), not mentioning it duplicates the above.
It roots to the times when the function was used in the implementation
of for_each_cpu_wrap() iterator. The function has 2 additional parameters
that were used to catch loop termination condition for the iterator.
(Although, only one is needed.)

Since 4fe49b3b97c262 ("lib/bitmap: introduce for_each_set_bit_wrap()
macro"), for_each_cpu_wrap() is wired to corresponding generic
wrapping bitmap iterator, and additional complexity of
cpumask_next_wrap() is not needed anymore.

All existing users call cpumask_next_wrap() in a manner that makes
it possible to turn it to a straight and simple alias to
find_next_bit_wrap().

This series replaces historical 4-parameter cpumask_next_wrap() with a
thin 2-parameter wrapper around find_next_bit_wrap().

Where it's possible to use for_each_cpu_wrap() iterator, the code is
switched to use it because it's always preferable to use iterators over
open loops.

This series touches various scattered subsystems and To-list for the
whole series is quite a long. To minimize noise, I send cover-letter and
key patches #5 and 6 to every person involved. All other patches are sent
individually to those pointed by scripts/get_maintainers.pl.

I'd like to move the series with my bitmap-for-next branch as a whole.

v1: https://lore.kernel.org/netdev/20241228184949.31582-1-yury.norov@gmail.com/T/
v2:
 - rebase on top of today's origin/master;
 - drop #v1-10: not needed since v6.14 @ Sagi Grinberg;
 - #2, #3: fix picking next unused CPU @ Nick Child;
 - fix typos, cleanup comments @ Bjorn Helgaas, Alexander Gordeev;
 - CC Christoph Hellwig for the whole series.

Yury Norov (13):
  objpool: rework objpool_pop()
  virtio_net: simplify virtnet_set_affinity()
  ibmvnic: simplify ibmvnic_set_queue_affinity()
  powerpc/xmon: simplify xmon_batch_next_cpu()
  cpumask: deprecate cpumask_next_wrap()
  cpumask: re-introduce cpumask_next{,_and}_wrap()
  cpumask: use cpumask_next_wrap() where appropriate
  padata: switch padata_find_next() to using cpumask_next_wrap()
  s390: switch stop_machine_yield() to using cpumask_next_wrap()
  scsi: lpfc: switch lpfc_irq_rebalance() to using cpumask_next_wrap()
  scsi: lpfc: rework lpfc_next_{online,present}_cpu()
  PCI: hv: Switch hv_compose_multi_msi_req_get_cpu() to using
    cpumask_next_wrap()
  cpumask: drop cpumask_next_wrap_old()

 arch/powerpc/xmon/xmon.c            |  6 +--
 arch/s390/kernel/processor.c        |  2 +-
 drivers/net/ethernet/ibm/ibmvnic.c  | 18 +++++---
 drivers/net/virtio_net.c            | 12 ++---
 drivers/pci/controller/pci-hyperv.c |  3 +-
 drivers/scsi/lpfc/lpfc.h            | 23 +++-------
 drivers/scsi/lpfc/lpfc_init.c       |  2 +-
 include/linux/cpumask.h             | 69 ++++++++++++++++++++---------
 include/linux/objpool.h             |  7 ++-
 kernel/padata.c                     |  2 +-
 lib/cpumask.c                       | 37 +---------------
 11 files changed, 81 insertions(+), 100 deletions(-)

-- 
2.43.0


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

* [PATCH v2 01/13] objpool: rework objpool_pop()
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-01-28 16:46 ` [PATCH v2 02/13] virtio_net: simplify virtnet_set_affinity() Yury Norov
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, Matt Wu; +Cc: Yury Norov, Christoph Hellwig, Rasmus Villemoes

The function has to track number of iterations to prevent an infinite
loop. for_each_cpu_wrap() macro takes care of it, which simplifies user
code.

Similarly to for_each_possible_cpu() flavor, this patch introduces
for_each_possible_cpu_wrap() version of iterator to keep usage of the
API simple and coherent.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 include/linux/cpumask.h | 6 ++++++
 include/linux/objpool.h | 7 +++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 9278a50d514f..5cf69a110c1c 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -1033,11 +1033,17 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
 #define for_each_possible_cpu(cpu)	for ((cpu) = 0; (cpu) < 1; (cpu)++)
 #define for_each_online_cpu(cpu)	for ((cpu) = 0; (cpu) < 1; (cpu)++)
 #define for_each_present_cpu(cpu)	for ((cpu) = 0; (cpu) < 1; (cpu)++)
+
+#define for_each_possible_cpu_wrap(cpu, start)	\
+	for ((void)(start), (cpu) = 0; (cpu) < 1; (cpu)++)
 #else
 #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
 #define for_each_online_cpu(cpu)   for_each_cpu((cpu), cpu_online_mask)
 #define for_each_enabled_cpu(cpu)   for_each_cpu((cpu), cpu_enabled_mask)
 #define for_each_present_cpu(cpu)  for_each_cpu((cpu), cpu_present_mask)
+
+#define for_each_possible_cpu_wrap(cpu, start)	\
+	for_each_cpu_wrap((cpu), cpu_possible_mask, (start))
 #endif
 
 /* Wrappers for arch boot code to manipulate normally-constant masks */
diff --git a/include/linux/objpool.h b/include/linux/objpool.h
index cb1758eaa2d3..b713a1fe7521 100644
--- a/include/linux/objpool.h
+++ b/include/linux/objpool.h
@@ -170,17 +170,16 @@ static inline void *objpool_pop(struct objpool_head *pool)
 {
 	void *obj = NULL;
 	unsigned long flags;
-	int i, cpu;
+	int start, cpu;
 
 	/* disable local irq to avoid preemption & interruption */
 	raw_local_irq_save(flags);
 
-	cpu = raw_smp_processor_id();
-	for (i = 0; i < pool->nr_possible_cpus; i++) {
+	start = raw_smp_processor_id();
+	for_each_possible_cpu_wrap(cpu, start) {
 		obj = __objpool_try_get_slot(pool, cpu);
 		if (obj)
 			break;
-		cpu = cpumask_next_wrap(cpu, cpu_possible_mask, -1, 1);
 	}
 	raw_local_irq_restore(flags);
 
-- 
2.43.0


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

* [PATCH v2 02/13] virtio_net: simplify virtnet_set_affinity()
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
  2025-01-28 16:46 ` [PATCH v2 01/13] objpool: rework objpool_pop() Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-02-05 23:00   ` Nick Child
  2025-01-28 16:46 ` [PATCH v2 03/13] ibmvnic: simplify ibmvnic_set_queue_affinity() Yury Norov
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, netdev, virtualization, Michael S. Tsirkin,
	Jason Wang, Xuan Zhuo, Eugenio Pérez, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Nick Child
  Cc: Yury Norov, Christoph Hellwig, Rasmus Villemoes

The inner loop may be replaced with the dedicated for_each_online_cpu_wrap.
It helps to avoid setting the same bits in the @mask more than once, in
case of group_size is greater than number of online CPUs.

CC: Nick Child <nnac123@linux.ibm.com>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 drivers/net/virtio_net.c | 12 +++++++-----
 include/linux/cpumask.h  |  4 ++++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 7646ddd9bef7..9d7c37e968b5 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -3826,7 +3826,7 @@ static void virtnet_set_affinity(struct virtnet_info *vi)
 	cpumask_var_t mask;
 	int stragglers;
 	int group_size;
-	int i, j, cpu;
+	int i, start = 0, cpu;
 	int num_cpu;
 	int stride;
 
@@ -3840,16 +3840,18 @@ static void virtnet_set_affinity(struct virtnet_info *vi)
 	stragglers = num_cpu >= vi->curr_queue_pairs ?
 			num_cpu % vi->curr_queue_pairs :
 			0;
-	cpu = cpumask_first(cpu_online_mask);
 
 	for (i = 0; i < vi->curr_queue_pairs; i++) {
 		group_size = stride + (i < stragglers ? 1 : 0);
 
-		for (j = 0; j < group_size; j++) {
+		for_each_online_cpu_wrap(cpu, start) {
+			if (!group_size--) {
+				start = cpu;
+				break;
+			}
 			cpumask_set_cpu(cpu, mask);
-			cpu = cpumask_next_wrap(cpu, cpu_online_mask,
-						nr_cpu_ids, false);
 		}
+
 		virtqueue_set_affinity(vi->rq[i].vq, mask);
 		virtqueue_set_affinity(vi->sq[i].vq, mask);
 		__netif_set_xps_queue(vi->dev, cpumask_bits(mask), i, XPS_CPUS);
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 5cf69a110c1c..30042351f15f 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -1036,6 +1036,8 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
 
 #define for_each_possible_cpu_wrap(cpu, start)	\
 	for ((void)(start), (cpu) = 0; (cpu) < 1; (cpu)++)
+#define for_each_online_cpu_wrap(cpu, start)	\
+	for ((void)(start), (cpu) = 0; (cpu) < 1; (cpu)++)
 #else
 #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
 #define for_each_online_cpu(cpu)   for_each_cpu((cpu), cpu_online_mask)
@@ -1044,6 +1046,8 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
 
 #define for_each_possible_cpu_wrap(cpu, start)	\
 	for_each_cpu_wrap((cpu), cpu_possible_mask, (start))
+#define for_each_online_cpu_wrap(cpu, start)	\
+	for_each_cpu_wrap((cpu), cpu_online_mask, (start))
 #endif
 
 /* Wrappers for arch boot code to manipulate normally-constant masks */
-- 
2.43.0


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

* [PATCH v2 03/13] ibmvnic: simplify ibmvnic_set_queue_affinity()
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
  2025-01-28 16:46 ` [PATCH v2 01/13] objpool: rework objpool_pop() Yury Norov
  2025-01-28 16:46 ` [PATCH v2 02/13] virtio_net: simplify virtnet_set_affinity() Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-02-05 23:10   ` Nick Child
  2025-01-28 16:46 ` [PATCH v2 04/13] powerpc/xmon: simplify xmon_batch_next_cpu() Yury Norov
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, netdev, linuxppc-dev, Haren Myneni, Rick Lindsley,
	Nick Child, Thomas Falcon, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N Rao, Madhavan Srinivasan,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Yury Norov, Christoph Hellwig, Rasmus Villemoes

A loop based on cpumask_next_wrap() opencodes the dedicated macro
for_each_online_cpu_wrap(). Using the macro allows to avoid setting
bits affinity mask more than once when stride >= num_online_cpus.

This also helps to drop cpumask handling code in the caller function.

CC: Nick Child <nnac123@linux.ibm.com>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index e95ae0d39948..bef18ff69065 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -234,11 +234,17 @@ static int ibmvnic_set_queue_affinity(struct ibmvnic_sub_crq_queue *queue,
 		(*stragglers)--;
 	}
 	/* atomic write is safer than writing bit by bit directly */
-	for (i = 0; i < stride; i++) {
-		cpumask_set_cpu(*cpu, mask);
-		*cpu = cpumask_next_wrap(*cpu, cpu_online_mask,
-					 nr_cpu_ids, false);
+	for_each_online_cpu_wrap(i, *cpu) {
+		if (!stride--) {
+			/* For the next queue we start from the first
+			 * unused CPU in this queue
+			 */
+			*cpu = i;
+			break;
+		}
+		cpumask_set_cpu(i, mask);
 	}
+
 	/* set queue affinity mask */
 	cpumask_copy(queue->affinity_mask, mask);
 	rc = irq_set_affinity_and_hint(queue->irq, queue->affinity_mask);
@@ -256,7 +262,7 @@ static void ibmvnic_set_affinity(struct ibmvnic_adapter *adapter)
 	int num_rxqs = adapter->num_active_rx_scrqs, i_rxqs = 0;
 	int num_txqs = adapter->num_active_tx_scrqs, i_txqs = 0;
 	int total_queues, stride, stragglers, i;
-	unsigned int num_cpu, cpu;
+	unsigned int num_cpu, cpu = 0;
 	bool is_rx_queue;
 	int rc = 0;
 
@@ -274,8 +280,6 @@ static void ibmvnic_set_affinity(struct ibmvnic_adapter *adapter)
 	stride = max_t(int, num_cpu / total_queues, 1);
 	/* number of leftover cpu's */
 	stragglers = num_cpu >= total_queues ? num_cpu % total_queues : 0;
-	/* next available cpu to assign irq to */
-	cpu = cpumask_next(-1, cpu_online_mask);
 
 	for (i = 0; i < total_queues; i++) {
 		is_rx_queue = false;
-- 
2.43.0


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

* [PATCH v2 04/13] powerpc/xmon: simplify xmon_batch_next_cpu()
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
                   ` (2 preceding siblings ...)
  2025-01-28 16:46 ` [PATCH v2 03/13] ibmvnic: simplify ibmvnic_set_queue_affinity() Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-01-28 16:46 ` [PATCH v2 05/13] cpumask: deprecate cpumask_next_wrap() Yury Norov
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, linuxppc-dev, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N Rao, Madhavan Srinivasan
  Cc: Yury Norov, Christoph Hellwig, Rasmus Villemoes

The function opencodes for_each_cpu_wrap() macro. As a loop termination
condition it uses cpumask_empty(), which is O(N), and it makes the whole
algorithm O(N^2). Switching to for_each_cpu_wrap() simplifies the logic,
and makes the algorithm linear.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 arch/powerpc/xmon/xmon.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 268859e4df87..1acb53aab252 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1271,11 +1271,7 @@ static int xmon_batch_next_cpu(void)
 {
 	unsigned long cpu;
 
-	while (!cpumask_empty(&xmon_batch_cpus)) {
-		cpu = cpumask_next_wrap(smp_processor_id(), &xmon_batch_cpus,
-					xmon_batch_start_cpu, true);
-		if (cpu >= nr_cpu_ids)
-			break;
+	for_each_cpu_wrap(cpu, &xmon_batch_cpus, xmon_batch_start_cpu) {
 		if (xmon_batch_start_cpu == -1)
 			xmon_batch_start_cpu = cpu;
 		if (xmon_switch_cpu(cpu))
-- 
2.43.0



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

* [PATCH v2 05/13] cpumask: deprecate cpumask_next_wrap()
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
                   ` (3 preceding siblings ...)
  2025-01-28 16:46 ` [PATCH v2 04/13] powerpc/xmon: simplify xmon_batch_next_cpu() Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-01-28 16:46 ` [PATCH v2 06/13] cpumask: re-introduce cpumask_next{,_and}_wrap() Yury Norov
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, linuxppc-dev, linux-s390, netdev, virtualization,
	linux-nvme, linux-hyperv, linux-pci, linux-scsi, linux-crypto,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Haren Myneni, Rick Lindsley, Nick Child, Thomas Falcon,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
	Eugenio Pérez, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
	Dexuan Cui, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, James Smart,
	Dick Kennedy, James E.J. Bottomley, Martin K. Petersen,
	Yury Norov, Rasmus Villemoes, Matt Wu, Steffen Klassert,
	Daniel Jordan, Andrew Morton, Greg Kurz, Peter Xu,
	Shrikanth Hegde, Hendrik Brueckner

The next patch aligns implementation of cpumask_next_wrap() with the
find_next_bit_wrap(), and it changes function signature.

To make the transition smooth, this patch deprecates current
implementation by adding an _old suffix. The following patches switch
current users to the new implementation one by one.

No functional changes were intended.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 arch/s390/kernel/processor.c        | 2 +-
 drivers/pci/controller/pci-hyperv.c | 2 +-
 drivers/scsi/lpfc/lpfc_init.c       | 2 +-
 include/linux/cpumask.h             | 4 ++--
 kernel/padata.c                     | 2 +-
 lib/cpumask.c                       | 6 +++---
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
index 5ce9a795a0fe..42ca61909030 100644
--- a/arch/s390/kernel/processor.c
+++ b/arch/s390/kernel/processor.c
@@ -72,7 +72,7 @@ void notrace stop_machine_yield(const struct cpumask *cpumask)
 	this_cpu = smp_processor_id();
 	if (__this_cpu_inc_return(cpu_relax_retry) >= spin_retry) {
 		__this_cpu_write(cpu_relax_retry, 0);
-		cpu = cpumask_next_wrap(this_cpu, cpumask, this_cpu, false);
+		cpu = cpumask_next_wrap_old(this_cpu, cpumask, this_cpu, false);
 		if (cpu >= nr_cpu_ids)
 			return;
 		if (arch_vcpu_is_preempted(cpu))
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 6084b38bdda1..c39316966de5 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1757,7 +1757,7 @@ static int hv_compose_multi_msi_req_get_cpu(void)
 
 	spin_lock_irqsave(&multi_msi_cpu_lock, flags);
 
-	cpu_next = cpumask_next_wrap(cpu_next, cpu_online_mask, nr_cpu_ids,
+	cpu_next = cpumask_next_wrap_old(cpu_next, cpu_online_mask, nr_cpu_ids,
 				     false);
 	cpu = cpu_next;
 
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 7f57397d91a9..31622fb0614a 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -12876,7 +12876,7 @@ lpfc_irq_rebalance(struct lpfc_hba *phba, unsigned int cpu, bool offline)
 
 	if (offline) {
 		/* Find next online CPU on original mask */
-		cpu_next = cpumask_next_wrap(cpu, orig_mask, cpu, true);
+		cpu_next = cpumask_next_wrap_old(cpu, orig_mask, cpu, true);
 		cpu_select = lpfc_next_online_cpu(orig_mask, cpu_next);
 
 		/* Found a valid CPU */
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 30042351f15f..b267a4f6a917 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -296,7 +296,7 @@ unsigned int cpumask_next_and(int n, const struct cpumask *src1p,
 
 #if NR_CPUS == 1
 static __always_inline
-unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap)
+unsigned int cpumask_next_wrap_old(int n, const struct cpumask *mask, int start, bool wrap)
 {
 	cpumask_check(start);
 	if (n != -1)
@@ -312,7 +312,7 @@ unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int start, boo
 	return cpumask_first(mask);
 }
 #else
-unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap);
+unsigned int __pure cpumask_next_wrap_old(int n, const struct cpumask *mask, int start, bool wrap);
 #endif
 
 /**
diff --git a/kernel/padata.c b/kernel/padata.c
index 418987056340..78e202fabf90 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -290,7 +290,7 @@ static struct padata_priv *padata_find_next(struct parallel_data *pd,
 	if (remove_object) {
 		list_del_init(&padata->list);
 		++pd->processed;
-		pd->cpu = cpumask_next_wrap(cpu, pd->cpumask.pcpu, -1, false);
+		pd->cpu = cpumask_next_wrap_old(cpu, pd->cpumask.pcpu, -1, false);
 	}
 
 	spin_unlock(&reorder->lock);
diff --git a/lib/cpumask.c b/lib/cpumask.c
index e77ee9d46f71..c9a9b451772a 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -8,7 +8,7 @@
 #include <linux/numa.h>
 
 /**
- * cpumask_next_wrap - helper to implement for_each_cpu_wrap
+ * cpumask_next_wrap_old - helper to implement for_each_cpu_wrap
  * @n: the cpu prior to the place to search
  * @mask: the cpumask pointer
  * @start: the start point of the iteration
@@ -19,7 +19,7 @@
  * Note: the @wrap argument is required for the start condition when
  * we cannot assume @start is set in @mask.
  */
-unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap)
+unsigned int cpumask_next_wrap_old(int n, const struct cpumask *mask, int start, bool wrap)
 {
 	unsigned int next;
 
@@ -37,7 +37,7 @@ unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int start, boo
 
 	return next;
 }
-EXPORT_SYMBOL(cpumask_next_wrap);
+EXPORT_SYMBOL(cpumask_next_wrap_old);
 
 /* These are not inline because of header tangles. */
 #ifdef CONFIG_CPUMASK_OFFSTACK
-- 
2.43.0


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

* [PATCH v2 06/13] cpumask: re-introduce cpumask_next{,_and}_wrap()
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
                   ` (4 preceding siblings ...)
  2025-01-28 16:46 ` [PATCH v2 05/13] cpumask: deprecate cpumask_next_wrap() Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-01-28 16:46 ` [PATCH v2 07/13] cpumask: use cpumask_next_wrap() where appropriate Yury Norov
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, linuxppc-dev, linux-s390, netdev, virtualization,
	linux-nvme, linux-hyperv, linux-pci, linux-scsi, linux-crypto,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Haren Myneni, Rick Lindsley, Nick Child, Thomas Falcon,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
	Eugenio Pérez, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
	Dexuan Cui, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, James Smart,
	Dick Kennedy, James E.J. Bottomley, Martin K. Petersen,
	Yury Norov, Rasmus Villemoes, Matt Wu, Steffen Klassert,
	Daniel Jordan, Andrew Morton, Greg Kurz, Peter Xu,
	Shrikanth Hegde, Hendrik Brueckner
  Cc: Bjorn Helgaas

cpumask_next_wrap_old() has two additional parameters, comparing to its
generic counterpart find_next_bit_wrap(). The reason for that is
historical.

Before 4fe49b3b97c262 ("lib/bitmap: introduce for_each_set_bit_wrap()
macro"), cpumask_next_wrap() was used to implement for_each_cpu_wrap()
iterator. Now that the iterator is an alias to generic
for_each_set_bit_wrap(), the additional parameters aren't used and may
confuse readers.

All existing users call cpumask_next_wrap() in a way that makes it
possible to turn it to straight and simple alias to find_next_bit_wrap().

In a couple of places kernel users opencode missing cpumask_next_and_wrap().
Add it as well.

CC: Alexander Gordeev <agordeev@linux.ibm.com>
CC: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 include/linux/cpumask.h | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index b267a4f6a917..4f3d8d66e86e 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -284,6 +284,44 @@ unsigned int cpumask_next_and(int n, const struct cpumask *src1p,
 		small_cpumask_bits, n + 1);
 }
 
+/**
+ * cpumask_next_and_wrap - get the next cpu in *src1p & *src2p, starting from
+ *			   @n+1. If nothing found, wrap around and start from
+ *			   the beginning
+ * @n: the cpu prior to the place to search (i.e. search starts from @n+1)
+ * @src1p: the first cpumask pointer
+ * @src2p: the second cpumask pointer
+ *
+ * Return: next set bit, wrapped if needed, or >= nr_cpu_ids if @src1p & @src2p is empty.
+ */
+static __always_inline
+unsigned int cpumask_next_and_wrap(int n, const struct cpumask *src1p,
+			      const struct cpumask *src2p)
+{
+	/* -1 is a legal arg here. */
+	if (n != -1)
+		cpumask_check(n);
+	return find_next_and_bit_wrap(cpumask_bits(src1p), cpumask_bits(src2p),
+		small_cpumask_bits, n + 1);
+}
+
+/**
+ * cpumask_next_wrap - get the next cpu in *src, starting from @n+1. If nothing
+ *		       found, wrap around and start from the beginning
+ * @n: the cpu prior to the place to search (i.e. search starts from @n+1)
+ * @src: cpumask pointer
+ *
+ * Return: next set bit, wrapped if needed, or >= nr_cpu_ids if @src is empty.
+ */
+static __always_inline
+unsigned int cpumask_next_wrap(int n, const struct cpumask *src)
+{
+	/* -1 is a legal arg here. */
+	if (n != -1)
+		cpumask_check(n);
+	return find_next_bit_wrap(cpumask_bits(src), small_cpumask_bits, n + 1);
+}
+
 /**
  * for_each_cpu - iterate over every cpu in a mask
  * @cpu: the (optionally unsigned) integer iterator
-- 
2.43.0


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

* [PATCH v2 07/13] cpumask: use cpumask_next_wrap() where appropriate
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
                   ` (5 preceding siblings ...)
  2025-01-28 16:46 ` [PATCH v2 06/13] cpumask: re-introduce cpumask_next{,_and}_wrap() Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-01-28 16:46 ` [PATCH v2 08/13] padata: switch padata_find_next() to using cpumask_next_wrap() Yury Norov
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, Yury Norov, Rasmus Villemoes, Andrew Morton
  Cc: Christoph Hellwig

Now that cpumask_next{_and}_wrap() is wired to generic
find_next_bit_wrap(), we can use it in cpumask_any{_and}_distribute().

This automatically makes the cpumask_*_distribute() functions to use
small_cpumask_bits instead of nr_cpumask_bits, which itself is a good
optimization.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 lib/cpumask.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/cpumask.c b/lib/cpumask.c
index c9a9b451772a..d7cce2aaebc2 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -174,8 +174,7 @@ unsigned int cpumask_any_and_distribute(const struct cpumask *src1p,
 	/* NOTE: our first selection will skip 0. */
 	prev = __this_cpu_read(distribute_cpu_mask_prev);
 
-	next = find_next_and_bit_wrap(cpumask_bits(src1p), cpumask_bits(src2p),
-					nr_cpumask_bits, prev + 1);
+	next = cpumask_next_and_wrap(prev, src1p, src2p);
 	if (next < nr_cpu_ids)
 		__this_cpu_write(distribute_cpu_mask_prev, next);
 
@@ -195,7 +194,7 @@ unsigned int cpumask_any_distribute(const struct cpumask *srcp)
 
 	/* NOTE: our first selection will skip 0. */
 	prev = __this_cpu_read(distribute_cpu_mask_prev);
-	next = find_next_bit_wrap(cpumask_bits(srcp), nr_cpumask_bits, prev + 1);
+	next = cpumask_next_wrap(prev, srcp);
 	if (next < nr_cpu_ids)
 		__this_cpu_write(distribute_cpu_mask_prev, next);
 
-- 
2.43.0


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

* [PATCH v2 08/13] padata: switch padata_find_next() to using cpumask_next_wrap()
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
                   ` (6 preceding siblings ...)
  2025-01-28 16:46 ` [PATCH v2 07/13] cpumask: use cpumask_next_wrap() where appropriate Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-01-28 16:46 ` [PATCH v2 09/13] s390: switch stop_machine_yield() " Yury Norov
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, linux-crypto, Steffen Klassert, Daniel Jordan
  Cc: Yury Norov, Christoph Hellwig, Rasmus Villemoes, Herbert Xu

Calling cpumask_next_wrap_old() with starting CPU == -1 effectively means
the request to find next CPU, wrapping around if needed.

cpumask_next_wrap() is the proper replacement for that.

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 kernel/padata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index 78e202fabf90..b3d4eacc4f5d 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -290,7 +290,7 @@ static struct padata_priv *padata_find_next(struct parallel_data *pd,
 	if (remove_object) {
 		list_del_init(&padata->list);
 		++pd->processed;
-		pd->cpu = cpumask_next_wrap_old(cpu, pd->cpumask.pcpu, -1, false);
+		pd->cpu = cpumask_next_wrap(cpu, pd->cpumask.pcpu);
 	}
 
 	spin_unlock(&reorder->lock);
-- 
2.43.0


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

* [PATCH v2 09/13] s390: switch stop_machine_yield() to using cpumask_next_wrap()
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
                   ` (7 preceding siblings ...)
  2025-01-28 16:46 ` [PATCH v2 08/13] padata: switch padata_find_next() to using cpumask_next_wrap() Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-01-28 16:46 ` Yury Norov
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, linux-s390, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Hendrik Brueckner
  Cc: Yury Norov, Christoph Hellwig, Rasmus Villemoes

Calling cpumask_next_wrap_old() with starting CPU equal to wrapping CPU
effectively means the request to find next CPU, wrapping around if needed.

cpumask_next_wrap() is the proper replacement for that.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 arch/s390/kernel/processor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
index 42ca61909030..745649ad9779 100644
--- a/arch/s390/kernel/processor.c
+++ b/arch/s390/kernel/processor.c
@@ -72,7 +72,7 @@ void notrace stop_machine_yield(const struct cpumask *cpumask)
 	this_cpu = smp_processor_id();
 	if (__this_cpu_inc_return(cpu_relax_retry) >= spin_retry) {
 		__this_cpu_write(cpu_relax_retry, 0);
-		cpu = cpumask_next_wrap_old(this_cpu, cpumask, this_cpu, false);
+		cpu = cpumask_next_wrap(this_cpu, cpumask);
 		if (cpu >= nr_cpu_ids)
 			return;
 		if (arch_vcpu_is_preempted(cpu))
-- 
2.43.0


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

* (no subject)
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
                   ` (8 preceding siblings ...)
  2025-01-28 16:46 ` [PATCH v2 09/13] s390: switch stop_machine_yield() " Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-01-28 16:46 ` [PATCH v2 11/13] scsi: lpfc: rework lpfc_next_{online,present}_cpu() Yury Norov
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, linux-scsi, James Smart, Dick Kennedy,
	James E.J. Bottomley, Martin K. Petersen
  Cc: Yury Norov, Christoph Hellwig, Rasmus Villemoes, Justin Tee

Subject: [PATCH v2 10/13] scsi: lpfc: switch lpfc_irq_rebalance() to using
 cpumask_next_wrap()

Calling cpumask_next_wrap_old() with starting CPU equal to wrapping CPU
is the same as request to find next CPU, wrapping around if needed.

cpumask_next_wrap() is the proper replacement for that.

Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 drivers/scsi/lpfc/lpfc_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 31622fb0614a..e94a7b8973a7 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -12876,7 +12876,7 @@ lpfc_irq_rebalance(struct lpfc_hba *phba, unsigned int cpu, bool offline)
 
 	if (offline) {
 		/* Find next online CPU on original mask */
-		cpu_next = cpumask_next_wrap_old(cpu, orig_mask, cpu, true);
+		cpu_next = cpumask_next_wrap(cpu, orig_mask);
 		cpu_select = lpfc_next_online_cpu(orig_mask, cpu_next);
 
 		/* Found a valid CPU */
-- 
2.43.0


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

* [PATCH v2 11/13] scsi: lpfc: rework lpfc_next_{online,present}_cpu()
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
                   ` (9 preceding siblings ...)
  2025-01-28 16:46 ` Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-01-28 16:46 ` [PATCH v2 12/13] PCI: hv: Switch hv_compose_multi_msi_req_get_cpu() to using cpumask_next_wrap() Yury Norov
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, James Smart, Dick Kennedy,
	James E.J. Bottomley, Martin K. Petersen, Yury Norov,
	Rasmus Villemoes
  Cc: Christoph Hellwig, Justin Tee

lpfc_next_online_cpu() opencodes cpumask_next_and_wrap() by using
a for-loop. Use it and make the lpfc_next_online_cpu() a plain
one-liner.

While there, rework lpfc_next_present_cpu() similarly. Notice that
cpumask_next() followed by cpumask_first() in the worst case of an
empty mask may traverse the mask twice. Cpumask_next_wrap() takes
care of that correctly.

Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 drivers/scsi/lpfc/lpfc.h | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index e5a9c5a323f8..62438e84e52a 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -1715,18 +1715,12 @@ lpfc_phba_elsring(struct lpfc_hba *phba)
  * Note: If no valid cpu found, then nr_cpu_ids is returned.
  *
  **/
-static inline unsigned int
+static __always_inline unsigned int
 lpfc_next_online_cpu(const struct cpumask *mask, unsigned int start)
 {
-	unsigned int cpu_it;
-
-	for_each_cpu_wrap(cpu_it, mask, start) {
-		if (cpu_online(cpu_it))
-			break;
-	}
-
-	return cpu_it;
+	return cpumask_next_and_wrap(start, mask, cpu_online_mask);
 }
+
 /**
  * lpfc_next_present_cpu - Finds next present CPU after n
  * @n: the cpu prior to search
@@ -1734,16 +1728,9 @@ lpfc_next_online_cpu(const struct cpumask *mask, unsigned int start)
  * Note: If no next present cpu, then fallback to first present cpu.
  *
  **/
-static inline unsigned int lpfc_next_present_cpu(int n)
+static __always_inline unsigned int lpfc_next_present_cpu(int n)
 {
-	unsigned int cpu;
-
-	cpu = cpumask_next(n, cpu_present_mask);
-
-	if (cpu >= nr_cpu_ids)
-		cpu = cpumask_first(cpu_present_mask);
-
-	return cpu;
+	return cpumask_next_wrap(n, cpu_present_mask);
 }
 
 /**
-- 
2.43.0


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

* [PATCH v2 12/13] PCI: hv: Switch hv_compose_multi_msi_req_get_cpu() to using cpumask_next_wrap()
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
                   ` (10 preceding siblings ...)
  2025-01-28 16:46 ` [PATCH v2 11/13] scsi: lpfc: rework lpfc_next_{online,present}_cpu() Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-01-28 16:46 ` [PATCH v2 13/13] cpumask: drop cpumask_next_wrap_old() Yury Norov
  2025-02-24 21:18 ` [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Michael S. Tsirkin
  13 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-hyperv, linux-pci, linux-kernel, K. Y. Srinivasan,
	Haiyang Zhang, Wei Liu, Dexuan Cui, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas
  Cc: Yury Norov, Christoph Hellwig, Rasmus Villemoes, Michael Kelley

Calling cpumask_next_wrap_old() with starting CPU == nr_cpu_ids
is effectively the same as request to find first CPU, starting
from a given one and wrapping around if needed.

cpumask_next_wrap() is a proper replacement for that.

Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 drivers/pci/controller/pci-hyperv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index c39316966de5..44d7f4339306 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1757,8 +1757,7 @@ static int hv_compose_multi_msi_req_get_cpu(void)
 
 	spin_lock_irqsave(&multi_msi_cpu_lock, flags);
 
-	cpu_next = cpumask_next_wrap_old(cpu_next, cpu_online_mask, nr_cpu_ids,
-				     false);
+	cpu_next = cpumask_next_wrap(cpu_next, cpu_online_mask);
 	cpu = cpu_next;
 
 	spin_unlock_irqrestore(&multi_msi_cpu_lock, flags);
-- 
2.43.0


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

* [PATCH v2 13/13] cpumask: drop cpumask_next_wrap_old()
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
                   ` (11 preceding siblings ...)
  2025-01-28 16:46 ` [PATCH v2 12/13] PCI: hv: Switch hv_compose_multi_msi_req_get_cpu() to using cpumask_next_wrap() Yury Norov
@ 2025-01-28 16:46 ` Yury Norov
  2025-02-24 21:18 ` [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Michael S. Tsirkin
  13 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-01-28 16:46 UTC (permalink / raw)
  To: linux-kernel, Yury Norov, Rasmus Villemoes, Andrew Morton
  Cc: Christoph Hellwig

Now that we have cpumask_next_wrap() wired to generic find_next_bit_wrap(),
the old implementation is not needed.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 include/linux/cpumask.h | 21 ---------------------
 lib/cpumask.c           | 32 --------------------------------
 2 files changed, 53 deletions(-)

diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 4f3d8d66e86e..7496b1db8d0d 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -332,27 +332,6 @@ unsigned int cpumask_next_wrap(int n, const struct cpumask *src)
 #define for_each_cpu(cpu, mask)				\
 	for_each_set_bit(cpu, cpumask_bits(mask), small_cpumask_bits)
 
-#if NR_CPUS == 1
-static __always_inline
-unsigned int cpumask_next_wrap_old(int n, const struct cpumask *mask, int start, bool wrap)
-{
-	cpumask_check(start);
-	if (n != -1)
-		cpumask_check(n);
-
-	/*
-	 * Return the first available CPU when wrapping, or when starting before cpu0,
-	 * since there is only one valid option.
-	 */
-	if (wrap && n >= 0)
-		return nr_cpumask_bits;
-
-	return cpumask_first(mask);
-}
-#else
-unsigned int __pure cpumask_next_wrap_old(int n, const struct cpumask *mask, int start, bool wrap);
-#endif
-
 /**
  * for_each_cpu_wrap - iterate over every cpu in a mask, starting at a specified location
  * @cpu: the (optionally unsigned) integer iterator
diff --git a/lib/cpumask.c b/lib/cpumask.c
index d7cce2aaebc2..fbf7630f2ac9 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -7,38 +7,6 @@
 #include <linux/memblock.h>
 #include <linux/numa.h>
 
-/**
- * cpumask_next_wrap_old - helper to implement for_each_cpu_wrap
- * @n: the cpu prior to the place to search
- * @mask: the cpumask pointer
- * @start: the start point of the iteration
- * @wrap: assume @n crossing @start terminates the iteration
- *
- * Return: >= nr_cpu_ids on completion
- *
- * Note: the @wrap argument is required for the start condition when
- * we cannot assume @start is set in @mask.
- */
-unsigned int cpumask_next_wrap_old(int n, const struct cpumask *mask, int start, bool wrap)
-{
-	unsigned int next;
-
-again:
-	next = cpumask_next(n, mask);
-
-	if (wrap && n < start && next >= start) {
-		return nr_cpumask_bits;
-
-	} else if (next >= nr_cpumask_bits) {
-		wrap = true;
-		n = -1;
-		goto again;
-	}
-
-	return next;
-}
-EXPORT_SYMBOL(cpumask_next_wrap_old);
-
 /* These are not inline because of header tangles. */
 #ifdef CONFIG_CPUMASK_OFFSTACK
 /**
-- 
2.43.0


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

* Re: [PATCH v2 02/13] virtio_net: simplify virtnet_set_affinity()
  2025-01-28 16:46 ` [PATCH v2 02/13] virtio_net: simplify virtnet_set_affinity() Yury Norov
@ 2025-02-05 23:00   ` Nick Child
  2025-02-11 13:55     ` Yury Norov
  0 siblings, 1 reply; 18+ messages in thread
From: Nick Child @ 2025-02-05 23:00 UTC (permalink / raw)
  To: Yury Norov
  Cc: linux-kernel, netdev, virtualization, Michael S. Tsirkin,
	Jason Wang, Xuan Zhuo, Eugenio Pérez, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Christoph Hellwig,
	Rasmus Villemoes

On Tue, Jan 28, 2025 at 11:46:31AM -0500, Yury Norov wrote:
> The inner loop may be replaced with the dedicated for_each_online_cpu_wrap.
> It helps to avoid setting the same bits in the @mask more than once, in
> case of group_size is greater than number of online CPUs.

nit: Looking at the previous logic of how group_stride is calculated, I don't
think there is possibility of "setting the same bits in the @mask more
than once". group_stride = n_cpu / n_queues

nit: I see this more as 2 patches. The introduction of a new core
helper function is a bit buried.

> 
> CC: Nick Child <nnac123@linux.ibm.com>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>

Don't know if my comments alone merit a v3 and I think the patch
does simplify the codebase so:
Reviewed-by: Nick Child <nnac123@linux.ibm.com>

> ---
>  drivers/net/virtio_net.c | 12 +++++++-----
>  include/linux/cpumask.h  |  4 ++++
>  2 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 7646ddd9bef7..9d7c37e968b5 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -3826,7 +3826,7 @@ static void virtnet_set_affinity(struct virtnet_info *vi)
>  	cpumask_var_t mask;
>  	int stragglers;
>  	int group_size;
> -	int i, j, cpu;
> +	int i, start = 0, cpu;
>  	int num_cpu;
>  	int stride;
>  
> @@ -3840,16 +3840,18 @@ static void virtnet_set_affinity(struct virtnet_info *vi)
>  	stragglers = num_cpu >= vi->curr_queue_pairs ?
>  			num_cpu % vi->curr_queue_pairs :
>  			0;
> -	cpu = cpumask_first(cpu_online_mask);
>  
>  	for (i = 0; i < vi->curr_queue_pairs; i++) {
>  		group_size = stride + (i < stragglers ? 1 : 0);
>  
> -		for (j = 0; j < group_size; j++) {
> +		for_each_online_cpu_wrap(cpu, start) {
> +			if (!group_size--) {
> +				start = cpu;
> +				break;
> +			}
>  			cpumask_set_cpu(cpu, mask);
> -			cpu = cpumask_next_wrap(cpu, cpu_online_mask,
> -						nr_cpu_ids, false);
>  		}
> +
>  		virtqueue_set_affinity(vi->rq[i].vq, mask);
>  		virtqueue_set_affinity(vi->sq[i].vq, mask);
>  		__netif_set_xps_queue(vi->dev, cpumask_bits(mask), i, XPS_CPUS);
> diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
> index 5cf69a110c1c..30042351f15f 100644
> --- a/include/linux/cpumask.h
> +++ b/include/linux/cpumask.h
> @@ -1036,6 +1036,8 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
>  
>  #define for_each_possible_cpu_wrap(cpu, start)	\
>  	for ((void)(start), (cpu) = 0; (cpu) < 1; (cpu)++)
> +#define for_each_online_cpu_wrap(cpu, start)	\
> +	for ((void)(start), (cpu) = 0; (cpu) < 1; (cpu)++)
>  #else
>  #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
>  #define for_each_online_cpu(cpu)   for_each_cpu((cpu), cpu_online_mask)
> @@ -1044,6 +1046,8 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
>  
>  #define for_each_possible_cpu_wrap(cpu, start)	\
>  	for_each_cpu_wrap((cpu), cpu_possible_mask, (start))
> +#define for_each_online_cpu_wrap(cpu, start)	\
> +	for_each_cpu_wrap((cpu), cpu_online_mask, (start))
>  #endif
>  
>  /* Wrappers for arch boot code to manipulate normally-constant masks */
> -- 
> 2.43.0
> 

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

* Re: [PATCH v2 03/13] ibmvnic: simplify ibmvnic_set_queue_affinity()
  2025-01-28 16:46 ` [PATCH v2 03/13] ibmvnic: simplify ibmvnic_set_queue_affinity() Yury Norov
@ 2025-02-05 23:10   ` Nick Child
  0 siblings, 0 replies; 18+ messages in thread
From: Nick Child @ 2025-02-05 23:10 UTC (permalink / raw)
  To: Yury Norov
  Cc: linux-kernel, netdev, linuxppc-dev, Haren Myneni, Rick Lindsley,
	Thomas Falcon, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N Rao, Madhavan Srinivasan,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Christoph Hellwig, Rasmus Villemoes

On Tue, Jan 28, 2025 at 11:46:32AM -0500, Yury Norov wrote:
> A loop based on cpumask_next_wrap() opencodes the dedicated macro
> for_each_online_cpu_wrap(). Using the macro allows to avoid setting
> bits affinity mask more than once when stride >= num_online_cpus.
>

nit: Same comment as left in patch 2. Don't think re-iterating over
cpu's was ever possible. But I do think the patch improves readability
and simplifies things.

> This also helps to drop cpumask handling code in the caller function.
> 
> CC: Nick Child <nnac123@linux.ibm.com>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>

Built/booted kernel (patch 10 is ill-formated), messed around with n
online cpu and n queues. All ibmvnic affinity values look correct.
Thanks!

Tested-by: Nick Child <nnac123@linux.ibm.com>

> ---
>  drivers/net/ethernet/ibm/ibmvnic.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index e95ae0d39948..bef18ff69065 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -234,11 +234,17 @@ static int ibmvnic_set_queue_affinity(struct ibmvnic_sub_crq_queue *queue,
>  		(*stragglers)--;
>  	}
>  	/* atomic write is safer than writing bit by bit directly */
> -	for (i = 0; i < stride; i++) {
> -		cpumask_set_cpu(*cpu, mask);
> -		*cpu = cpumask_next_wrap(*cpu, cpu_online_mask,
> -					 nr_cpu_ids, false);
> +	for_each_online_cpu_wrap(i, *cpu) {
> +		if (!stride--) {
> +			/* For the next queue we start from the first
> +			 * unused CPU in this queue
> +			 */
> +			*cpu = i;
> +			break;
> +		}
> +		cpumask_set_cpu(i, mask);
>  	}
> +
>  	/* set queue affinity mask */
>  	cpumask_copy(queue->affinity_mask, mask);
>  	rc = irq_set_affinity_and_hint(queue->irq, queue->affinity_mask);
> @@ -256,7 +262,7 @@ static void ibmvnic_set_affinity(struct ibmvnic_adapter *adapter)
>  	int num_rxqs = adapter->num_active_rx_scrqs, i_rxqs = 0;
>  	int num_txqs = adapter->num_active_tx_scrqs, i_txqs = 0;
>  	int total_queues, stride, stragglers, i;
> -	unsigned int num_cpu, cpu;
> +	unsigned int num_cpu, cpu = 0;
>  	bool is_rx_queue;
>  	int rc = 0;
>  
> @@ -274,8 +280,6 @@ static void ibmvnic_set_affinity(struct ibmvnic_adapter *adapter)
>  	stride = max_t(int, num_cpu / total_queues, 1);
>  	/* number of leftover cpu's */
>  	stragglers = num_cpu >= total_queues ? num_cpu % total_queues : 0;
> -	/* next available cpu to assign irq to */
> -	cpu = cpumask_next(-1, cpu_online_mask);
>  
>  	for (i = 0; i < total_queues; i++) {
>  		is_rx_queue = false;
> -- 
> 2.43.0
> 

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

* Re: [PATCH v2 02/13] virtio_net: simplify virtnet_set_affinity()
  2025-02-05 23:00   ` Nick Child
@ 2025-02-11 13:55     ` Yury Norov
  0 siblings, 0 replies; 18+ messages in thread
From: Yury Norov @ 2025-02-11 13:55 UTC (permalink / raw)
  To: Nick Child
  Cc: linux-kernel, netdev, virtualization, Michael S. Tsirkin,
	Jason Wang, Xuan Zhuo, Eugenio Pérez, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Christoph Hellwig,
	Rasmus Villemoes

Thanks for review and testing, Nick!

On Wed, Feb 05, 2025 at 05:00:23PM -0600, Nick Child wrote:
> On Tue, Jan 28, 2025 at 11:46:31AM -0500, Yury Norov wrote:
> > The inner loop may be replaced with the dedicated for_each_online_cpu_wrap.
> > It helps to avoid setting the same bits in the @mask more than once, in
> > case of group_size is greater than number of online CPUs.
> 
> nit: Looking at the previous logic of how group_stride is calculated, I don't
> think there is possibility of "setting the same bits in the @mask more
> than once". group_stride = n_cpu / n_queues
> 
> nit: I see this more as 2 patches. The introduction of a new core
> helper function is a bit buried.
> 
> > 
> > CC: Nick Child <nnac123@linux.ibm.com>
> > Signed-off-by: Yury Norov <yury.norov@gmail.com>
> 
> Don't know if my comments alone merit a v3 and I think the patch
> does simplify the codebase so:
> Reviewed-by: Nick Child <nnac123@linux.ibm.com>

I fixed the comments to #2 and #3 as you suggested and split-out new
for_each() loops to the new patch.

I also think those are trivial changes not worth v3. So it's in
bitmap-for-next:

https://github.com/norov/linux/tree/bitmap-for-next

Thanks for review, Nick!

Thanks,
Yury
 
> > ---
> >  drivers/net/virtio_net.c | 12 +++++++-----
> >  include/linux/cpumask.h  |  4 ++++
> >  2 files changed, 11 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index 7646ddd9bef7..9d7c37e968b5 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -3826,7 +3826,7 @@ static void virtnet_set_affinity(struct virtnet_info *vi)
> >  	cpumask_var_t mask;
> >  	int stragglers;
> >  	int group_size;
> > -	int i, j, cpu;
> > +	int i, start = 0, cpu;
> >  	int num_cpu;
> >  	int stride;
> >  
> > @@ -3840,16 +3840,18 @@ static void virtnet_set_affinity(struct virtnet_info *vi)
> >  	stragglers = num_cpu >= vi->curr_queue_pairs ?
> >  			num_cpu % vi->curr_queue_pairs :
> >  			0;
> > -	cpu = cpumask_first(cpu_online_mask);
> >  
> >  	for (i = 0; i < vi->curr_queue_pairs; i++) {
> >  		group_size = stride + (i < stragglers ? 1 : 0);
> >  
> > -		for (j = 0; j < group_size; j++) {
> > +		for_each_online_cpu_wrap(cpu, start) {
> > +			if (!group_size--) {
> > +				start = cpu;
> > +				break;
> > +			}
> >  			cpumask_set_cpu(cpu, mask);
> > -			cpu = cpumask_next_wrap(cpu, cpu_online_mask,
> > -						nr_cpu_ids, false);
> >  		}
> > +
> >  		virtqueue_set_affinity(vi->rq[i].vq, mask);
> >  		virtqueue_set_affinity(vi->sq[i].vq, mask);
> >  		__netif_set_xps_queue(vi->dev, cpumask_bits(mask), i, XPS_CPUS);
> > diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
> > index 5cf69a110c1c..30042351f15f 100644
> > --- a/include/linux/cpumask.h
> > +++ b/include/linux/cpumask.h
> > @@ -1036,6 +1036,8 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
> >  
> >  #define for_each_possible_cpu_wrap(cpu, start)	\
> >  	for ((void)(start), (cpu) = 0; (cpu) < 1; (cpu)++)
> > +#define for_each_online_cpu_wrap(cpu, start)	\
> > +	for ((void)(start), (cpu) = 0; (cpu) < 1; (cpu)++)
> >  #else
> >  #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
> >  #define for_each_online_cpu(cpu)   for_each_cpu((cpu), cpu_online_mask)
> > @@ -1044,6 +1046,8 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
> >  
> >  #define for_each_possible_cpu_wrap(cpu, start)	\
> >  	for_each_cpu_wrap((cpu), cpu_possible_mask, (start))
> > +#define for_each_online_cpu_wrap(cpu, start)	\
> > +	for_each_cpu_wrap((cpu), cpu_online_mask, (start))
> >  #endif
> >  
> >  /* Wrappers for arch boot code to manipulate normally-constant masks */
> > -- 
> > 2.43.0
> > 

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

* Re: [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage
  2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
                   ` (12 preceding siblings ...)
  2025-01-28 16:46 ` [PATCH v2 13/13] cpumask: drop cpumask_next_wrap_old() Yury Norov
@ 2025-02-24 21:18 ` Michael S. Tsirkin
  13 siblings, 0 replies; 18+ messages in thread
From: Michael S. Tsirkin @ 2025-02-24 21:18 UTC (permalink / raw)
  To: Yury Norov
  Cc: linux-kernel, linuxppc-dev, linux-s390, netdev, virtualization,
	linux-nvme, linux-hyperv, linux-pci, linux-scsi, linux-crypto,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Haren Myneni, Rick Lindsley, Nick Child, Thomas Falcon,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Jason Wang, Xuan Zhuo, Eugenio Pérez,
	Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, James Smart,
	Dick Kennedy, James E.J. Bottomley, Martin K. Petersen,
	Rasmus Villemoes, Matt Wu, Steffen Klassert, Daniel Jordan,
	Andrew Morton, Greg Kurz, Peter Xu, Shrikanth Hegde,
	Hendrik Brueckner

On Tue, Jan 28, 2025 at 11:46:29AM -0500, Yury Norov wrote:
> cpumask_next_wrap() is overly complicated, comparing to it's generic
> version find_next_bit_wrap(), not mentioning it duplicates the above.
> It roots to the times when the function was used in the implementation
> of for_each_cpu_wrap() iterator. The function has 2 additional parameters
> that were used to catch loop termination condition for the iterator.
> (Although, only one is needed.)
> 
> Since 4fe49b3b97c262 ("lib/bitmap: introduce for_each_set_bit_wrap()
> macro"), for_each_cpu_wrap() is wired to corresponding generic
> wrapping bitmap iterator, and additional complexity of
> cpumask_next_wrap() is not needed anymore.
> 
> All existing users call cpumask_next_wrap() in a manner that makes
> it possible to turn it to a straight and simple alias to
> find_next_bit_wrap().
> 
> This series replaces historical 4-parameter cpumask_next_wrap() with a
> thin 2-parameter wrapper around find_next_bit_wrap().
> 
> Where it's possible to use for_each_cpu_wrap() iterator, the code is
> switched to use it because it's always preferable to use iterators over
> open loops.
> 
> This series touches various scattered subsystems and To-list for the
> whole series is quite a long. To minimize noise, I send cover-letter and
> key patches #5 and 6 to every person involved. All other patches are sent
> individually to those pointed by scripts/get_maintainers.pl.
> 
> I'd like to move the series with my bitmap-for-next branch as a whole.


virtio-net changes are straight-forward, so

Acked-by: Michael S. Tsirkin <mst@redhat.com>


> v1: https://lore.kernel.org/netdev/20241228184949.31582-1-yury.norov@gmail.com/T/
> v2:
>  - rebase on top of today's origin/master;
>  - drop #v1-10: not needed since v6.14 @ Sagi Grinberg;
>  - #2, #3: fix picking next unused CPU @ Nick Child;
>  - fix typos, cleanup comments @ Bjorn Helgaas, Alexander Gordeev;
>  - CC Christoph Hellwig for the whole series.
> 
> Yury Norov (13):
>   objpool: rework objpool_pop()
>   virtio_net: simplify virtnet_set_affinity()
>   ibmvnic: simplify ibmvnic_set_queue_affinity()
>   powerpc/xmon: simplify xmon_batch_next_cpu()
>   cpumask: deprecate cpumask_next_wrap()
>   cpumask: re-introduce cpumask_next{,_and}_wrap()
>   cpumask: use cpumask_next_wrap() where appropriate
>   padata: switch padata_find_next() to using cpumask_next_wrap()
>   s390: switch stop_machine_yield() to using cpumask_next_wrap()
>   scsi: lpfc: switch lpfc_irq_rebalance() to using cpumask_next_wrap()
>   scsi: lpfc: rework lpfc_next_{online,present}_cpu()
>   PCI: hv: Switch hv_compose_multi_msi_req_get_cpu() to using
>     cpumask_next_wrap()
>   cpumask: drop cpumask_next_wrap_old()
> 
>  arch/powerpc/xmon/xmon.c            |  6 +--
>  arch/s390/kernel/processor.c        |  2 +-
>  drivers/net/ethernet/ibm/ibmvnic.c  | 18 +++++---
>  drivers/net/virtio_net.c            | 12 ++---
>  drivers/pci/controller/pci-hyperv.c |  3 +-
>  drivers/scsi/lpfc/lpfc.h            | 23 +++-------
>  drivers/scsi/lpfc/lpfc_init.c       |  2 +-
>  include/linux/cpumask.h             | 69 ++++++++++++++++++++---------
>  include/linux/objpool.h             |  7 ++-
>  kernel/padata.c                     |  2 +-
>  lib/cpumask.c                       | 37 +---------------
>  11 files changed, 81 insertions(+), 100 deletions(-)
> 
> -- 
> 2.43.0


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

end of thread, other threads:[~2025-02-24 21:19 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-28 16:46 [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Yury Norov
2025-01-28 16:46 ` [PATCH v2 01/13] objpool: rework objpool_pop() Yury Norov
2025-01-28 16:46 ` [PATCH v2 02/13] virtio_net: simplify virtnet_set_affinity() Yury Norov
2025-02-05 23:00   ` Nick Child
2025-02-11 13:55     ` Yury Norov
2025-01-28 16:46 ` [PATCH v2 03/13] ibmvnic: simplify ibmvnic_set_queue_affinity() Yury Norov
2025-02-05 23:10   ` Nick Child
2025-01-28 16:46 ` [PATCH v2 04/13] powerpc/xmon: simplify xmon_batch_next_cpu() Yury Norov
2025-01-28 16:46 ` [PATCH v2 05/13] cpumask: deprecate cpumask_next_wrap() Yury Norov
2025-01-28 16:46 ` [PATCH v2 06/13] cpumask: re-introduce cpumask_next{,_and}_wrap() Yury Norov
2025-01-28 16:46 ` [PATCH v2 07/13] cpumask: use cpumask_next_wrap() where appropriate Yury Norov
2025-01-28 16:46 ` [PATCH v2 08/13] padata: switch padata_find_next() to using cpumask_next_wrap() Yury Norov
2025-01-28 16:46 ` [PATCH v2 09/13] s390: switch stop_machine_yield() " Yury Norov
2025-01-28 16:46 ` Yury Norov
2025-01-28 16:46 ` [PATCH v2 11/13] scsi: lpfc: rework lpfc_next_{online,present}_cpu() Yury Norov
2025-01-28 16:46 ` [PATCH v2 12/13] PCI: hv: Switch hv_compose_multi_msi_req_get_cpu() to using cpumask_next_wrap() Yury Norov
2025-01-28 16:46 ` [PATCH v2 13/13] cpumask: drop cpumask_next_wrap_old() Yury Norov
2025-02-24 21:18 ` [PATCH v2 00/13] cpumask: cleanup cpumask_next_wrap() implementation and usage Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.