sched_ule.c (177042) | sched_ule.c (177085) |
---|---|
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 177042 2008-03-10 22:48:27Z jeff $"); | 39__FBSDID("$FreeBSD: head/sys/kern/sched_ule.c 177085 2008-03-12 06:31:06Z jeff $"); |
40 41#include "opt_hwpmc_hooks.h" 42#include "opt_sched.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/kdb.h> 47#include <sys/kernel.h> --- 132 unchanged lines hidden (view full) --- 180#ifdef FULL_PREEMPTION 181static int preempt_thresh = PRI_MAX_IDLE; 182#else 183static int preempt_thresh = PRI_MIN_KERN; 184#endif 185#else 186static int preempt_thresh = 0; 187#endif | 40 41#include "opt_hwpmc_hooks.h" 42#include "opt_sched.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/kdb.h> 47#include <sys/kernel.h> --- 132 unchanged lines hidden (view full) --- 180#ifdef FULL_PREEMPTION 181static int preempt_thresh = PRI_MAX_IDLE; 182#else 183static int preempt_thresh = PRI_MIN_KERN; 184#endif 185#else 186static int preempt_thresh = 0; 187#endif |
188static int static_boost = 1; |
|
188 189/* 190 * tdq - per processor runqs and statistics. All fields are protected by the 191 * tdq_lock. The load and lowpri may be accessed without to avoid excess 192 * locking in sched_pickcpu(); 193 */ 194struct tdq { 195 /* Ordered to improve efficiency of cpu_search() and switch(). */ --- 1655 unchanged lines hidden (view full) --- 1851 thread_unlock(td); 1852 } 1853} 1854 1855/* 1856 * Record the sleep time for the interactivity scorer. 1857 */ 1858void | 189 190/* 191 * tdq - per processor runqs and statistics. All fields are protected by the 192 * tdq_lock. The load and lowpri may be accessed without to avoid excess 193 * locking in sched_pickcpu(); 194 */ 195struct tdq { 196 /* Ordered to improve efficiency of cpu_search() and switch(). */ --- 1655 unchanged lines hidden (view full) --- 1852 thread_unlock(td); 1853 } 1854} 1855 1856/* 1857 * Record the sleep time for the interactivity scorer. 1858 */ 1859void |
1859sched_sleep(struct thread *td) | 1860sched_sleep(struct thread *td, int prio) |
1860{ 1861 1862 THREAD_LOCK_ASSERT(td, MA_OWNED); 1863 1864 td->td_slptick = ticks; | 1861{ 1862 1863 THREAD_LOCK_ASSERT(td, MA_OWNED); 1864 1865 td->td_slptick = ticks; |
1866 if (TD_IS_SUSPENDED(td) || prio <= PSOCK) 1867 td->td_flags |= TDF_CANSWAP; 1868 if (static_boost && prio) 1869 sched_prio(td, prio); |
|
1865} 1866 1867/* 1868 * Schedule a thread to resume execution and record how long it voluntarily 1869 * slept. We also update the pctcpu, interactivity, and priority. 1870 */ 1871void 1872sched_wakeup(struct thread *td) 1873{ 1874 struct td_sched *ts; 1875 int slptick; 1876 1877 THREAD_LOCK_ASSERT(td, MA_OWNED); 1878 ts = td->td_sched; | 1870} 1871 1872/* 1873 * Schedule a thread to resume execution and record how long it voluntarily 1874 * slept. We also update the pctcpu, interactivity, and priority. 1875 */ 1876void 1877sched_wakeup(struct thread *td) 1878{ 1879 struct td_sched *ts; 1880 int slptick; 1881 1882 THREAD_LOCK_ASSERT(td, MA_OWNED); 1883 ts = td->td_sched; |
1884 td->td_flags &= ~TDF_CANSWAP; |
|
1879 /* 1880 * If we slept for more than a tick update our interactivity and 1881 * priority. 1882 */ 1883 slptick = td->td_slptick; 1884 td->td_slptick = 0; 1885 if (slptick && slptick != ticks) { 1886 u_int hzticks; --- 663 unchanged lines hidden (view full) --- 2550SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, "ULE", 0, 2551 "Scheduler name"); 2552SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, 2553 "Slice size for timeshare threads"); 2554SYSCTL_INT(_kern_sched, OID_AUTO, interact, CTLFLAG_RW, &sched_interact, 0, 2555 "Interactivity score threshold"); 2556SYSCTL_INT(_kern_sched, OID_AUTO, preempt_thresh, CTLFLAG_RW, &preempt_thresh, 2557 0,"Min priority for preemption, lower priorities have greater precedence"); | 1885 /* 1886 * If we slept for more than a tick update our interactivity and 1887 * priority. 1888 */ 1889 slptick = td->td_slptick; 1890 td->td_slptick = 0; 1891 if (slptick && slptick != ticks) { 1892 u_int hzticks; --- 663 unchanged lines hidden (view full) --- 2556SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, "ULE", 0, 2557 "Scheduler name"); 2558SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, 2559 "Slice size for timeshare threads"); 2560SYSCTL_INT(_kern_sched, OID_AUTO, interact, CTLFLAG_RW, &sched_interact, 0, 2561 "Interactivity score threshold"); 2562SYSCTL_INT(_kern_sched, OID_AUTO, preempt_thresh, CTLFLAG_RW, &preempt_thresh, 2563 0,"Min priority for preemption, lower priorities have greater precedence"); |
2564SYSCTL_INT(_kern_sched, OID_AUTO, static_boost, CTLFLAG_RW, &static_boost, 2565 0,"Controls whether static kernel priorities are assigned to sleeping threads."); |
|
2558#ifdef SMP 2559SYSCTL_INT(_kern_sched, OID_AUTO, affinity, CTLFLAG_RW, &affinity, 0, 2560 "Number of hz ticks to keep thread affinity for"); 2561SYSCTL_INT(_kern_sched, OID_AUTO, balance, CTLFLAG_RW, &rebalance, 0, 2562 "Enables the long-term load balancer"); 2563SYSCTL_INT(_kern_sched, OID_AUTO, balance_interval, CTLFLAG_RW, 2564 &balance_interval, 0, 2565 "Average frequency in stathz ticks to run the long-term balancer"); --- 15 unchanged lines hidden --- | 2566#ifdef SMP 2567SYSCTL_INT(_kern_sched, OID_AUTO, affinity, CTLFLAG_RW, &affinity, 0, 2568 "Number of hz ticks to keep thread affinity for"); 2569SYSCTL_INT(_kern_sched, OID_AUTO, balance, CTLFLAG_RW, &rebalance, 0, 2570 "Enables the long-term load balancer"); 2571SYSCTL_INT(_kern_sched, OID_AUTO, balance_interval, CTLFLAG_RW, 2572 &balance_interval, 0, 2573 "Average frequency in stathz ticks to run the long-term balancer"); --- 15 unchanged lines hidden --- |