summaryrefslogtreecommitdiff
path: root/sys/kern/kern_xxx.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2009-04-03 09:30:16 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2009-04-03 09:30:16 +0000
commit70411cf63903f9756f566a59c36c13284cd44715 (patch)
tree90b98e9fdc7fc7d754b995c41a89c979e0efd76c /sys/kern/kern_xxx.c
parente4df77f03a368ba0deaac527960a8bab6cef77c1 (diff)
Make sure that sys_reboot runs on the primary cpu. Won't hurt when not
needed, but some machines seem to work much better with it.
Diffstat (limited to 'sys/kern/kern_xxx.c')
-rw-r--r--sys/kern/kern_xxx.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c
index 899a5e7a163..783aa5825dc 100644
--- a/sys/kern/kern_xxx.c
+++ b/sys/kern/kern_xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_xxx.c,v 1.10 2005/11/28 00:14:29 jsg Exp $ */
+/* $OpenBSD: kern_xxx.c,v 1.11 2009/04/03 09:30:15 art Exp $ */
/* $NetBSD: kern_xxx.c,v 1.32 1996/04/22 01:38:41 christos Exp $ */
/*
@@ -49,11 +49,27 @@ sys_reboot(struct proc *p, void *v, register_t *retval)
struct sys_reboot_args /* {
syscallarg(int) opt;
} */ *uap = v;
+ CPU_INFO_ITERATOR cii;
+ struct cpu_info *ci;
int error;
if ((error = suser(p, 0)) != 0)
return (error);
+
+ /*
+ * Make sure this thread only runs on the primary cpu.
+ */
+ CPU_INFO_FOREACH(cii, ci) {
+ if (CPU_IS_PRIMARY(ci)) {
+ sched_peg_curproc(ci);
+ break;
+ }
+ }
+
boot(SCARG(uap, opt));
+
+ atomic_clearbits_int(&p->p_flag, P_CPUPEG); /* XXX */
+
return (0);
}