sched_4bsd.c (171488) | sched_4bsd.c (172207) |
---|---|
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. --- 19 unchanged lines hidden (view full) --- 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 35#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. --- 19 unchanged lines hidden (view full) --- 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/kern/sched_4bsd.c 171488 2007-07-18 20:46:06Z jeff $"); | 36__FBSDID("$FreeBSD: head/sys/kern/sched_4bsd.c 172207 2007-09-17 05:31:39Z jeff $"); |
37 38#include "opt_hwpmc_hooks.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> 43#include <sys/ktr.h> 44#include <sys/lock.h> --- 1036 unchanged lines hidden (view full) --- 1081 int single_cpu = 0; 1082 1083 ts = td->td_sched; 1084 THREAD_LOCK_ASSERT(td, MA_OWNED); 1085 KASSERT((td->td_inhibitors == 0), 1086 ("sched_add: trying to run inhibited thread")); 1087 KASSERT((TD_CAN_RUN(td) || TD_IS_RUNNING(td)), 1088 ("sched_add: bad thread state")); | 37 38#include "opt_hwpmc_hooks.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> 43#include <sys/ktr.h> 44#include <sys/lock.h> --- 1036 unchanged lines hidden (view full) --- 1081 int single_cpu = 0; 1082 1083 ts = td->td_sched; 1084 THREAD_LOCK_ASSERT(td, MA_OWNED); 1085 KASSERT((td->td_inhibitors == 0), 1086 ("sched_add: trying to run inhibited thread")); 1087 KASSERT((TD_CAN_RUN(td) || TD_IS_RUNNING(td)), 1088 ("sched_add: bad thread state")); |
1089 KASSERT(td->td_proc->p_sflag & PS_INMEM, 1090 ("sched_add: process swapped out")); | 1089 KASSERT(td->td_flags & TDF_INMEM, 1090 ("sched_add: thread swapped out")); |
1091 CTR5(KTR_SCHED, "sched_add: %p(%s) prio %d by %p(%s)", 1092 td, td->td_proc->p_comm, td->td_priority, curthread, 1093 curthread->td_proc->p_comm); 1094 /* 1095 * Now that the thread is moving to the run-queue, set the lock 1096 * to the scheduler's lock. 1097 */ 1098 if (td->td_lock != &sched_lock) { --- 51 unchanged lines hidden (view full) --- 1150{ 1151 struct td_sched *ts; 1152 ts = td->td_sched; 1153 THREAD_LOCK_ASSERT(td, MA_OWNED); 1154 KASSERT((td->td_inhibitors == 0), 1155 ("sched_add: trying to run inhibited thread")); 1156 KASSERT((TD_CAN_RUN(td) || TD_IS_RUNNING(td)), 1157 ("sched_add: bad thread state")); | 1091 CTR5(KTR_SCHED, "sched_add: %p(%s) prio %d by %p(%s)", 1092 td, td->td_proc->p_comm, td->td_priority, curthread, 1093 curthread->td_proc->p_comm); 1094 /* 1095 * Now that the thread is moving to the run-queue, set the lock 1096 * to the scheduler's lock. 1097 */ 1098 if (td->td_lock != &sched_lock) { --- 51 unchanged lines hidden (view full) --- 1150{ 1151 struct td_sched *ts; 1152 ts = td->td_sched; 1153 THREAD_LOCK_ASSERT(td, MA_OWNED); 1154 KASSERT((td->td_inhibitors == 0), 1155 ("sched_add: trying to run inhibited thread")); 1156 KASSERT((TD_CAN_RUN(td) || TD_IS_RUNNING(td)), 1157 ("sched_add: bad thread state")); |
1158 KASSERT(td->td_proc->p_sflag & PS_INMEM, 1159 ("sched_add: process swapped out")); | 1158 KASSERT(td->td_flags & TDF_INMEM, 1159 ("sched_add: thread swapped out")); |
1160 CTR5(KTR_SCHED, "sched_add: %p(%s) prio %d by %p(%s)", 1161 td, td->td_proc->p_comm, td->td_priority, curthread, 1162 curthread->td_proc->p_comm); 1163 /* 1164 * Now that the thread is moving to the run-queue, set the lock 1165 * to the scheduler's lock. 1166 */ 1167 if (td->td_lock != &sched_lock) { --- 27 unchanged lines hidden (view full) --- 1195#endif /* SMP */ 1196 1197void 1198sched_rem(struct thread *td) 1199{ 1200 struct td_sched *ts; 1201 1202 ts = td->td_sched; | 1160 CTR5(KTR_SCHED, "sched_add: %p(%s) prio %d by %p(%s)", 1161 td, td->td_proc->p_comm, td->td_priority, curthread, 1162 curthread->td_proc->p_comm); 1163 /* 1164 * Now that the thread is moving to the run-queue, set the lock 1165 * to the scheduler's lock. 1166 */ 1167 if (td->td_lock != &sched_lock) { --- 27 unchanged lines hidden (view full) --- 1195#endif /* SMP */ 1196 1197void 1198sched_rem(struct thread *td) 1199{ 1200 struct td_sched *ts; 1201 1202 ts = td->td_sched; |
1203 KASSERT(td->td_proc->p_sflag & PS_INMEM, 1204 ("sched_rem: process swapped out")); | 1203 KASSERT(td->td_flags & TDF_INMEM, 1204 ("sched_rem: thread swapped out")); |
1205 KASSERT(TD_ON_RUNQ(td), 1206 ("sched_rem: thread not on run queue")); 1207 mtx_assert(&sched_lock, MA_OWNED); 1208 CTR5(KTR_SCHED, "sched_rem: %p(%s) prio %d by %p(%s)", 1209 td, td->td_proc->p_comm, td->td_priority, curthread, 1210 curthread->td_proc->p_comm); 1211 1212 if ((td->td_proc->p_flag & P_NOLOAD) == 0) --- 35 unchanged lines hidden (view full) --- 1248 rq = &runq; 1249 ts = runq_choose(&runq); 1250#endif 1251 1252 if (ts) { 1253 runq_remove(rq, ts); 1254 ts->ts_flags |= TSF_DIDRUN; 1255 | 1205 KASSERT(TD_ON_RUNQ(td), 1206 ("sched_rem: thread not on run queue")); 1207 mtx_assert(&sched_lock, MA_OWNED); 1208 CTR5(KTR_SCHED, "sched_rem: %p(%s) prio %d by %p(%s)", 1209 td, td->td_proc->p_comm, td->td_priority, curthread, 1210 curthread->td_proc->p_comm); 1211 1212 if ((td->td_proc->p_flag & P_NOLOAD) == 0) --- 35 unchanged lines hidden (view full) --- 1248 rq = &runq; 1249 ts = runq_choose(&runq); 1250#endif 1251 1252 if (ts) { 1253 runq_remove(rq, ts); 1254 ts->ts_flags |= TSF_DIDRUN; 1255 |
1256 KASSERT(ts->ts_thread->td_proc->p_sflag & PS_INMEM, 1257 ("sched_choose: process swapped out")); | 1256 KASSERT(ts->ts_thread->td_flags & TDF_INMEM, 1257 ("sched_choose: thread swapped out")); |
1258 return (ts->ts_thread); 1259 } 1260 return (PCPU_GET(idlethread)); 1261} 1262 1263void 1264sched_userret(struct thread *td) 1265{ --- 163 unchanged lines hidden --- | 1258 return (ts->ts_thread); 1259 } 1260 return (PCPU_GET(idlethread)); 1261} 1262 1263void 1264sched_userret(struct thread *td) 1265{ --- 163 unchanged lines hidden --- |