Skip to contentSkip to conversation

cpumask: make cpumask_next_wrap available without smp

PATCH Superseded Willem de Bruijn 1 participant 2 messages Aug 12, 2018

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpumask: make cpumask_next_wrap available without smp

From: Willem de Bruijn <[email protected]>

The kbuild robot shows build failure on machines without CONFIG_SMP:

drivers/net/virtio_net.c:1916:10: error:
implicit declaration of function 'cpumask_next_wrap'

cpumask_next_wrap is exported from lib/cpumask.o, which has

    lib-$(CONFIG_SMP) += cpumask.o

same as other functions, also define it as static inline in the NR_CPUS==1 branch in include/linux/cpumask.h.

If wrap is false, function wraps across the range of valid cpus, here [0]. If it is true, it returns nr_cpumask_bits, here 1.

Fixes 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")
---
 include/linux/cpumask.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/cpumask.h +6 -0
index 57f20a0a77949..c6d0967102fe3 100644
@@ -159,6 +159,12 @@ static inline unsigned int cpumask_next_and(int n,
 	return n+1;
 }
 
+static inline unsigned int cpumask_next_wrap(int n, const struct cpumask *mask,
+					     int start, bool wrap)
+{
+	return wrap;	/* cpu 0 unless stop on wrap, then nr_cpumask_bits */
+}
+
 /* cpu must be a valid cpu, ie 0, so there's no other choice. */
 static inline unsigned int cpumask_any_but(const struct cpumask *mask,
 					   unsigned int cpu)
Signature · 1 line
2.18.0.597.ga71716f1ad-goog
#1 lore raw
Quoted 12 lines · Willem de Bruijn

From: Willem de Bruijn <[email protected]>

The kbuild robot shows build failure on machines without CONFIG_SMP:

drivers/net/virtio_net.c:1916:10: error:
implicit declaration of function 'cpumask_next_wrap'

cpumask_next_wrap is exported from lib/cpumask.o, which has

    lib-$(CONFIG_SMP) += cpumask.o
Quoted 8 lines

same as other functions, also define it as static inline in the NR_CPUS==1 branch in include/linux/cpumask.h.

If wrap is false, function wraps across the range of valid cpus, here [0]. If it is true, it returns nr_cpumask_bits, here 1.

Fixes 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")

Sent too hastily. If wrap is true and n == -1, it should still return 0.

Will send a v2.