Deleted Added
full compact
kern_synch.c (131473) kern_synch.c (131481)
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95
35 */
36
37#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/kern_synch.c 131473 2004-07-02 19:09:50Z jhb $");
38__FBSDID("$FreeBSD: head/sys/kern/kern_synch.c 131481 2004-07-02 20:21:44Z jhb $");
39
40#include "opt_ddb.h"
41#include "opt_ktrace.h"
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/condvar.h>
46#include <sys/kernel.h>

--- 247 unchanged lines hidden (view full) ---

294 mtx_assert(&sched_lock, MA_OWNED | MA_NOTRECURSED);
295 td = curthread; /* XXX */
296 p = td->td_proc; /* XXX */
297 KASSERT(!TD_ON_RUNQ(td), ("mi_switch: called by old code"));
298#ifdef INVARIANTS
299 if (!TD_ON_LOCK(td) && !TD_IS_RUNNING(td))
300 mtx_assert(&Giant, MA_NOTOWNED);
301#endif
39
40#include "opt_ddb.h"
41#include "opt_ktrace.h"
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/condvar.h>
46#include <sys/kernel.h>

--- 247 unchanged lines hidden (view full) ---

294 mtx_assert(&sched_lock, MA_OWNED | MA_NOTRECURSED);
295 td = curthread; /* XXX */
296 p = td->td_proc; /* XXX */
297 KASSERT(!TD_ON_RUNQ(td), ("mi_switch: called by old code"));
298#ifdef INVARIANTS
299 if (!TD_ON_LOCK(td) && !TD_IS_RUNNING(td))
300 mtx_assert(&Giant, MA_NOTOWNED);
301#endif
302 KASSERT(td->td_critnest == 1,
302 KASSERT(td->td_critnest == 1 || (td->td_critnest == 2 &&
303 (td->td_flags & TDF_OWEPREEMPT) != 0 && (flags & SW_INVOL) != 0 &&
304 newtd == NULL),
303 ("mi_switch: switch in a critical section"));
304 KASSERT((flags & (SW_INVOL | SW_VOL)) != 0,
305 ("mi_switch: switch must be voluntary or involuntary"));
306
307 if (flags & SW_VOL)
308 p->p_stats->p_ru.ru_nvcsw++;
309 else
310 p->p_stats->p_ru.ru_nivcsw++;
305 ("mi_switch: switch in a critical section"));
306 KASSERT((flags & (SW_INVOL | SW_VOL)) != 0,
307 ("mi_switch: switch must be voluntary or involuntary"));
308
309 if (flags & SW_VOL)
310 p->p_stats->p_ru.ru_nvcsw++;
311 else
312 p->p_stats->p_ru.ru_nivcsw++;
313
311 /*
312 * Compute the amount of time during which the current
313 * process was running, and add that to its total so far.
314 */
315 binuptime(&new_switchtime);
316 bintime_add(&p->p_runtime, &new_switchtime);
317 bintime_sub(&p->p_runtime, PCPU_PTR(switchtime));
318

--- 157 unchanged lines hidden ---
314 /*
315 * Compute the amount of time during which the current
316 * process was running, and add that to its total so far.
317 */
318 binuptime(&new_switchtime);
319 bintime_add(&p->p_runtime, &new_switchtime);
320 bintime_sub(&p->p_runtime, PCPU_PTR(switchtime));
321

--- 157 unchanged lines hidden ---