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.h86
1 files changed, 54 insertions, 32 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 75e6e60bf583..244c287a5ac1 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -145,7 +145,6 @@ extern unsigned long this_cpu_load(void);
145 145
146 146
147extern void calc_global_load(void); 147extern void calc_global_load(void);
148extern u64 cpu_nr_migrations(int cpu);
149 148
150extern unsigned long get_parent_ip(unsigned long addr); 149extern unsigned long get_parent_ip(unsigned long addr);
151 150
@@ -171,8 +170,6 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
171} 170}
172#endif 171#endif
173 172
174extern unsigned long long time_sync_thresh;
175
176/* 173/*
177 * Task state bitmask. NOTE! These bits are also 174 * Task state bitmask. NOTE! These bits are also
178 * encoded in fs/proc/array.c: get_task_state(). 175 * encoded in fs/proc/array.c: get_task_state().
@@ -349,7 +346,6 @@ extern signed long schedule_timeout(signed long timeout);
349extern signed long schedule_timeout_interruptible(signed long timeout); 346extern signed long schedule_timeout_interruptible(signed long timeout);
350extern signed long schedule_timeout_killable(signed long timeout); 347extern signed long schedule_timeout_killable(signed long timeout);
351extern signed long schedule_timeout_uninterruptible(signed long timeout); 348extern signed long schedule_timeout_uninterruptible(signed long timeout);
352asmlinkage void __schedule(void);
353asmlinkage void schedule(void); 349asmlinkage void schedule(void);
354extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner); 350extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner);
355 351
@@ -628,6 +624,9 @@ struct signal_struct {
628 cputime_t utime, stime, cutime, cstime; 624 cputime_t utime, stime, cutime, cstime;
629 cputime_t gtime; 625 cputime_t gtime;
630 cputime_t cgtime; 626 cputime_t cgtime;
627#ifndef CONFIG_VIRT_CPU_ACCOUNTING
628 cputime_t prev_utime, prev_stime;
629#endif
631 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 630 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
632 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; 631 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
633 unsigned long inblock, oublock, cinblock, coublock; 632 unsigned long inblock, oublock, cinblock, coublock;
@@ -1013,9 +1012,13 @@ static inline struct cpumask *sched_domain_span(struct sched_domain *sd)
1013 return to_cpumask(sd->span); 1012 return to_cpumask(sd->span);
1014} 1013}
1015 1014
1016extern void partition_sched_domains(int ndoms_new, struct cpumask *doms_new, 1015extern void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
1017 struct sched_domain_attr *dattr_new); 1016 struct sched_domain_attr *dattr_new);
1018 1017
1018/* Allocate an array of sched domains, for partition_sched_domains(). */
1019cpumask_var_t *alloc_sched_domains(unsigned int ndoms);
1020void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms);
1021
1019/* Test a flag in parent sched domain */ 1022/* Test a flag in parent sched domain */
1020static inline int test_sd_parent(struct sched_domain *sd, int flag) 1023static inline int test_sd_parent(struct sched_domain *sd, int flag)
1021{ 1024{
@@ -1033,7 +1036,7 @@ unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu);
1033struct sched_domain_attr; 1036struct sched_domain_attr;
1034 1037
1035static inline void 1038static inline void
1036partition_sched_domains(int ndoms_new, struct cpumask *doms_new, 1039partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
1037 struct sched_domain_attr *dattr_new) 1040 struct sched_domain_attr *dattr_new)
1038{ 1041{
1039} 1042}
@@ -1099,7 +1102,7 @@ struct sched_class {
1099 1102
1100 void (*set_curr_task) (struct rq *rq); 1103 void (*set_curr_task) (struct rq *rq);
1101 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); 1104 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
1102 void (*task_new) (struct rq *rq, struct task_struct *p); 1105 void (*task_fork) (struct task_struct *p);
1103 1106
1104 void (*switched_from) (struct rq *this_rq, struct task_struct *task, 1107 void (*switched_from) (struct rq *this_rq, struct task_struct *task,
1105 int running); 1108 int running);
@@ -1108,7 +1111,8 @@ struct sched_class {
1108 void (*prio_changed) (struct rq *this_rq, struct task_struct *task, 1111 void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
1109 int oldprio, int running); 1112 int oldprio, int running);
1110 1113
1111 unsigned int (*get_rr_interval) (struct task_struct *task); 1114 unsigned int (*get_rr_interval) (struct rq *rq,
1115 struct task_struct *task);
1112 1116
1113#ifdef CONFIG_FAIR_GROUP_SCHED 1117#ifdef CONFIG_FAIR_GROUP_SCHED
1114 void (*moved_group) (struct task_struct *p); 1118 void (*moved_group) (struct task_struct *p);
@@ -1148,8 +1152,6 @@ struct sched_entity {
1148 u64 start_runtime; 1152 u64 start_runtime;
1149 u64 avg_wakeup; 1153 u64 avg_wakeup;
1150 1154
1151 u64 avg_running;
1152
1153#ifdef CONFIG_SCHEDSTATS 1155#ifdef CONFIG_SCHEDSTATS
1154 u64 wait_start; 1156 u64 wait_start;
1155 u64 wait_max; 1157 u64 wait_max;
@@ -1172,7 +1174,6 @@ struct sched_entity {
1172 u64 nr_failed_migrations_running; 1174 u64 nr_failed_migrations_running;
1173 u64 nr_failed_migrations_hot; 1175 u64 nr_failed_migrations_hot;
1174 u64 nr_forced_migrations; 1176 u64 nr_forced_migrations;
1175 u64 nr_forced2_migrations;
1176 1177
1177 u64 nr_wakeups; 1178 u64 nr_wakeups;
1178 u64 nr_wakeups_sync; 1179 u64 nr_wakeups_sync;
@@ -1331,7 +1332,9 @@ struct task_struct {
1331 1332
1332 cputime_t utime, stime, utimescaled, stimescaled; 1333 cputime_t utime, stime, utimescaled, stimescaled;
1333 cputime_t gtime; 1334 cputime_t gtime;
1335#ifndef CONFIG_VIRT_CPU_ACCOUNTING
1334 cputime_t prev_utime, prev_stime; 1336 cputime_t prev_utime, prev_stime;
1337#endif
1335 unsigned long nvcsw, nivcsw; /* context switch counts */ 1338 unsigned long nvcsw, nivcsw; /* context switch counts */
1336 struct timespec start_time; /* monotonic time */ 1339 struct timespec start_time; /* monotonic time */
1337 struct timespec real_start_time; /* boot based time */ 1340 struct timespec real_start_time; /* boot based time */
@@ -1406,7 +1409,7 @@ struct task_struct {
1406#endif 1409#endif
1407 1410
1408 /* Protection of the PI data structures: */ 1411 /* Protection of the PI data structures: */
1409 spinlock_t pi_lock; 1412 raw_spinlock_t pi_lock;
1410 1413
1411#ifdef CONFIG_RT_MUTEXES 1414#ifdef CONFIG_RT_MUTEXES
1412 /* PI waiters blocked on a rt_mutex held by this task */ 1415 /* PI waiters blocked on a rt_mutex held by this task */
@@ -1421,17 +1424,17 @@ struct task_struct {
1421#endif 1424#endif
1422#ifdef CONFIG_TRACE_IRQFLAGS 1425#ifdef CONFIG_TRACE_IRQFLAGS
1423 unsigned int irq_events; 1426 unsigned int irq_events;
1424 int hardirqs_enabled;
1425 unsigned long hardirq_enable_ip; 1427 unsigned long hardirq_enable_ip;
1426 unsigned int hardirq_enable_event;
1427 unsigned long hardirq_disable_ip; 1428 unsigned long hardirq_disable_ip;
1429 unsigned int hardirq_enable_event;
1428 unsigned int hardirq_disable_event; 1430 unsigned int hardirq_disable_event;
1429 int softirqs_enabled; 1431 int hardirqs_enabled;
1432 int hardirq_context;
1430 unsigned long softirq_disable_ip; 1433 unsigned long softirq_disable_ip;
1431 unsigned int softirq_disable_event;
1432 unsigned long softirq_enable_ip; 1434 unsigned long softirq_enable_ip;
1435 unsigned int softirq_disable_event;
1433 unsigned int softirq_enable_event; 1436 unsigned int softirq_enable_event;
1434 int hardirq_context; 1437 int softirqs_enabled;
1435 int softirq_context; 1438 int softirq_context;
1436#endif 1439#endif
1437#ifdef CONFIG_LOCKDEP 1440#ifdef CONFIG_LOCKDEP
@@ -1443,8 +1446,10 @@ struct task_struct {
1443 gfp_t lockdep_reclaim_gfp; 1446 gfp_t lockdep_reclaim_gfp;
1444#endif 1447#endif
1445 1448
1449#ifdef CONFIG_FS_JOURNAL_INFO
1446/* journalling filesystem info */ 1450/* journalling filesystem info */
1447 void *journal_info; 1451 void *journal_info;
1452#endif
1448 1453
1449/* stacked block device info */ 1454/* stacked block device info */
1450 struct bio *bio_list, **bio_tail; 1455 struct bio *bio_list, **bio_tail;
@@ -1539,6 +1544,14 @@ struct task_struct {
1539 unsigned long trace_recursion; 1544 unsigned long trace_recursion;
1540#endif /* CONFIG_TRACING */ 1545#endif /* CONFIG_TRACING */
1541 unsigned long stack_start; 1546 unsigned long stack_start;
1547#ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */
1548 struct memcg_batch_info {
1549 int do_batch; /* incremented when batch uncharge started */
1550 struct mem_cgroup *memcg; /* target memcg of uncharge */
1551 unsigned long bytes; /* uncharged usage */
1552 unsigned long memsw_bytes; /* uncharged mem+swap usage */
1553 } memcg_batch;
1554#endif
1542}; 1555};
1543 1556
1544/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1557/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -1720,9 +1733,8 @@ static inline void put_task_struct(struct task_struct *t)
1720 __put_task_struct(t); 1733 __put_task_struct(t);
1721} 1734}
1722 1735
1723extern cputime_t task_utime(struct task_struct *p); 1736extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
1724extern cputime_t task_stime(struct task_struct *p); 1737extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
1725extern cputime_t task_gtime(struct task_struct *p);
1726 1738
1727/* 1739/*
1728 * Per process flags 1740 * Per process flags
@@ -1836,7 +1848,8 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1836extern int sched_clock_stable; 1848extern int sched_clock_stable;
1837#endif 1849#endif
1838 1850
1839extern unsigned long long sched_clock(void); 1851/* ftrace calls sched_clock() directly */
1852extern unsigned long long notrace sched_clock(void);
1840 1853
1841extern void sched_clock_init(void); 1854extern void sched_clock_init(void);
1842extern u64 sched_clock_cpu(int cpu); 1855extern u64 sched_clock_cpu(int cpu);
@@ -1899,14 +1912,22 @@ extern unsigned int sysctl_sched_wakeup_granularity;
1899extern unsigned int sysctl_sched_shares_ratelimit; 1912extern unsigned int sysctl_sched_shares_ratelimit;
1900extern unsigned int sysctl_sched_shares_thresh; 1913extern unsigned int sysctl_sched_shares_thresh;
1901extern unsigned int sysctl_sched_child_runs_first; 1914extern unsigned int sysctl_sched_child_runs_first;
1915
1916enum sched_tunable_scaling {
1917 SCHED_TUNABLESCALING_NONE,
1918 SCHED_TUNABLESCALING_LOG,
1919 SCHED_TUNABLESCALING_LINEAR,
1920 SCHED_TUNABLESCALING_END,
1921};
1922extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
1923
1902#ifdef CONFIG_SCHED_DEBUG 1924#ifdef CONFIG_SCHED_DEBUG
1903extern unsigned int sysctl_sched_features;
1904extern unsigned int sysctl_sched_migration_cost; 1925extern unsigned int sysctl_sched_migration_cost;
1905extern unsigned int sysctl_sched_nr_migrate; 1926extern unsigned int sysctl_sched_nr_migrate;
1906extern unsigned int sysctl_sched_time_avg; 1927extern unsigned int sysctl_sched_time_avg;
1907extern unsigned int sysctl_timer_migration; 1928extern unsigned int sysctl_timer_migration;
1908 1929
1909int sched_nr_latency_handler(struct ctl_table *table, int write, 1930int sched_proc_update_handler(struct ctl_table *table, int write,
1910 void __user *buffer, size_t *length, 1931 void __user *buffer, size_t *length,
1911 loff_t *ppos); 1932 loff_t *ppos);
1912#endif 1933#endif
@@ -2062,7 +2083,6 @@ extern int kill_proc_info(int, struct siginfo *, pid_t);
2062extern int do_notify_parent(struct task_struct *, int); 2083extern int do_notify_parent(struct task_struct *, int);
2063extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); 2084extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
2064extern void force_sig(int, struct task_struct *); 2085extern void force_sig(int, struct task_struct *);
2065extern void force_sig_specific(int, struct task_struct *);
2066extern int send_sig(int, struct task_struct *, int); 2086extern int send_sig(int, struct task_struct *, int);
2067extern void zap_other_threads(struct task_struct *p); 2087extern void zap_other_threads(struct task_struct *p);
2068extern struct sigqueue *sigqueue_alloc(void); 2088extern struct sigqueue *sigqueue_alloc(void);
@@ -2081,16 +2101,18 @@ static inline int kill_cad_pid(int sig, int priv)
2081#define SEND_SIG_PRIV ((struct siginfo *) 1) 2101#define SEND_SIG_PRIV ((struct siginfo *) 1)
2082#define SEND_SIG_FORCED ((struct siginfo *) 2) 2102#define SEND_SIG_FORCED ((struct siginfo *) 2)
2083 2103
2084static inline int is_si_special(const struct siginfo *info) 2104/*
2085{ 2105 * True if we are on the alternate signal stack.
2086 return info <= SEND_SIG_FORCED; 2106 */
2087}
2088
2089/* True if we are on the alternate signal stack. */
2090
2091static inline int on_sig_stack(unsigned long sp) 2107static inline int on_sig_stack(unsigned long sp)
2092{ 2108{
2093 return (sp - current->sas_ss_sp < current->sas_ss_size); 2109#ifdef CONFIG_STACK_GROWSUP
2110 return sp >= current->sas_ss_sp &&
2111 sp - current->sas_ss_sp < current->sas_ss_size;
2112#else
2113 return sp > current->sas_ss_sp &&
2114 sp - current->sas_ss_sp <= current->sas_ss_size;
2115#endif
2094} 2116}
2095 2117
2096static inline int sas_ss_flags(unsigned long sp) 2118static inline int sas_ss_flags(unsigned long sp)