aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h77
1 files changed, 48 insertions, 29 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c5d3f847ca8d..21349173d148 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -134,7 +134,6 @@ extern unsigned long nr_running(void);
134extern unsigned long nr_uninterruptible(void); 134extern unsigned long nr_uninterruptible(void);
135extern unsigned long nr_active(void); 135extern unsigned long nr_active(void);
136extern unsigned long nr_iowait(void); 136extern unsigned long nr_iowait(void);
137extern unsigned long weighted_cpuload(const int cpu);
138 137
139struct seq_file; 138struct seq_file;
140struct cfs_rq; 139struct cfs_rq;
@@ -246,6 +245,8 @@ extern asmlinkage void schedule_tail(struct task_struct *prev);
246extern void init_idle(struct task_struct *idle, int cpu); 245extern void init_idle(struct task_struct *idle, int cpu);
247extern void init_idle_bootup_task(struct task_struct *idle); 246extern void init_idle_bootup_task(struct task_struct *idle);
248 247
248extern int runqueue_is_locked(void);
249
249extern cpumask_t nohz_cpu_mask; 250extern cpumask_t nohz_cpu_mask;
250#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 251#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
251extern int select_nohz_load_balancer(int cpu); 252extern int select_nohz_load_balancer(int cpu);
@@ -784,6 +785,8 @@ struct sched_domain {
784 unsigned int balance_interval; /* initialise to 1. units in ms. */ 785 unsigned int balance_interval; /* initialise to 1. units in ms. */
785 unsigned int nr_balance_failed; /* initialise to 0 */ 786 unsigned int nr_balance_failed; /* initialise to 0 */
786 787
788 u64 last_update;
789
787#ifdef CONFIG_SCHEDSTATS 790#ifdef CONFIG_SCHEDSTATS
788 /* load_balance() stats */ 791 /* load_balance() stats */
789 unsigned int lb_count[CPU_MAX_IDLE_TYPES]; 792 unsigned int lb_count[CPU_MAX_IDLE_TYPES];
@@ -823,23 +826,6 @@ extern int arch_reinit_sched_domains(void);
823 826
824#endif /* CONFIG_SMP */ 827#endif /* CONFIG_SMP */
825 828
826/*
827 * A runqueue laden with a single nice 0 task scores a weighted_cpuload of
828 * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a
829 * task of nice 0 or enough lower priority tasks to bring up the
830 * weighted_cpuload
831 */
832static inline int above_background_load(void)
833{
834 unsigned long cpu;
835
836 for_each_online_cpu(cpu) {
837 if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE)
838 return 1;
839 }
840 return 0;
841}
842
843struct io_context; /* See blkdev.h */ 829struct io_context; /* See blkdev.h */
844#define NGROUPS_SMALL 32 830#define NGROUPS_SMALL 32
845#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t))) 831#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t)))
@@ -921,8 +907,8 @@ struct sched_class {
921 void (*set_cpus_allowed)(struct task_struct *p, 907 void (*set_cpus_allowed)(struct task_struct *p,
922 const cpumask_t *newmask); 908 const cpumask_t *newmask);
923 909
924 void (*join_domain)(struct rq *rq); 910 void (*rq_online)(struct rq *rq);
925 void (*leave_domain)(struct rq *rq); 911 void (*rq_offline)(struct rq *rq);
926 912
927 void (*switched_from) (struct rq *this_rq, struct task_struct *task, 913 void (*switched_from) (struct rq *this_rq, struct task_struct *task,
928 int running); 914 int running);
@@ -1039,6 +1025,7 @@ struct task_struct {
1039#endif 1025#endif
1040 1026
1041 int prio, static_prio, normal_prio; 1027 int prio, static_prio, normal_prio;
1028 unsigned int rt_priority;
1042 const struct sched_class *sched_class; 1029 const struct sched_class *sched_class;
1043 struct sched_entity se; 1030 struct sched_entity se;
1044 struct sched_rt_entity rt; 1031 struct sched_rt_entity rt;
@@ -1122,7 +1109,6 @@ struct task_struct {
1122 int __user *set_child_tid; /* CLONE_CHILD_SETTID */ 1109 int __user *set_child_tid; /* CLONE_CHILD_SETTID */
1123 int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */ 1110 int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */
1124 1111
1125 unsigned int rt_priority;
1126 cputime_t utime, stime, utimescaled, stimescaled; 1112 cputime_t utime, stime, utimescaled, stimescaled;
1127 cputime_t gtime; 1113 cputime_t gtime;
1128 cputime_t prev_utime, prev_stime; 1114 cputime_t prev_utime, prev_stime;
@@ -1141,12 +1127,12 @@ struct task_struct {
1141 gid_t gid,egid,sgid,fsgid; 1127 gid_t gid,egid,sgid,fsgid;
1142 struct group_info *group_info; 1128 struct group_info *group_info;
1143 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; 1129 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset;
1144 unsigned securebits;
1145 struct user_struct *user; 1130 struct user_struct *user;
1131 unsigned securebits;
1146#ifdef CONFIG_KEYS 1132#ifdef CONFIG_KEYS
1133 unsigned char jit_keyring; /* default keyring to attach requested keys to */
1147 struct key *request_key_auth; /* assumed request_key authority */ 1134 struct key *request_key_auth; /* assumed request_key authority */
1148 struct key *thread_keyring; /* keyring private to this thread */ 1135 struct key *thread_keyring; /* keyring private to this thread */
1149 unsigned char jit_keyring; /* default keyring to attach requested keys to */
1150#endif 1136#endif
1151 char comm[TASK_COMM_LEN]; /* executable name excluding path 1137 char comm[TASK_COMM_LEN]; /* executable name excluding path
1152 - access with [gs]et_task_comm (which lock 1138 - access with [gs]et_task_comm (which lock
@@ -1233,8 +1219,8 @@ struct task_struct {
1233# define MAX_LOCK_DEPTH 48UL 1219# define MAX_LOCK_DEPTH 48UL
1234 u64 curr_chain_key; 1220 u64 curr_chain_key;
1235 int lockdep_depth; 1221 int lockdep_depth;
1236 struct held_lock held_locks[MAX_LOCK_DEPTH];
1237 unsigned int lockdep_recursion; 1222 unsigned int lockdep_recursion;
1223 struct held_lock held_locks[MAX_LOCK_DEPTH];
1238#endif 1224#endif
1239 1225
1240/* journalling filesystem info */ 1226/* journalling filesystem info */
@@ -1262,10 +1248,6 @@ struct task_struct {
1262 u64 acct_vm_mem1; /* accumulated virtual memory usage */ 1248 u64 acct_vm_mem1; /* accumulated virtual memory usage */
1263 cputime_t acct_stimexpd;/* stime since last update */ 1249 cputime_t acct_stimexpd;/* stime since last update */
1264#endif 1250#endif
1265#ifdef CONFIG_NUMA
1266 struct mempolicy *mempolicy;
1267 short il_next;
1268#endif
1269#ifdef CONFIG_CPUSETS 1251#ifdef CONFIG_CPUSETS
1270 nodemask_t mems_allowed; 1252 nodemask_t mems_allowed;
1271 int cpuset_mems_generation; 1253 int cpuset_mems_generation;
@@ -1285,6 +1267,10 @@ struct task_struct {
1285 struct list_head pi_state_list; 1267 struct list_head pi_state_list;
1286 struct futex_pi_state *pi_state_cache; 1268 struct futex_pi_state *pi_state_cache;
1287#endif 1269#endif
1270#ifdef CONFIG_NUMA
1271 struct mempolicy *mempolicy;
1272 short il_next;
1273#endif
1288 atomic_t fs_excl; /* holding fs exclusive resources */ 1274 atomic_t fs_excl; /* holding fs exclusive resources */
1289 struct rcu_head rcu; 1275 struct rcu_head rcu;
1290 1276
@@ -1504,6 +1490,7 @@ static inline void put_task_struct(struct task_struct *t)
1504#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ 1490#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
1505#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ 1491#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
1506#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1492#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1493#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */
1507#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1494#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1508#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1495#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1509#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ 1496#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */
@@ -1573,13 +1560,28 @@ static inline void sched_clock_idle_sleep_event(void)
1573static inline void sched_clock_idle_wakeup_event(u64 delta_ns) 1560static inline void sched_clock_idle_wakeup_event(u64 delta_ns)
1574{ 1561{
1575} 1562}
1576#else 1563
1564#ifdef CONFIG_NO_HZ
1565static inline void sched_clock_tick_stop(int cpu)
1566{
1567}
1568
1569static inline void sched_clock_tick_start(int cpu)
1570{
1571}
1572#endif
1573
1574#else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
1577extern void sched_clock_init(void); 1575extern void sched_clock_init(void);
1578extern u64 sched_clock_cpu(int cpu); 1576extern u64 sched_clock_cpu(int cpu);
1579extern void sched_clock_tick(void); 1577extern void sched_clock_tick(void);
1580extern void sched_clock_idle_sleep_event(void); 1578extern void sched_clock_idle_sleep_event(void);
1581extern void sched_clock_idle_wakeup_event(u64 delta_ns); 1579extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1580#ifdef CONFIG_NO_HZ
1581extern void sched_clock_tick_stop(int cpu);
1582extern void sched_clock_tick_start(int cpu);
1582#endif 1583#endif
1584#endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
1583 1585
1584/* 1586/*
1585 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu 1587 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
@@ -1622,6 +1624,7 @@ extern unsigned int sysctl_sched_child_runs_first;
1622extern unsigned int sysctl_sched_features; 1624extern unsigned int sysctl_sched_features;
1623extern unsigned int sysctl_sched_migration_cost; 1625extern unsigned int sysctl_sched_migration_cost;
1624extern unsigned int sysctl_sched_nr_migrate; 1626extern unsigned int sysctl_sched_nr_migrate;
1627extern unsigned int sysctl_sched_shares_ratelimit;
1625 1628
1626int sched_nr_latency_handler(struct ctl_table *table, int write, 1629int sched_nr_latency_handler(struct ctl_table *table, int write,
1627 struct file *file, void __user *buffer, size_t *length, 1630 struct file *file, void __user *buffer, size_t *length,
@@ -1655,6 +1658,8 @@ extern int can_nice(const struct task_struct *p, const int nice);
1655extern int task_curr(const struct task_struct *p); 1658extern int task_curr(const struct task_struct *p);
1656extern int idle_cpu(int cpu); 1659extern int idle_cpu(int cpu);
1657extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); 1660extern int sched_setscheduler(struct task_struct *, int, struct sched_param *);
1661extern int sched_setscheduler_nocheck(struct task_struct *, int,
1662 struct sched_param *);
1658extern struct task_struct *idle_task(int cpu); 1663extern struct task_struct *idle_task(int cpu);
1659extern struct task_struct *curr_task(int cpu); 1664extern struct task_struct *curr_task(int cpu);
1660extern void set_curr_task(int cpu, struct task_struct *p); 1665extern void set_curr_task(int cpu, struct task_struct *p);
@@ -2131,6 +2136,18 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm)
2131} 2136}
2132#endif 2137#endif
2133 2138
2139#ifdef CONFIG_TRACING
2140extern void
2141__trace_special(void *__tr, void *__data,
2142 unsigned long arg1, unsigned long arg2, unsigned long arg3);
2143#else
2144static inline void
2145__trace_special(void *__tr, void *__data,
2146 unsigned long arg1, unsigned long arg2, unsigned long arg3)
2147{
2148}
2149#endif
2150
2134extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask); 2151extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask);
2135extern long sched_getaffinity(pid_t pid, cpumask_t *mask); 2152extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
2136 2153
@@ -2225,6 +2242,8 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2225} 2242}
2226#endif /* CONFIG_MM_OWNER */ 2243#endif /* CONFIG_MM_OWNER */
2227 2244
2245#define TASK_STATE_TO_CHAR_STR "RSDTtZX"
2246
2228#endif /* __KERNEL__ */ 2247#endif /* __KERNEL__ */
2229 2248
2230#endif 2249#endif