Deleted Added
full compact
sched_ule.c (212416) sched_ule.c (212541)
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

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

31 *
32 * etymology:
33 * ULE is the last three letters in schedule. It owes its name to a
34 * generic user created for a scheduling system by Paul Mikesell at
35 * Isilon Systems and a general lack of creativity on the part of the author.
36 */
37
38#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

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

31 *
32 * etymology:
33 * ULE is the last three letters in schedule. It owes its name to a
34 * generic user created for a scheduling system by Paul Mikesell at
35 * Isilon Systems and a general lack of creativity on the part of the author.
36 */
37
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/sys/kern/sched_ule.c 212416 2010-09-10 13:24:47Z mav $");
39__FBSDID("$FreeBSD: head/sys/kern/sched_ule.c 212541 2010-09-13 07:25:35Z mav $");
40
41#include "opt_hwpmc_hooks.h"
42#include "opt_kdtrace.h"
43#include "opt_sched.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kdb.h>

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

191#else
192static int preempt_thresh = PRI_MIN_KERN;
193#endif
194#else
195static int preempt_thresh = 0;
196#endif
197static int static_boost = PRI_MIN_TIMESHARE;
198static int sched_idlespins = 10000;
40
41#include "opt_hwpmc_hooks.h"
42#include "opt_kdtrace.h"
43#include "opt_sched.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kdb.h>

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

191#else
192static int preempt_thresh = PRI_MIN_KERN;
193#endif
194#else
195static int preempt_thresh = 0;
196#endif
197static int static_boost = PRI_MIN_TIMESHARE;
198static int sched_idlespins = 10000;
199static int sched_idlespinthresh = 64;
199static int sched_idlespinthresh = 16;
200
201/*
202 * tdq - per processor runqs and statistics. All fields are protected by the
203 * tdq_lock. The load and lowpri may be accessed without to avoid excess
204 * locking in sched_pickcpu();
205 */
206struct tdq {
207 /* Ordered to improve efficiency of cpu_search() and switch(). */

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

2158 td->td_flags |= TDF_NEEDRESCHED;
2159}
2160
2161/*
2162 * Called once per hz tick. Used for cpu utilization information. This
2163 * is easier than trying to scale based on stathz.
2164 */
2165void
200
201/*
202 * tdq - per processor runqs and statistics. All fields are protected by the
203 * tdq_lock. The load and lowpri may be accessed without to avoid excess
204 * locking in sched_pickcpu();
205 */
206struct tdq {
207 /* Ordered to improve efficiency of cpu_search() and switch(). */

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

2158 td->td_flags |= TDF_NEEDRESCHED;
2159}
2160
2161/*
2162 * Called once per hz tick. Used for cpu utilization information. This
2163 * is easier than trying to scale based on stathz.
2164 */
2165void
2166sched_tick(void)
2166sched_tick(int cnt)
2167{
2168 struct td_sched *ts;
2169
2170 ts = curthread->td_sched;
2171 /*
2172 * Ticks is updated asynchronously on a single cpu. Check here to
2173 * avoid incrementing ts_ticks multiple times in a single tick.
2174 */
2175 if (ts->ts_incrtick == ticks)
2176 return;
2177 /* Adjust ticks for pctcpu */
2167{
2168 struct td_sched *ts;
2169
2170 ts = curthread->td_sched;
2171 /*
2172 * Ticks is updated asynchronously on a single cpu. Check here to
2173 * avoid incrementing ts_ticks multiple times in a single tick.
2174 */
2175 if (ts->ts_incrtick == ticks)
2176 return;
2177 /* Adjust ticks for pctcpu */
2178 ts->ts_ticks += 1 << SCHED_TICK_SHIFT;
2178 ts->ts_ticks += cnt << SCHED_TICK_SHIFT;
2179 ts->ts_ltick = ticks;
2180 ts->ts_incrtick = ticks;
2181 /*
2182 * Update if we've exceeded our desired tick threshhold by over one
2183 * second.
2184 */
2185 if (ts->ts_ftick + SCHED_TICK_MAX < ts->ts_ltick)
2186 sched_pctcpu_update(ts);

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

2544 break;
2545 cpu_spinwait();
2546 }
2547 }
2548 switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt;
2549 if (tdq->tdq_load == 0) {
2550 tdq->tdq_cpu_idle = 1;
2551 if (tdq->tdq_load == 0) {
2179 ts->ts_ltick = ticks;
2180 ts->ts_incrtick = ticks;
2181 /*
2182 * Update if we've exceeded our desired tick threshhold by over one
2183 * second.
2184 */
2185 if (ts->ts_ftick + SCHED_TICK_MAX < ts->ts_ltick)
2186 sched_pctcpu_update(ts);

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

2544 break;
2545 cpu_spinwait();
2546 }
2547 }
2548 switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt;
2549 if (tdq->tdq_load == 0) {
2550 tdq->tdq_cpu_idle = 1;
2551 if (tdq->tdq_load == 0) {
2552 cpu_idle(switchcnt > sched_idlespinthresh);
2552 cpu_idle(switchcnt > sched_idlespinthresh * 4);
2553 tdq->tdq_switchcnt++;
2554 }
2555 tdq->tdq_cpu_idle = 0;
2556 }
2557 if (tdq->tdq_load) {
2558 thread_lock(td);
2559 mi_switch(SW_VOL | SWT_IDLE, NULL);
2560 thread_unlock(td);

--- 195 unchanged lines hidden ---
2553 tdq->tdq_switchcnt++;
2554 }
2555 tdq->tdq_cpu_idle = 0;
2556 }
2557 if (tdq->tdq_load) {
2558 thread_lock(td);
2559 mi_switch(SW_VOL | SWT_IDLE, NULL);
2560 thread_unlock(td);

--- 195 unchanged lines hidden ---