Deleted Added
full compact
kern_synch.c (135295) kern_synch.c (136152)
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 135295 2004-09-16 07:12:59Z julian $");
38__FBSDID("$FreeBSD: head/sys/kern/kern_synch.c 136152 2004-10-05 18:51:11Z jhb $");
39
40#include "opt_ktrace.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/condvar.h>
45#include <sys/kdb.h>
46#include <sys/kernel.h>

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

297 else
298 p->p_stats->p_ru.ru_nivcsw++;
299
300 /*
301 * Compute the amount of time during which the current
302 * process was running, and add that to its total so far.
303 */
304 binuptime(&new_switchtime);
39
40#include "opt_ktrace.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/condvar.h>
45#include <sys/kdb.h>
46#include <sys/kernel.h>

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

297 else
298 p->p_stats->p_ru.ru_nivcsw++;
299
300 /*
301 * Compute the amount of time during which the current
302 * process was running, and add that to its total so far.
303 */
304 binuptime(&new_switchtime);
305 bintime_add(&p->p_runtime, &new_switchtime);
306 bintime_sub(&p->p_runtime, PCPU_PTR(switchtime));
305 bintime_add(&p->p_rux.rux_runtime, &new_switchtime);
306 bintime_sub(&p->p_rux.rux_runtime, PCPU_PTR(switchtime));
307
308 td->td_generation++; /* bump preempt-detect counter */
309
310 /*
311 * Don't perform context switches from the debugger.
312 */
313 if (kdb_active) {
314 mtx_unlock_spin(&sched_lock);
315 kdb_backtrace();
316 kdb_reenter();
317 panic("%s: did not reenter debugger", __func__);
318 }
319
320 /*
321 * Check if the process exceeds its cpu resource allocation. If
322 * over max, arrange to kill the process in ast().
323 */
324 if (p->p_cpulimit != RLIM_INFINITY &&
307
308 td->td_generation++; /* bump preempt-detect counter */
309
310 /*
311 * Don't perform context switches from the debugger.
312 */
313 if (kdb_active) {
314 mtx_unlock_spin(&sched_lock);
315 kdb_backtrace();
316 kdb_reenter();
317 panic("%s: did not reenter debugger", __func__);
318 }
319
320 /*
321 * Check if the process exceeds its cpu resource allocation. If
322 * over max, arrange to kill the process in ast().
323 */
324 if (p->p_cpulimit != RLIM_INFINITY &&
325 p->p_runtime.sec > p->p_cpulimit) {
325 p->p_rux.rux_runtime.sec > p->p_cpulimit) {
326 p->p_sflag |= PS_XCPU;
327 td->td_flags |= TDF_ASTPENDING;
328 }
329
330 /*
331 * Finish up stats for outgoing thread.
332 */
333 cnt.v_swtch++;

--- 136 unchanged lines hidden ---
326 p->p_sflag |= PS_XCPU;
327 td->td_flags |= TDF_ASTPENDING;
328 }
329
330 /*
331 * Finish up stats for outgoing thread.
332 */
333 cnt.v_swtch++;

--- 136 unchanged lines hidden ---