| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: kern_clock.c,v 1.125 2008/07/02 19:38:37 rmind Exp $ */ | | 1 | /* $NetBSD: kern_clock.c,v 1.126 2008/10/05 21:57:20 pooka Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2000, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2000, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center. | | 9 | * NASA Ames Research Center. |
10 | * This code is derived from software contributed to The NetBSD Foundation | | 10 | * This code is derived from software contributed to The NetBSD Foundation |
11 | * by Charles M. Hannum. | | 11 | * by Charles M. Hannum. |
12 | * | | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | | 13 | * Redistribution and use in source and binary forms, with or without |
14 | * modification, are permitted provided that the following conditions | | 14 | * modification, are permitted provided that the following conditions |
| @@ -59,27 +59,27 @@ | | | @@ -59,27 +59,27 @@ |
59 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 59 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 60 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
61 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 61 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
62 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 62 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
63 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 63 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
64 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 64 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
65 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 65 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
66 | * SUCH DAMAGE. | | 66 | * SUCH DAMAGE. |
67 | * | | 67 | * |
68 | * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 | | 68 | * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 |
69 | */ | | 69 | */ |
70 | | | 70 | |
71 | #include <sys/cdefs.h> | | 71 | #include <sys/cdefs.h> |
72 | __KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.125 2008/07/02 19:38:37 rmind Exp $"); | | 72 | __KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.126 2008/10/05 21:57:20 pooka Exp $"); |
73 | | | 73 | |
74 | #include "opt_ntp.h" | | 74 | #include "opt_ntp.h" |
75 | #include "opt_perfctrs.h" | | 75 | #include "opt_perfctrs.h" |
76 | | | 76 | |
77 | #include <sys/param.h> | | 77 | #include <sys/param.h> |
78 | #include <sys/systm.h> | | 78 | #include <sys/systm.h> |
79 | #include <sys/callout.h> | | 79 | #include <sys/callout.h> |
80 | #include <sys/kernel.h> | | 80 | #include <sys/kernel.h> |
81 | #include <sys/proc.h> | | 81 | #include <sys/proc.h> |
82 | #include <sys/resourcevar.h> | | 82 | #include <sys/resourcevar.h> |
83 | #include <sys/signalvar.h> | | 83 | #include <sys/signalvar.h> |
84 | #include <sys/sysctl.h> | | 84 | #include <sys/sysctl.h> |
85 | #include <sys/timex.h> | | 85 | #include <sys/timex.h> |
| @@ -214,29 +214,27 @@ hardclock(struct clockframe *frame) | | | @@ -214,29 +214,27 @@ hardclock(struct clockframe *frame) |
214 | schedclock(l); | | 214 | schedclock(l); |
215 | ci->ci_schedstate.spc_schedticks = hardscheddiv; | | 215 | ci->ci_schedstate.spc_schedticks = hardscheddiv; |
216 | } | | 216 | } |
217 | } | | 217 | } |
218 | if ((--ci->ci_schedstate.spc_ticks) <= 0) | | 218 | if ((--ci->ci_schedstate.spc_ticks) <= 0) |
219 | sched_tick(ci); | | 219 | sched_tick(ci); |
220 | | | 220 | |
221 | if (CPU_IS_PRIMARY(ci)) { | | 221 | if (CPU_IS_PRIMARY(ci)) { |
222 | hardclock_ticks++; | | 222 | hardclock_ticks++; |
223 | tc_ticktock(); | | 223 | tc_ticktock(); |
224 | } | | 224 | } |
225 | | | 225 | |
226 | /* | | 226 | /* |
227 | * Update real-time timeout queue. Callouts are processed at a | | 227 | * Update real-time timeout queue. |
228 | * very low CPU priority, so we don't keep the relatively high | | | |
229 | * clock interrupt priority any longer than necessary. | | | |
230 | */ | | 228 | */ |
231 | callout_hardclock(); | | 229 | callout_hardclock(); |
232 | } | | 230 | } |
233 | | | 231 | |
234 | /* | | 232 | /* |
235 | * Start profiling on a process. | | 233 | * Start profiling on a process. |
236 | * | | 234 | * |
237 | * Kernel profiling passes proc0 which never exits and hence | | 235 | * Kernel profiling passes proc0 which never exits and hence |
238 | * keeps the profile clock running constantly. | | 236 | * keeps the profile clock running constantly. |
239 | */ | | 237 | */ |
240 | void | | 238 | void |
241 | startprofclock(struct proc *p) | | 239 | startprofclock(struct proc *p) |
242 | { | | 240 | { |