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 115084 2003-05-16 21:26:42Z marcel $ |
40 */ 41 42#include "opt_ddb.h" 43#include "opt_ktrace.h" 44#ifdef __i386__ 45#include "opt_swtch.h" 46#endif 47 --- 407 unchanged lines hidden (view full) --- 455/* 456 * The machine independent parts of mi_switch(). 457 */ 458void 459mi_switch(void) 460{ 461 struct bintime new_switchtime; 462 struct thread *td; |
463#if !defined(__alpha__) && !defined(__powerpc__) |
464 struct thread *newtd; 465#endif 466 struct proc *p; 467 u_int sched_nest; 468 469 mtx_assert(&sched_lock, MA_OWNED | MA_NOTRECURSED); 470 td = curthread; /* XXX */ 471 p = td->td_proc; /* XXX */ --- 41 unchanged lines hidden (view full) --- 513 PCPU_SET(switchtime, new_switchtime); 514 CTR3(KTR_PROC, "mi_switch: old thread %p (pid %d, %s)", td, p->p_pid, 515 p->p_comm); 516 sched_nest = sched_lock.mtx_recurse; 517 if (td->td_proc->p_flag & P_THREADED) 518 thread_switchout(td); 519 sched_switchout(td); 520 |
521#if !defined(__alpha__) && !defined(__powerpc__) |
522 newtd = choosethread(); 523 if (td != newtd) 524 cpu_switch(td, newtd); /* SHAZAM!! */ 525#ifdef SWTCH_OPTIM_STATS 526 else 527 stupid_switch++; 528#endif 529#else --- 162 unchanged lines hidden --- |