linux/arch/powerpc
Costa Shulyupin 6da1cab4f5 powerpc/xive: Use cpumask_intersects()
Replace `cpumask_any_and(a, b) >= nr_cpu_ids`
with the more readable `!cpumask_intersects(a, b)`.

Comparison between cpumask_any_and() and cpumask_intersects()

The cpumask_any_and() function expands using FIND_FIRST_BIT(),
resulting in a loop that iterates through each bit of the bitmask:

for (idx = 0; idx * BITS_PER_LONG < sz; idx++) {
	val = (FETCH);
	if (val) {
		sz = min(idx * BITS_PER_LONG + __ffs(MUNGE(val)), sz);
		break;
	}
}

The cpumask_intersects() function expands using __bitmap_intersects(),
resulting in that the first loop iterates through each long word of the bitmask,
and the second through each bit within a long word:

unsigned int k, lim = bits/BITS_PER_LONG;
for (k = 0; k < lim; ++k)
	if (bitmap1[k] & bitmap2[k])
		return true;

if (bits % BITS_PER_LONG)
	if ((bitmap1[k] & bitmap2[k]) & BITMAP_LAST_WORD_MASK(bits))
		return true;

Conclusion: cpumask_intersects() is at least as efficient as cpumask_any_and(),
if not more so, as it typically performs fewer loops and comparisons.

Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://patch.msgid.link/20240926092623.399577-2-costa.shul@redhat.com
2024-11-14 22:43:52 +11:00
..
boot powerpc/64: Remove maple platform 2024-10-29 23:01:52 +11:00
configs powerpc/64: Remove maple platform 2024-10-29 23:01:52 +11:00
crypto move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
include powerpc/sstep: make emulate_vsx_load and emulate_vsx_store static 2024-11-14 14:17:36 +11:00
kernel powerpc/vdso: Remove unused clockmode asm offsets 2024-11-14 12:31:02 +11:00
kexec powerpc updates for 6.11 2024-07-19 21:00:33 -07:00
kvm struct fd layout change (and conversion to accessor helpers) 2024-09-23 09:35:36 -07:00
lib powerpc/sstep: make emulate_vsx_load and emulate_vsx_store static 2024-11-14 14:17:36 +11:00
math-emu powerpc/math-emu: Inhibit W=1 warnings 2022-09-08 11:11:18 +10:00
mm book3s64/hash: Early detect debug_pagealloc size requirement 2024-10-23 18:53:20 +11:00
net powerpc64/bpf: Add support for bpf trampolines 2024-10-31 11:00:55 +11:00
perf powerpc/perf: Set cpumode flags using sample address 2024-06-17 22:47:16 +10:00
platforms powerpc/ep8248e: Use %pa to format resource_size_t 2024-11-14 22:26:40 +11:00
purgatory Makefile: remove redundant tool coverage variables 2024-05-14 23:35:48 +09:00
sysdev powerpc/xive: Use cpumask_intersects() 2024-11-14 22:43:52 +11:00
tools powerpc/ftrace: Fix ftrace bug with KASAN=y 2024-11-10 22:33:51 +11:00
xmon powerpc/xmon: symbol lookup length fixed 2024-11-14 22:36:14 +11:00
Kbuild powerpc64/ftrace: Move ftrace sequence out of line 2024-10-31 11:00:54 +11:00
Kconfig samples/ftrace: Add support for ftrace direct samples on powerpc 2024-10-31 11:00:55 +11:00
Kconfig.debug powerpc/64: Remove maple platform 2024-10-29 23:01:52 +11:00
Makefile powerpc/ftrace: Add support for DYNAMIC_FTRACE_WITH_CALL_OPS 2024-10-31 11:00:55 +11:00
Makefile.postlink powerpc/ftrace: Add a postlink script to validate function tracer 2024-10-31 11:00:54 +11:00