summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbmilekic <bmilekic@FreeBSD.org>2001-08-01 00:54:00 +0000
committerbmilekic <bmilekic@FreeBSD.org>2001-08-01 00:54:00 +0000
commitcceec8d18104db04cf807557e3517e2bc2437b10 (patch)
treefa9602c0beb285a314576d66bdf34ad353843bfb /sys
parentdb46728f2172e9e63dbc37889c7790f445a40910 (diff)
downloadFreeBSD-src-cceec8d18104db04cf807557e3517e2bc2437b10.zip
FreeBSD-src-cceec8d18104db04cf807557e3517e2bc2437b10.tar.gz
Move CPU_ABSENT() macro to smp.h, where it belongs anyway. It will be
defined to 0 in the non-SMP case, which very much makes sense as it permits its usage in per-CPU initialization loops (for an example, check out subr_mbuf.c). Further, on a UP system, make mb_alloc always use the first per-CPU container, regardless of cpuid (i.e. remove reliability on cpuid in the UP case). Requested by: alfred
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_mbuf.c19
-rw-r--r--sys/sys/smp.h10
2 files changed, 13 insertions, 16 deletions
diff --git a/sys/kern/subr_mbuf.c b/sys/kern/subr_mbuf.c
index 72d07d8..30efab8 100644
--- a/sys/kern/subr_mbuf.c
+++ b/sys/kern/subr_mbuf.c
@@ -62,21 +62,6 @@
#endif
/*
- * Macros allowing us to determine whether or not a given CPU's container
- * should be configured during mb_init().
- * XXX: Eventually we may want to provide hooks for CPU spinon/spinoff that
- * will allow us to configure the containers on spinon/spinoff. As it
- * stands, booting with CPU x disactivated and activating CPU x only
- * after bootup will lead to disaster and CPU x's container will be
- * uninitialized.
- */
-#ifdef SMP
-#define CPU_ABSENT(x) ((all_cpus & (1 << x)) == 0)
-#else
-#define CPU_ABSENT(x) 0
-#endif
-
-/*
* The mbuf allocator is heavily based on Alfred Perlstein's
* (alfred@FreeBSD.org) "memcache" allocator which is itself based
* on concepts from several per-CPU memory allocators. The difference
@@ -213,7 +198,11 @@ struct mtx mbuf_gen, mbuf_pcpu[NCPU];
/*
* Local macros for internal allocator structure manipulations.
*/
+#ifdef SMP
#define MB_GET_PCPU_LIST(mb_lst) (mb_lst)->ml_cntlst[PCPU_GET(cpuid)]
+#else
+#define MB_GET_PCPU_LIST(mb_lst) (mb_lst)->ml_cntlst[0]
+#endif
#define MB_GET_PCPU_LIST_NUM(mb_lst, num) (mb_lst)->ml_cntlst[(num)]
diff --git a/sys/sys/smp.h b/sys/sys/smp.h
index c608f96..1245fd4 100644
--- a/sys/sys/smp.h
+++ b/sys/sys/smp.h
@@ -28,6 +28,13 @@ extern volatile u_int started_cpus;
extern volatile u_int stopped_cpus;
/*
+ * Macro allowing us to determine whether a CPU is absent at any given
+ * time, thus permitting us to configure sparse maps of cpuid-dependent
+ * (per-CPU) structures.
+ */
+#define CPU_ABSENT(x_cpu) ((all_cpus & (1 << (x_cpu))) == 0)
+
+/*
* Machine dependent functions used to initialize MP support.
*
* The cpu_mp_probe() should check to see if MP support is present and return
@@ -54,7 +61,8 @@ void smp_rendezvous(void (*)(void *),
void (*)(void *),
void (*)(void *),
void *arg);
-
+#else /* SMP */
+#define CPU_ABSENT(x_cpu) (0)
#endif /* SMP */
#endif /* !LOCORE */
#endif /* _KERNEL */
OpenPOWER on IntegriCloud