Commit 2f2d5294 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'bitmap-for-6.15' of https://github.com/norov/linux

Pull bitmap updates from Yury Norov:

 - cpumask_next_wrap() rework (me)

 - GENMASK() simplification (I Hsin)

 - rust bindings for cpumasks (Viresh and me)

 - scattered cleanups (Andy, Tamir, Vincent, Ignacio and Joel)

* tag 'bitmap-for-6.15' of https://github.com/norov/linux: (22 commits)
  cpumask: align text in comment
  riscv: fix test_and_{set,clear}_bit ordering documentation
  treewide: fix typo 'unsigned __init128' -> 'unsigned __int128'
  MAINTAINERS: add rust bindings entry for bitmap API
  rust: Add cpumask helpers
  uapi: Revert "bitops: avoid integer overflow in GENMASK(_ULL)"
  cpumask: drop cpumask_next_wrap_old()
  PCI: hv: Switch hv_compose_multi_msi_req_get_cpu() to using cpumask_next_wrap()
  scsi: lpfc: rework lpfc_next_{online,present}_cpu()
  scsi: lpfc: switch lpfc_irq_rebalance() to using cpumask_next_wrap()
  s390: switch stop_machine_yield() to using cpumask_next_wrap()
  padata: switch padata_find_next() to using cpumask_next_wrap()
  cpumask: use cpumask_next_wrap() where appropriate
  cpumask: re-introduce cpumask_next{,_and}_wrap()
  cpumask: deprecate cpumask_next_wrap()
  powerpc/xmon: simplify xmon_batch_next_cpu()
  ibmvnic: simplify ibmvnic_set_queue_affinity()
  virtio_net: simplify virtnet_set_affinity()
  objpool: rework objpool_pop()
  cpumask: add for_each_{possible,online}_cpu_wrap
  ...
parents f81c2b81 1cf8e152
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -4026,6 +4026,11 @@ F: tools/include/vdso/bits.h
F:	tools/lib/bitmap.c
F:	tools/lib/find_bit.c
BITMAP API BINDINGS [RUST]
M:	Yury Norov <yury.norov@gmail.com>
S:	Maintained
F:	rust/helpers/cpumask.c
BITOPS API
M:	Yury Norov <yury.norov@gmail.com>
R:	Rasmus Villemoes <linux@rasmusvillemoes.dk>
+1 −5
Original line number Diff line number Diff line
@@ -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 −2
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ static __always_inline int variable_fls(unsigned int x)
 * @nr: Bit to set
 * @addr: Address to count from
 *
 * This operation may be reordered on other architectures than x86.
 * This is an atomic fully-ordered operation (implied full memory barrier).
 */
static __always_inline int arch_test_and_set_bit(int nr, volatile unsigned long *addr)
{
@@ -238,7 +238,7 @@ static __always_inline int arch_test_and_set_bit(int nr, volatile unsigned long
 * @nr: Bit to clear
 * @addr: Address to count from
 *
 * This operation can be reordered on other architectures other than x86.
 * This is an atomic fully-ordered operation (implied full memory barrier).
 */
static __always_inline int arch_test_and_clear_bit(int nr, volatile unsigned long *addr)
{
+1 −1
Original line number Diff line number Diff line
@@ -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(this_cpu, cpumask);
		if (cpu >= nr_cpu_ids)
			return;
		if (arch_vcpu_is_preempted(cpu))
+11 −7
Original line number Diff line number Diff line
@@ -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;
Loading