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.h80
1 files changed, 61 insertions, 19 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 8af3d249170..75e6e60bf58 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -100,7 +100,7 @@ struct robust_list_head;
100struct bio; 100struct bio;
101struct fs_struct; 101struct fs_struct;
102struct bts_context; 102struct bts_context;
103struct perf_counter_context; 103struct perf_event_context;
104 104
105/* 105/*
106 * List of flags we want to share for kernel threads, 106 * List of flags we want to share for kernel threads,
@@ -140,6 +140,10 @@ extern int nr_processes(void);
140extern unsigned long nr_running(void); 140extern unsigned long nr_running(void);
141extern unsigned long nr_uninterruptible(void); 141extern unsigned long nr_uninterruptible(void);
142extern unsigned long nr_iowait(void); 142extern unsigned long nr_iowait(void);
143extern unsigned long nr_iowait_cpu(void);
144extern unsigned long this_cpu_load(void);
145
146
143extern void calc_global_load(void); 147extern void calc_global_load(void);
144extern u64 cpu_nr_migrations(int cpu); 148extern u64 cpu_nr_migrations(int cpu);
145 149
@@ -257,7 +261,7 @@ extern asmlinkage void schedule_tail(struct task_struct *prev);
257extern void init_idle(struct task_struct *idle, int cpu); 261extern void init_idle(struct task_struct *idle, int cpu);
258extern void init_idle_bootup_task(struct task_struct *idle); 262extern void init_idle_bootup_task(struct task_struct *idle);
259 263
260extern int runqueue_is_locked(void); 264extern int runqueue_is_locked(int cpu);
261extern void task_rq_unlock_wait(struct task_struct *p); 265extern void task_rq_unlock_wait(struct task_struct *p);
262 266
263extern cpumask_var_t nohz_cpu_mask; 267extern cpumask_var_t nohz_cpu_mask;
@@ -305,7 +309,7 @@ extern void softlockup_tick(void);
305extern void touch_softlockup_watchdog(void); 309extern void touch_softlockup_watchdog(void);
306extern void touch_all_softlockup_watchdogs(void); 310extern void touch_all_softlockup_watchdogs(void);
307extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, 311extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
308 struct file *filp, void __user *buffer, 312 void __user *buffer,
309 size_t *lenp, loff_t *ppos); 313 size_t *lenp, loff_t *ppos);
310extern unsigned int softlockup_panic; 314extern unsigned int softlockup_panic;
311extern int softlockup_thresh; 315extern int softlockup_thresh;
@@ -327,7 +331,7 @@ extern unsigned long sysctl_hung_task_check_count;
327extern unsigned long sysctl_hung_task_timeout_secs; 331extern unsigned long sysctl_hung_task_timeout_secs;
328extern unsigned long sysctl_hung_task_warnings; 332extern unsigned long sysctl_hung_task_warnings;
329extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, 333extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
330 struct file *filp, void __user *buffer, 334 void __user *buffer,
331 size_t *lenp, loff_t *ppos); 335 size_t *lenp, loff_t *ppos);
332#endif 336#endif
333 337
@@ -422,6 +426,15 @@ static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
422 return max(mm->hiwater_rss, get_mm_rss(mm)); 426 return max(mm->hiwater_rss, get_mm_rss(mm));
423} 427}
424 428
429static inline void setmax_mm_hiwater_rss(unsigned long *maxrss,
430 struct mm_struct *mm)
431{
432 unsigned long hiwater_rss = get_mm_hiwater_rss(mm);
433
434 if (*maxrss < hiwater_rss)
435 *maxrss = hiwater_rss;
436}
437
425static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) 438static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
426{ 439{
427 return max(mm->hiwater_vm, mm->total_vm); 440 return max(mm->hiwater_vm, mm->total_vm);
@@ -434,7 +447,9 @@ extern int get_dumpable(struct mm_struct *mm);
434/* dumpable bits */ 447/* dumpable bits */
435#define MMF_DUMPABLE 0 /* core dump is permitted */ 448#define MMF_DUMPABLE 0 /* core dump is permitted */
436#define MMF_DUMP_SECURELY 1 /* core file is readable only by root */ 449#define MMF_DUMP_SECURELY 1 /* core file is readable only by root */
450
437#define MMF_DUMPABLE_BITS 2 451#define MMF_DUMPABLE_BITS 2
452#define MMF_DUMPABLE_MASK ((1 << MMF_DUMPABLE_BITS) - 1)
438 453
439/* coredump filter bits */ 454/* coredump filter bits */
440#define MMF_DUMP_ANON_PRIVATE 2 455#define MMF_DUMP_ANON_PRIVATE 2
@@ -444,6 +459,7 @@ extern int get_dumpable(struct mm_struct *mm);
444#define MMF_DUMP_ELF_HEADERS 6 459#define MMF_DUMP_ELF_HEADERS 6
445#define MMF_DUMP_HUGETLB_PRIVATE 7 460#define MMF_DUMP_HUGETLB_PRIVATE 7
446#define MMF_DUMP_HUGETLB_SHARED 8 461#define MMF_DUMP_HUGETLB_SHARED 8
462
447#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS 463#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS
448#define MMF_DUMP_FILTER_BITS 7 464#define MMF_DUMP_FILTER_BITS 7
449#define MMF_DUMP_FILTER_MASK \ 465#define MMF_DUMP_FILTER_MASK \
@@ -457,6 +473,10 @@ extern int get_dumpable(struct mm_struct *mm);
457#else 473#else
458# define MMF_DUMP_MASK_DEFAULT_ELF 0 474# define MMF_DUMP_MASK_DEFAULT_ELF 0
459#endif 475#endif
476 /* leave room for more dump flags */
477#define MMF_VM_MERGEABLE 16 /* KSM may merge identical pages */
478
479#define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK)
460 480
461struct sighand_struct { 481struct sighand_struct {
462 atomic_t count; 482 atomic_t count;
@@ -473,6 +493,13 @@ struct pacct_struct {
473 unsigned long ac_minflt, ac_majflt; 493 unsigned long ac_minflt, ac_majflt;
474}; 494};
475 495
496struct cpu_itimer {
497 cputime_t expires;
498 cputime_t incr;
499 u32 error;
500 u32 incr_error;
501};
502
476/** 503/**
477 * struct task_cputime - collected CPU time counts 504 * struct task_cputime - collected CPU time counts
478 * @utime: time spent in user mode, in &cputime_t units 505 * @utime: time spent in user mode, in &cputime_t units
@@ -567,9 +594,12 @@ struct signal_struct {
567 struct pid *leader_pid; 594 struct pid *leader_pid;
568 ktime_t it_real_incr; 595 ktime_t it_real_incr;
569 596
570 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 597 /*
571 cputime_t it_prof_expires, it_virt_expires; 598 * ITIMER_PROF and ITIMER_VIRTUAL timers for the process, we use
572 cputime_t it_prof_incr, it_virt_incr; 599 * CPUCLOCK_PROF and CPUCLOCK_VIRT for indexing array as these
600 * values are defined to 0 and 1 respectively
601 */
602 struct cpu_itimer it[2];
573 603
574 /* 604 /*
575 * Thread group totals for process CPU timers. 605 * Thread group totals for process CPU timers.
@@ -601,6 +631,7 @@ struct signal_struct {
601 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 631 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
602 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; 632 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
603 unsigned long inblock, oublock, cinblock, coublock; 633 unsigned long inblock, oublock, cinblock, coublock;
634 unsigned long maxrss, cmaxrss;
604 struct task_io_accounting ioac; 635 struct task_io_accounting ioac;
605 636
606 /* 637 /*
@@ -632,6 +663,8 @@ struct signal_struct {
632 unsigned audit_tty; 663 unsigned audit_tty;
633 struct tty_audit_buf *tty_audit_buf; 664 struct tty_audit_buf *tty_audit_buf;
634#endif 665#endif
666
667 int oom_adj; /* OOM kill score adjustment (bit shift) */
635}; 668};
636 669
637/* Context switch must be unlocked if interrupts are to be enabled */ 670/* Context switch must be unlocked if interrupts are to be enabled */
@@ -701,7 +734,7 @@ struct user_struct {
701#endif 734#endif
702#endif 735#endif
703 736
704#ifdef CONFIG_PERF_COUNTERS 737#ifdef CONFIG_PERF_EVENTS
705 atomic_long_t locked_vm; 738 atomic_long_t locked_vm;
706#endif 739#endif
707}; 740};
@@ -1075,6 +1108,8 @@ struct sched_class {
1075 void (*prio_changed) (struct rq *this_rq, struct task_struct *task, 1108 void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
1076 int oldprio, int running); 1109 int oldprio, int running);
1077 1110
1111 unsigned int (*get_rr_interval) (struct task_struct *task);
1112
1078#ifdef CONFIG_FAIR_GROUP_SCHED 1113#ifdef CONFIG_FAIR_GROUP_SCHED
1079 void (*moved_group) (struct task_struct *p); 1114 void (*moved_group) (struct task_struct *p);
1080#endif 1115#endif
@@ -1212,7 +1247,6 @@ struct task_struct {
1212 * a short time 1247 * a short time
1213 */ 1248 */
1214 unsigned char fpu_counter; 1249 unsigned char fpu_counter;
1215 s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
1216#ifdef CONFIG_BLK_DEV_IO_TRACE 1250#ifdef CONFIG_BLK_DEV_IO_TRACE
1217 unsigned int btrace_seq; 1251 unsigned int btrace_seq;
1218#endif 1252#endif
@@ -1237,7 +1271,6 @@ struct task_struct {
1237 struct mm_struct *mm, *active_mm; 1271 struct mm_struct *mm, *active_mm;
1238 1272
1239/* task state */ 1273/* task state */
1240 struct linux_binfmt *binfmt;
1241 int exit_state; 1274 int exit_state;
1242 int exit_code, exit_signal; 1275 int exit_code, exit_signal;
1243 int pdeath_signal; /* The signal sent when the parent dies */ 1276 int pdeath_signal; /* The signal sent when the parent dies */
@@ -1449,10 +1482,10 @@ struct task_struct {
1449 struct list_head pi_state_list; 1482 struct list_head pi_state_list;
1450 struct futex_pi_state *pi_state_cache; 1483 struct futex_pi_state *pi_state_cache;
1451#endif 1484#endif
1452#ifdef CONFIG_PERF_COUNTERS 1485#ifdef CONFIG_PERF_EVENTS
1453 struct perf_counter_context *perf_counter_ctxp; 1486 struct perf_event_context *perf_event_ctxp;
1454 struct mutex perf_counter_mutex; 1487 struct mutex perf_event_mutex;
1455 struct list_head perf_counter_list; 1488 struct list_head perf_event_list;
1456#endif 1489#endif
1457#ifdef CONFIG_NUMA 1490#ifdef CONFIG_NUMA
1458 struct mempolicy *mempolicy; /* Protected by alloc_lock */ 1491 struct mempolicy *mempolicy; /* Protected by alloc_lock */
@@ -1505,6 +1538,7 @@ struct task_struct {
1505 /* bitmask of trace recursion */ 1538 /* bitmask of trace recursion */
1506 unsigned long trace_recursion; 1539 unsigned long trace_recursion;
1507#endif /* CONFIG_TRACING */ 1540#endif /* CONFIG_TRACING */
1541 unsigned long stack_start;
1508}; 1542};
1509 1543
1510/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1544/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -1700,6 +1734,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1700#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1734#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
1701#define PF_VCPU 0x00000010 /* I'm a virtual CPU */ 1735#define PF_VCPU 0x00000010 /* I'm a virtual CPU */
1702#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ 1736#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
1737#define PF_MCE_PROCESS 0x00000080 /* process policy on mce errors */
1703#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ 1738#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
1704#define PF_DUMPCORE 0x00000200 /* dumped core */ 1739#define PF_DUMPCORE 0x00000200 /* dumped core */
1705#define PF_SIGNALED 0x00000400 /* killed by a signal */ 1740#define PF_SIGNALED 0x00000400 /* killed by a signal */
@@ -1711,7 +1746,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1711#define PF_FROZEN 0x00010000 /* frozen for system suspend */ 1746#define PF_FROZEN 0x00010000 /* frozen for system suspend */
1712#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ 1747#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
1713#define PF_KSWAPD 0x00040000 /* I am kswapd */ 1748#define PF_KSWAPD 0x00040000 /* I am kswapd */
1714#define PF_SWAPOFF 0x00080000 /* I am in swapoff */ 1749#define PF_OOM_ORIGIN 0x00080000 /* Allocating much memory to others */
1715#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ 1750#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
1716#define PF_KTHREAD 0x00200000 /* I am a kernel thread */ 1751#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1717#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ 1752#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
@@ -1719,6 +1754,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1719#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ 1754#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
1720#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1755#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1721#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */ 1756#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */
1757#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1722#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1758#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1723#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1759#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1724#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ 1760#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */
@@ -1753,7 +1789,6 @@ extern cputime_t task_gtime(struct task_struct *p);
1753 1789
1754#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ 1790#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
1755#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */ 1791#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */
1756#define RCU_READ_UNLOCK_GOT_QS (1 << 2) /* CPU has responded to RCU core. */
1757 1792
1758static inline void rcu_copy_process(struct task_struct *p) 1793static inline void rcu_copy_process(struct task_struct *p)
1759{ 1794{
@@ -1783,10 +1818,13 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p,
1783 return 0; 1818 return 0;
1784} 1819}
1785#endif 1820#endif
1821
1822#ifndef CONFIG_CPUMASK_OFFSTACK
1786static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) 1823static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1787{ 1824{
1788 return set_cpus_allowed_ptr(p, &new_mask); 1825 return set_cpus_allowed_ptr(p, &new_mask);
1789} 1826}
1827#endif
1790 1828
1791/* 1829/*
1792 * Architectures can set this to 1 if they have specified 1830 * Architectures can set this to 1 if they have specified
@@ -1869,7 +1907,7 @@ extern unsigned int sysctl_sched_time_avg;
1869extern unsigned int sysctl_timer_migration; 1907extern unsigned int sysctl_timer_migration;
1870 1908
1871int sched_nr_latency_handler(struct ctl_table *table, int write, 1909int sched_nr_latency_handler(struct ctl_table *table, int write,
1872 struct file *file, void __user *buffer, size_t *length, 1910 void __user *buffer, size_t *length,
1873 loff_t *ppos); 1911 loff_t *ppos);
1874#endif 1912#endif
1875#ifdef CONFIG_SCHED_DEBUG 1913#ifdef CONFIG_SCHED_DEBUG
@@ -1887,7 +1925,7 @@ extern unsigned int sysctl_sched_rt_period;
1887extern int sysctl_sched_rt_runtime; 1925extern int sysctl_sched_rt_runtime;
1888 1926
1889int sched_rt_handler(struct ctl_table *table, int write, 1927int sched_rt_handler(struct ctl_table *table, int write,
1890 struct file *filp, void __user *buffer, size_t *lenp, 1928 void __user *buffer, size_t *lenp,
1891 loff_t *ppos); 1929 loff_t *ppos);
1892 1930
1893extern unsigned int sysctl_sched_compat_yield; 1931extern unsigned int sysctl_sched_compat_yield;
@@ -2022,6 +2060,7 @@ extern int kill_pgrp(struct pid *pid, int sig, int priv);
2022extern int kill_pid(struct pid *pid, int sig, int priv); 2060extern int kill_pid(struct pid *pid, int sig, int priv);
2023extern int kill_proc_info(int, struct siginfo *, pid_t); 2061extern int kill_proc_info(int, struct siginfo *, pid_t);
2024extern int do_notify_parent(struct task_struct *, int); 2062extern int do_notify_parent(struct task_struct *, int);
2063extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
2025extern void force_sig(int, struct task_struct *); 2064extern void force_sig(int, struct task_struct *);
2026extern void force_sig_specific(int, struct task_struct *); 2065extern void force_sig_specific(int, struct task_struct *);
2027extern int send_sig(int, struct task_struct *, int); 2066extern int send_sig(int, struct task_struct *, int);
@@ -2299,7 +2338,10 @@ static inline int signal_pending(struct task_struct *p)
2299 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); 2338 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
2300} 2339}
2301 2340
2302extern int __fatal_signal_pending(struct task_struct *p); 2341static inline int __fatal_signal_pending(struct task_struct *p)
2342{
2343 return unlikely(sigismember(&p->pending.signal, SIGKILL));
2344}
2303 2345
2304static inline int fatal_signal_pending(struct task_struct *p) 2346static inline int fatal_signal_pending(struct task_struct *p)
2305{ 2347{