Deleted Added
full compact
sched_4bsd.c (208787) sched_4bsd.c (209059)
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 208787 2010-06-03 16:02:11Z jhb $");
36__FBSDID("$FreeBSD: head/sys/kern/sched_4bsd.c 209059 2010-06-11 18:46:34Z jhb $");
37
38#include "opt_hwpmc_hooks.h"
39#include "opt_sched.h"
40#include "opt_kdtrace.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/cpuset.h>

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

1185 int best, cpu;
1186
1187 mtx_assert(&sched_lock, MA_OWNED);
1188
1189 if (THREAD_CAN_SCHED(td, td->td_lastcpu))
1190 best = td->td_lastcpu;
1191 else
1192 best = NOCPU;
37
38#include "opt_hwpmc_hooks.h"
39#include "opt_sched.h"
40#include "opt_kdtrace.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/cpuset.h>

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

1185 int best, cpu;
1186
1187 mtx_assert(&sched_lock, MA_OWNED);
1188
1189 if (THREAD_CAN_SCHED(td, td->td_lastcpu))
1190 best = td->td_lastcpu;
1191 else
1192 best = NOCPU;
1193 for (cpu = 0; cpu <= mp_maxid; cpu++) {
1194 if (CPU_ABSENT(cpu))
1195 continue;
1193 CPU_FOREACH(cpu) {
1196 if (!THREAD_CAN_SCHED(td, cpu))
1197 continue;
1198
1199 if (best == NOCPU)
1200 best = cpu;
1201 else if (runq_length[cpu] < runq_length[best])
1202 best = cpu;
1203 }

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

1622 THREAD_LOCK_ASSERT(td, MA_OWNED);
1623
1624 /*
1625 * Set the TSF_AFFINITY flag if there is at least one CPU this
1626 * thread can't run on.
1627 */
1628 ts = td->td_sched;
1629 ts->ts_flags &= ~TSF_AFFINITY;
1194 if (!THREAD_CAN_SCHED(td, cpu))
1195 continue;
1196
1197 if (best == NOCPU)
1198 best = cpu;
1199 else if (runq_length[cpu] < runq_length[best])
1200 best = cpu;
1201 }

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

1620 THREAD_LOCK_ASSERT(td, MA_OWNED);
1621
1622 /*
1623 * Set the TSF_AFFINITY flag if there is at least one CPU this
1624 * thread can't run on.
1625 */
1626 ts = td->td_sched;
1627 ts->ts_flags &= ~TSF_AFFINITY;
1630 for (cpu = 0; cpu <= mp_maxid; cpu++) {
1631 if (CPU_ABSENT(cpu))
1632 continue;
1628 CPU_FOREACH(cpu) {
1633 if (!THREAD_CAN_SCHED(td, cpu)) {
1634 ts->ts_flags |= TSF_AFFINITY;
1635 break;
1636 }
1637 }
1638
1639 /*
1640 * If this thread can run on all CPUs, nothing else to do.

--- 39 unchanged lines hidden ---
1629 if (!THREAD_CAN_SCHED(td, cpu)) {
1630 ts->ts_flags |= TSF_AFFINITY;
1631 break;
1632 }
1633 }
1634
1635 /*
1636 * If this thread can run on all CPUs, nothing else to do.

--- 39 unchanged lines hidden ---