Deleted Added
full compact
sched_ule.c (170600) sched_ule.c (170787)
1/*-
2 * Copyright (c) 2002-2007, 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-2007, 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 170600 2007-06-12 07:47:09Z jeff $");
28__FBSDID("$FreeBSD: head/sys/kern/sched_ule.c 170787 2007-06-15 19:33:58Z jeff $");
29
30#include "opt_hwpmc_hooks.h"
31#include "opt_sched.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kdb.h>
36#include <sys/kernel.h>

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

130 * PRI_NRESV: Number of nice values.
131 * PRI_TICKS: Compute a priority in PRI_RANGE from the ticks count and total.
132 * PRI_NICE: Determines the part of the priority inherited from nice.
133 */
134#define SCHED_PRI_NRESV (PRIO_MAX - PRIO_MIN)
135#define SCHED_PRI_NHALF (SCHED_PRI_NRESV / 2)
136#define SCHED_PRI_MIN (PRI_MIN_TIMESHARE + SCHED_PRI_NHALF)
137#define SCHED_PRI_MAX (PRI_MAX_TIMESHARE - SCHED_PRI_NHALF)
29
30#include "opt_hwpmc_hooks.h"
31#include "opt_sched.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kdb.h>
36#include <sys/kernel.h>

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

130 * PRI_NRESV: Number of nice values.
131 * PRI_TICKS: Compute a priority in PRI_RANGE from the ticks count and total.
132 * PRI_NICE: Determines the part of the priority inherited from nice.
133 */
134#define SCHED_PRI_NRESV (PRIO_MAX - PRIO_MIN)
135#define SCHED_PRI_NHALF (SCHED_PRI_NRESV / 2)
136#define SCHED_PRI_MIN (PRI_MIN_TIMESHARE + SCHED_PRI_NHALF)
137#define SCHED_PRI_MAX (PRI_MAX_TIMESHARE - SCHED_PRI_NHALF)
138#define SCHED_PRI_RANGE (SCHED_PRI_MAX - SCHED_PRI_MIN + 1)
138#define SCHED_PRI_RANGE (SCHED_PRI_MAX - SCHED_PRI_MIN)
139#define SCHED_PRI_TICKS(ts) \
140 (SCHED_TICK_HZ((ts)) / \
141 (roundup(SCHED_TICK_TOTAL((ts)), SCHED_PRI_RANGE) / SCHED_PRI_RANGE))
142#define SCHED_PRI_NICE(nice) (nice)
143
144/*
145 * These determine the interactivity of a process. Interactivity differs from
146 * cpu utilization in that it expresses the voluntary time slept vs time ran

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

933static struct td_sched *
934tdq_choose(struct tdq *tdq)
935{
936 struct td_sched *ts;
937
938 mtx_assert(&sched_lock, MA_OWNED);
939
940 ts = runq_choose(&tdq->tdq_realtime);
139#define SCHED_PRI_TICKS(ts) \
140 (SCHED_TICK_HZ((ts)) / \
141 (roundup(SCHED_TICK_TOTAL((ts)), SCHED_PRI_RANGE) / SCHED_PRI_RANGE))
142#define SCHED_PRI_NICE(nice) (nice)
143
144/*
145 * These determine the interactivity of a process. Interactivity differs from
146 * cpu utilization in that it expresses the voluntary time slept vs time ran

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

933static struct td_sched *
934tdq_choose(struct tdq *tdq)
935{
936 struct td_sched *ts;
937
938 mtx_assert(&sched_lock, MA_OWNED);
939
940 ts = runq_choose(&tdq->tdq_realtime);
941 if (ts != NULL) {
942 KASSERT(ts->ts_thread->td_priority <= PRI_MAX_REALTIME,
943 ("tdq_choose: Invalid priority on realtime queue %d",
944 ts->ts_thread->td_priority));
941 if (ts != NULL)
945 return (ts);
942 return (ts);
946 }
947 ts = runq_choose_from(&tdq->tdq_timeshare, tdq->tdq_ridx);
948 if (ts != NULL) {
943 ts = runq_choose_from(&tdq->tdq_timeshare, tdq->tdq_ridx);
944 if (ts != NULL) {
949 KASSERT(ts->ts_thread->td_priority <= PRI_MAX_TIMESHARE &&
950 ts->ts_thread->td_priority >= PRI_MIN_TIMESHARE,
945 KASSERT(ts->ts_thread->td_priority >= PRI_MIN_TIMESHARE,
951 ("tdq_choose: Invalid priority on timeshare queue %d",
952 ts->ts_thread->td_priority));
953 return (ts);
954 }
955
956 ts = runq_choose(&tdq->tdq_idle);
957 if (ts != NULL) {
958 KASSERT(ts->ts_thread->td_priority >= PRI_MIN_IDLE,

--- 1233 unchanged lines hidden ---
946 ("tdq_choose: Invalid priority on timeshare queue %d",
947 ts->ts_thread->td_priority));
948 return (ts);
949 }
950
951 ts = runq_choose(&tdq->tdq_idle);
952 if (ts != NULL) {
953 KASSERT(ts->ts_thread->td_priority >= PRI_MIN_IDLE,

--- 1233 unchanged lines hidden ---