sched_ule.c (119137) | sched_ule.c (119488) |
---|---|
1/*- 2 * Copyright (c) 2002-2003, Jeffrey Roberson <jeff@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002-2003, Jeffrey Roberson <jeff@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/kern/sched_ule.c 119137 2003-08-19 17:51:11Z sam $"); | 28__FBSDID("$FreeBSD: head/sys/kern/sched_ule.c 119488 2003-08-26 11:33:15Z davidxu $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/ktr.h> 34#include <sys/lock.h> 35#include <sys/mutex.h> 36#include <sys/proc.h> --- 730 unchanged lines hidden (view full) --- 767{ 768 return (0); 769} 770#endif 771 772void 773sched_prio(struct thread *td, u_char prio) 774{ | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/ktr.h> 34#include <sys/lock.h> 35#include <sys/mutex.h> 36#include <sys/proc.h> --- 730 unchanged lines hidden (view full) --- 767{ 768 return (0); 769} 770#endif 771 772void 773sched_prio(struct thread *td, u_char prio) 774{ |
775 struct kse *ke; 776 struct runq *rq; | |
777 778 mtx_assert(&sched_lock, MA_OWNED); | 775 776 mtx_assert(&sched_lock, MA_OWNED); |
779 ke = td->td_kse; 780 td->td_priority = prio; 781 | |
782 if (TD_ON_RUNQ(td)) { | 777 if (TD_ON_RUNQ(td)) { |
783 rq = ke->ke_runq; 784 785 runq_remove(rq, ke); 786 runq_add(rq, ke); | 778 adjustrunqueue(td, prio); 779 } else { 780 td->td_priority = prio; |
787 } 788} 789 790void 791sched_switchout(struct thread *td) 792{ 793 struct kse *ke; 794 795 mtx_assert(&sched_lock, MA_OWNED); 796 797 ke = td->td_kse; 798 799 td->td_last_kse = ke; 800 td->td_lastcpu = td->td_oncpu; 801 td->td_oncpu = NOCPU; 802 td->td_flags &= ~TDF_NEEDRESCHED; 803 804 if (TD_IS_RUNNING(td)) { | 781 } 782} 783 784void 785sched_switchout(struct thread *td) 786{ 787 struct kse *ke; 788 789 mtx_assert(&sched_lock, MA_OWNED); 790 791 ke = td->td_kse; 792 793 td->td_last_kse = ke; 794 td->td_lastcpu = td->td_oncpu; 795 td->td_oncpu = NOCPU; 796 td->td_flags &= ~TDF_NEEDRESCHED; 797 798 if (TD_IS_RUNNING(td)) { |
805 /* 806 * This queue is always correct except for idle threads which 807 * have a higher priority due to priority propagation. 808 */ 809 if (ke->ke_ksegrp->kg_pri_class == PRI_IDLE && 810 ke->ke_thread->td_priority > PRI_MIN_IDLE) 811 ke->ke_runq = KSEQ_SELF()->ksq_curr; 812 runq_add(ke->ke_runq, ke); 813 /* setrunqueue(td); */ | 799 if (td->td_proc->p_flag & P_SA) { 800 kseq_rem(KSEQ_CPU(ke->ke_cpu), ke); 801 setrunqueue(td); 802 } else { 803 /* 804 * This queue is always correct except for idle threads which 805 * have a higher priority due to priority propagation. 806 */ 807 if (ke->ke_ksegrp->kg_pri_class == PRI_IDLE && 808 ke->ke_thread->td_priority > PRI_MIN_IDLE) 809 ke->ke_runq = KSEQ_SELF()->ksq_curr; 810 runq_add(ke->ke_runq, ke); 811 /* setrunqueue(td); */ 812 } |
814 return; 815 } 816 if (ke->ke_runq) 817 kseq_rem(KSEQ_CPU(ke->ke_cpu), ke); 818 /* 819 * We will not be on the run queue. So we must be 820 * sleeping or similar. 821 */ --- 524 unchanged lines hidden --- | 813 return; 814 } 815 if (ke->ke_runq) 816 kseq_rem(KSEQ_CPU(ke->ke_cpu), ke); 817 /* 818 * We will not be on the run queue. So we must be 819 * sleeping or similar. 820 */ --- 524 unchanged lines hidden --- |