Commit a4ee891b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'bitmap-6.0-rc2' of https://github.com/norov/linux

Pull bitmap updates from Yury Norov:
 "cpumask: UP optimisation fixes follow-up

  As an older version of the UP optimisation fixes was merged, not all
  review feedback has been implemented.

  This implements the feedback received on the merged version [1], and
  the respin [2], for changes related to <linux/cpumask.h> and
  lib/cpumask.c"

Link: https://lore.kernel.org/lkml/cover.1656777646.git.sander@svanheule.net/ [1]
Link: https://lore.kernel.org/lkml/cover.1659077534.git.sander@svanheule.net/ [2]

It spent for more than a week with no issues.

* tag 'bitmap-6.0-rc2' of https://github.com/norov/linux:
  lib/cpumask: drop always-true preprocessor guard
  lib/cpumask: add inline cpumask_next_wrap() for UP
  cpumask: align signatures of UP implementations
parents 88e0a749 61b123ff
Loading
Loading
Loading
Loading
+23 −3
Original line number Diff line number Diff line
@@ -202,12 +202,13 @@ static inline unsigned int cpumask_local_spread(unsigned int i, int node)
	return 0;
}

static inline int cpumask_any_and_distribute(const struct cpumask *src1p,
					     const struct cpumask *src2p) {
static inline unsigned int cpumask_any_and_distribute(const struct cpumask *src1p,
						      const struct cpumask *src2p)
{
	return cpumask_first_and(src1p, src2p);
}

static inline int cpumask_any_distribute(const struct cpumask *srcp)
static inline unsigned int cpumask_any_distribute(const struct cpumask *srcp)
{
	return cpumask_first(srcp);
}
@@ -261,7 +262,26 @@ unsigned int cpumask_next_and(int n, const struct cpumask *src1p,
		(cpu) = cpumask_next_zero((cpu), (mask)),	\
		(cpu) < nr_cpu_ids;)

#if NR_CPUS == 1
static inline
unsigned int cpumask_next_wrap(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(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
+2 −1
Original line number Diff line number Diff line
@@ -34,9 +34,10 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
	 is_single_threaded.o plist.o decompress.o kobject_uevent.o \
	 earlycpio.o seq_buf.o siphash.o dec_and_lock.o \
	 nmi_backtrace.o win_minmax.o memcat_p.o \
	 buildid.o cpumask.o
	 buildid.o

lib-$(CONFIG_PRINTK) += dump_stack.o
lib-$(CONFIG_SMP) += cpumask.o

lib-y	+= kobject.o klist.o
obj-y	+= lockref.o
+0 −2
Original line number Diff line number Diff line
@@ -109,7 +109,6 @@ void __init free_bootmem_cpumask_var(cpumask_var_t mask)
}
#endif

#if NR_CPUS > 1
/**
 * cpumask_local_spread - select the i'th cpu with local numa cpu's first
 * @i: index number
@@ -197,4 +196,3 @@ unsigned int cpumask_any_distribute(const struct cpumask *srcp)
	return next;
}
EXPORT_SYMBOL(cpumask_any_distribute);
#endif /* NR_CPUS */