Deleted Added
full compact
kern_synch.c (81482) kern_synch.c (81493)
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.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95
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.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95
39 * $FreeBSD: head/sys/kern/kern_synch.c 81482 2001-08-10 21:08:56Z jhb $
39 * $FreeBSD: head/sys/kern/kern_synch.c 81493 2001-08-10 22:53:32Z jhb $
40 */
41
42#include "opt_ktrace.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/condvar.h>
47#include <sys/kernel.h>

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

104 */
105void
106maybe_resched(p)
107 struct proc *p;
108{
109
110 mtx_assert(&sched_lock, MA_OWNED);
111 if (p->p_pri.pri_level < curproc->p_pri.pri_level)
40 */
41
42#include "opt_ktrace.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/condvar.h>
47#include <sys/kernel.h>

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

104 */
105void
106maybe_resched(p)
107 struct proc *p;
108{
109
110 mtx_assert(&sched_lock, MA_OWNED);
111 if (p->p_pri.pri_level < curproc->p_pri.pri_level)
112 need_resched(curproc);
112 curproc->p_sflag |= PS_NEEDRESCHED;
113}
114
115int
116roundrobin_interval(void)
117{
118 return (sched_quantum);
119}
120

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

697 cnt.v_swtch++;
698 PCPU_SET(switchtime, new_switchtime);
699 CTR3(KTR_PROC, "mi_switch: old proc %p (pid %d, %s)", p, p->p_pid,
700 p->p_comm);
701 sched_crit = sched_lock.mtx_savecrit;
702 sched_nest = sched_lock.mtx_recurse;
703 p->p_lastcpu = p->p_oncpu;
704 p->p_oncpu = NOCPU;
113}
114
115int
116roundrobin_interval(void)
117{
118 return (sched_quantum);
119}
120

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

697 cnt.v_swtch++;
698 PCPU_SET(switchtime, new_switchtime);
699 CTR3(KTR_PROC, "mi_switch: old proc %p (pid %d, %s)", p, p->p_pid,
700 p->p_comm);
701 sched_crit = sched_lock.mtx_savecrit;
702 sched_nest = sched_lock.mtx_recurse;
703 p->p_lastcpu = p->p_oncpu;
704 p->p_oncpu = NOCPU;
705 clear_resched(p);
705 p->p_sflag &= ~PS_NEEDRESCHED;
706 cpu_switch();
707 p->p_oncpu = PCPU_GET(cpuid);
708 sched_lock.mtx_savecrit = sched_crit;
709 sched_lock.mtx_recurse = sched_nest;
710 sched_lock.mtx_lock = (uintptr_t)p;
711 CTR3(KTR_PROC, "mi_switch: new proc %p (pid %d, %s)", p, p->p_pid,
712 p->p_comm);
713 if (PCPU_GET(switchtime.tv_sec) == 0)

--- 132 unchanged lines hidden ---
706 cpu_switch();
707 p->p_oncpu = PCPU_GET(cpuid);
708 sched_lock.mtx_savecrit = sched_crit;
709 sched_lock.mtx_recurse = sched_nest;
710 sched_lock.mtx_lock = (uintptr_t)p;
711 CTR3(KTR_PROC, "mi_switch: new proc %p (pid %d, %s)", p, p->p_pid,
712 p->p_comm);
713 if (PCPU_GET(switchtime.tv_sec) == 0)

--- 132 unchanged lines hidden ---