summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2002-03-05 10:01:46 +0000
committerjeff <jeff@FreeBSD.org>2002-03-05 10:01:46 +0000
commitf25b3f9f5bc7c1b9dfb66f6fed8206e79613db7f (patch)
treeba2760ce8aec950f5fe901410d365bfcedef9dfd /sys/kern
parent9efc11065b8c97c4d238abf06c92522301113cf3 (diff)
downloadFreeBSD-src-f25b3f9f5bc7c1b9dfb66f6fed8206e79613db7f.zip
FreeBSD-src-f25b3f9f5bc7c1b9dfb66f6fed8206e79613db7f.tar.gz
Add a new variable mp_maxid. This is used so that per cpu datastructures may
be allocated as arrays indexed by the cpu id. Previously the only reliable way to know the max cpu id was through MAXCPU. mp_ncpus isn't useful here because cpu ids may be sparsely mapped, although x86 and alpha do not do this. Also, call cpu_mp_probe much earlier so the max cpu id is known before the VM starts up. This is intended to help support per cpu queues for the new allocator, but may be useful elsewhere. Reviewed by: jake Approved by: jake
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_smp.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 2734f7e..1d90fe8 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -53,6 +53,7 @@ int mp_ncpus;
volatile int smp_started;
u_int all_cpus;
+u_int mp_maxid;
SYSCTL_NODE(_kern, OID_AUTO, smp, CTLFLAG_RD, NULL, "Kernel SMP");
@@ -79,16 +80,27 @@ static void (*smp_rv_teardown_func)(void *arg);
static void *smp_rv_func_arg;
static volatile int smp_rv_waiters[2];
static struct mtx smp_rv_mtx;
+static int mp_probe_status;
/*
- * Initialize MI SMP variables and call the MD SMP initialization code.
+ * Initialize MI SMP variables.
+ */
+static void
+mp_probe(void *dummy)
+{
+ mp_probe_status = cpu_mp_probe();
+}
+SYSINIT(cpu_mp_probe, SI_SUB_TUNABLES, SI_ORDER_FIRST, mp_probe, NULL);
+
+/*
+ * Call the MD SMP initialization code.
*/
static void
mp_start(void *dummy)
{
/* Probe for MP hardware. */
- if (cpu_mp_probe() == 0)
+ if (mp_probe_status == 0)
return;
mtx_init(&smp_rv_mtx, "smp rendezvous", MTX_SPIN);
OpenPOWER on IntegriCloud