sched_4bsd.c (178471) | sched_4bsd.c (179297) |
---|---|
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 178471 2008-04-25 05:18:50Z jeff $"); | 36__FBSDID("$FreeBSD: head/sys/kern/sched_4bsd.c 179297 2008-05-25 01:44:58Z jb $"); |
37 38#include "opt_hwpmc_hooks.h" 39#include "opt_sched.h" | 37 38#include "opt_hwpmc_hooks.h" 39#include "opt_sched.h" |
40#include "opt_kdtrace.h" |
|
40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/cpuset.h> 44#include <sys/kernel.h> 45#include <sys/ktr.h> 46#include <sys/lock.h> 47#include <sys/kthread.h> --- 8 unchanged lines hidden (view full) --- 56#include <sys/umtx.h> 57#include <machine/pcb.h> 58#include <machine/smp.h> 59 60#ifdef HWPMC_HOOKS 61#include <sys/pmckern.h> 62#endif 63 | 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/cpuset.h> 45#include <sys/kernel.h> 46#include <sys/ktr.h> 47#include <sys/lock.h> 48#include <sys/kthread.h> --- 8 unchanged lines hidden (view full) --- 57#include <sys/umtx.h> 58#include <machine/pcb.h> 59#include <machine/smp.h> 60 61#ifdef HWPMC_HOOKS 62#include <sys/pmckern.h> 63#endif 64 |
65#ifdef KDTRACE_HOOKS 66#include <sys/dtrace_bsd.h> 67int dtrace_vtime_active; 68dtrace_vtime_switch_func_t dtrace_vtime_switch_func; 69#endif 70 |
|
64/* 65 * INVERSE_ESTCPU_WEIGHT is only suitable for statclock() frequencies in 66 * the range 100-256 Hz (approximately). 67 */ 68#define ESTCPULIM(e) \ 69 min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) - \ 70 RQ_PPQ) + INVERSE_ESTCPU_WEIGHT - 1) 71#ifdef SMP --- 885 unchanged lines hidden (view full) --- 957 958 if (td != newtd) { 959#ifdef HWPMC_HOOKS 960 if (PMC_PROC_IS_USING_PMCS(td->td_proc)) 961 PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); 962#endif 963 /* I feel sleepy */ 964 lock_profile_release_lock(&sched_lock.lock_object); | 71/* 72 * INVERSE_ESTCPU_WEIGHT is only suitable for statclock() frequencies in 73 * the range 100-256 Hz (approximately). 74 */ 75#define ESTCPULIM(e) \ 76 min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) - \ 77 RQ_PPQ) + INVERSE_ESTCPU_WEIGHT - 1) 78#ifdef SMP --- 885 unchanged lines hidden (view full) --- 964 965 if (td != newtd) { 966#ifdef HWPMC_HOOKS 967 if (PMC_PROC_IS_USING_PMCS(td->td_proc)) 968 PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); 969#endif 970 /* I feel sleepy */ 971 lock_profile_release_lock(&sched_lock.lock_object); |
972#ifdef KDTRACE_HOOKS 973 /* 974 * If DTrace has set the active vtime enum to anything 975 * other than INACTIVE (0), then it should have set the 976 * function to call. 977 */ 978 if (dtrace_vtime_active) 979 (*dtrace_vtime_switch_func)(newtd); 980#endif 981 |
|
965 cpu_switch(td, newtd, td->td_lock); 966 lock_profile_obtain_lock_success(&sched_lock.lock_object, 967 0, 0, __FILE__, __LINE__); 968 /* 969 * Where am I? What year is it? 970 * We are in the same thread that went to sleep above, 971 * but any amount of time may have passed. All out context 972 * will still be available as will local variables. --- 529 unchanged lines hidden --- | 982 cpu_switch(td, newtd, td->td_lock); 983 lock_profile_obtain_lock_success(&sched_lock.lock_object, 984 0, 0, __FILE__, __LINE__); 985 /* 986 * Where am I? What year is it? 987 * We are in the same thread that went to sleep above, 988 * but any amount of time may have passed. All out context 989 * will still be available as will local variables. --- 529 unchanged lines hidden --- |