Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Add the new ci to cpu_infos *before* calling routin...
details: https://anonhg.NetBSD.org/src/rev/cd013c798ec2
branches: trunk
changeset: 766657:cd013c798ec2
user: matt <matt%NetBSD.org@localhost>
date: Wed Jun 29 06:22:21 2011 +0000
description:
Add the new ci to cpu_infos *before* calling routines which may want to
cpu_lookup.
diffstat:
sys/kern/kern_cpu.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diffs (44 lines):
diff -r d8163ff3594d -r cd013c798ec2 sys/kern/kern_cpu.c
--- a/sys/kern/kern_cpu.c Wed Jun 29 06:21:16 2011 +0000
+++ b/sys/kern/kern_cpu.c Wed Jun 29 06:22:21 2011 +0000
@@ -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;
}
Home |
Main Index |
Thread Index |
Old Index