Deleted Added
full compact
sched_ule.c (131473) sched_ule.c (131481)
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 131473 2004-07-02 19:09:50Z jhb $");
28__FBSDID("$FreeBSD: head/sys/kern/sched_ule.c 131481 2004-07-02 20:21:44Z jhb $");
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>

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

1134
1135 mtx_assert(&sched_lock, MA_OWNED);
1136
1137 ke = td->td_kse;
1138
1139 td->td_last_kse = ke;
1140 td->td_lastcpu = td->td_oncpu;
1141 td->td_oncpu = NOCPU;
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>

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

1134
1135 mtx_assert(&sched_lock, MA_OWNED);
1136
1137 ke = td->td_kse;
1138
1139 td->td_last_kse = ke;
1140 td->td_lastcpu = td->td_oncpu;
1141 td->td_oncpu = NOCPU;
1142 td->td_flags &= ~TDF_NEEDRESCHED;
1142 td->td_flags &= ~(TDF_NEEDRESCHED | TDF_OWEPREEMPT);
1143
1144 /*
1145 * If the KSE has been assigned it may be in the process of switching
1146 * to the new cpu. This is the case in sched_bind().
1147 */
1148 if ((ke->ke_flags & KEF_ASSIGNED) == 0) {
1149 if (td == PCPU_GET(idlethread))
1150 TD_SET_CAN_RUN(td);

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

1618 kseq->ksq_group->ksg_idlemask &= ~PCPU_GET(cpumask);
1619 } else if (kseq->ksq_load > 1 && KSE_CAN_MIGRATE(ke, class))
1620 if (kseq_transfer(kseq, ke, class))
1621 return;
1622#endif
1623 if (td->td_priority < curthread->td_priority)
1624 curthread->td_flags |= TDF_NEEDRESCHED;
1625
1143
1144 /*
1145 * If the KSE has been assigned it may be in the process of switching
1146 * to the new cpu. This is the case in sched_bind().
1147 */
1148 if ((ke->ke_flags & KEF_ASSIGNED) == 0) {
1149 if (td == PCPU_GET(idlethread))
1150 TD_SET_CAN_RUN(td);

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

1618 kseq->ksq_group->ksg_idlemask &= ~PCPU_GET(cpumask);
1619 } else if (kseq->ksq_load > 1 && KSE_CAN_MIGRATE(ke, class))
1620 if (kseq_transfer(kseq, ke, class))
1621 return;
1622#endif
1623 if (td->td_priority < curthread->td_priority)
1624 curthread->td_flags |= TDF_NEEDRESCHED;
1625
1626#ifdef SMP
1627 /*
1628 * Only try to preempt if the thread is unpinned or pinned to the
1629 * current CPU.
1630 */
1631 if (KSE_CAN_MIGRATE(ke) || ke->ke_cpu == PCPU_GET(cpuid))
1632#endif
1633 if (maybe_preempt(td))
1634 return;
1626 ke->ke_ksegrp->kg_runq_kses++;
1627 ke->ke_state = KES_ONRUNQ;
1628
1629 kseq_runq_add(kseq, ke);
1630 kseq_load_add(kseq, ke);
1631}
1632
1633void

--- 126 unchanged lines hidden ---
1635 ke->ke_ksegrp->kg_runq_kses++;
1636 ke->ke_state = KES_ONRUNQ;
1637
1638 kseq_runq_add(kseq, ke);
1639 kseq_load_add(kseq, ke);
1640}
1641
1642void

--- 126 unchanged lines hidden ---