Module Name: src
Committed By: matt
Date: Wed Jun 29 06:22:21 UTC 2011
Modified Files:
src/sys/kern: kern_cpu.c
Log Message:
Add the new ci to cpu_infos *before* calling routines which may want to
cpu_lookup.
To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/kern/kern_cpu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.46 src/sys/kern/kern_cpu.c:1.47
--- src/sys/kern/kern_cpu.c:1.46 Fri May 13 22:16:43 2011
+++ src/sys/kern/kern_cpu.c Wed Jun 29 06:22:21 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_cpu.c,v 1.46 2011/05/13 22:16:43 rmind Exp $ */
+/* $NetBSD: kern_cpu.c,v 1.47 2011/06/29 06:22:21 matt Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.46 2011/05/13 22:16:43 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.47 2011/06/29 06:22:21 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -128,6 +128,12 @@
snprintf(ci->ci_data.cpu_name, sizeof(ci->ci_data.cpu_name), "cpu%d",
cpu_index(ci));
+ if (__predict_false(cpu_infos == NULL)) {
+ cpu_infos =
+ kmem_zalloc(sizeof(cpu_infos[0]) * maxcpus, KM_SLEEP);
+ }
+ cpu_infos[cpu_index(ci)] = ci;
+
sched_cpuattach(ci);
error = create_idle_lwp(ci);
@@ -152,12 +158,6 @@
ncpu++;
ncpuonline++;
- if (cpu_infos == NULL) {
- cpu_infos =
- kmem_zalloc(sizeof(cpu_infos[0]) * maxcpus, KM_SLEEP);
- }
- cpu_infos[cpu_index(ci)] = ci;
-
return 0;
}