diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 104 |
1 files changed, 61 insertions, 43 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index c5d3f847ca8d..1941d8b5cf11 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -134,7 +134,6 @@ extern unsigned long nr_running(void); | |||
134 | extern unsigned long nr_uninterruptible(void); | 134 | extern unsigned long nr_uninterruptible(void); |
135 | extern unsigned long nr_active(void); | 135 | extern unsigned long nr_active(void); |
136 | extern unsigned long nr_iowait(void); | 136 | extern unsigned long nr_iowait(void); |
137 | extern unsigned long weighted_cpuload(const int cpu); | ||
138 | 137 | ||
139 | struct seq_file; | 138 | struct seq_file; |
140 | struct cfs_rq; | 139 | struct cfs_rq; |
@@ -246,6 +245,8 @@ extern asmlinkage void schedule_tail(struct task_struct *prev); | |||
246 | extern void init_idle(struct task_struct *idle, int cpu); | 245 | extern void init_idle(struct task_struct *idle, int cpu); |
247 | extern void init_idle_bootup_task(struct task_struct *idle); | 246 | extern void init_idle_bootup_task(struct task_struct *idle); |
248 | 247 | ||
248 | extern int runqueue_is_locked(void); | ||
249 | |||
249 | extern cpumask_t nohz_cpu_mask; | 250 | extern cpumask_t nohz_cpu_mask; |
250 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) | 251 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) |
251 | extern int select_nohz_load_balancer(int cpu); | 252 | extern 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 | */ | ||
832 | static 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 | |||
843 | struct io_context; /* See blkdev.h */ | 829 | struct 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; |
@@ -1075,12 +1062,6 @@ struct task_struct { | |||
1075 | #endif | 1062 | #endif |
1076 | 1063 | ||
1077 | struct list_head tasks; | 1064 | struct list_head tasks; |
1078 | /* | ||
1079 | * ptrace_list/ptrace_children forms the list of my children | ||
1080 | * that were stolen by a ptracer. | ||
1081 | */ | ||
1082 | struct list_head ptrace_children; | ||
1083 | struct list_head ptrace_list; | ||
1084 | 1065 | ||
1085 | struct mm_struct *mm, *active_mm; | 1066 | struct mm_struct *mm, *active_mm; |
1086 | 1067 | ||
@@ -1102,18 +1083,25 @@ struct task_struct { | |||
1102 | /* | 1083 | /* |
1103 | * pointers to (original) parent process, youngest child, younger sibling, | 1084 | * pointers to (original) parent process, youngest child, younger sibling, |
1104 | * older sibling, respectively. (p->father can be replaced with | 1085 | * older sibling, respectively. (p->father can be replaced with |
1105 | * p->parent->pid) | 1086 | * p->real_parent->pid) |
1106 | */ | 1087 | */ |
1107 | struct task_struct *real_parent; /* real parent process (when being debugged) */ | 1088 | struct task_struct *real_parent; /* real parent process */ |
1108 | struct task_struct *parent; /* parent process */ | 1089 | struct task_struct *parent; /* recipient of SIGCHLD, wait4() reports */ |
1109 | /* | 1090 | /* |
1110 | * children/sibling forms the list of my children plus the | 1091 | * children/sibling forms the list of my natural children |
1111 | * tasks I'm ptracing. | ||
1112 | */ | 1092 | */ |
1113 | struct list_head children; /* list of my children */ | 1093 | struct list_head children; /* list of my children */ |
1114 | struct list_head sibling; /* linkage in my parent's children list */ | 1094 | struct list_head sibling; /* linkage in my parent's children list */ |
1115 | struct task_struct *group_leader; /* threadgroup leader */ | 1095 | struct task_struct *group_leader; /* threadgroup leader */ |
1116 | 1096 | ||
1097 | /* | ||
1098 | * ptraced is the list of tasks this task is using ptrace on. | ||
1099 | * This includes both natural children and PTRACE_ATTACH targets. | ||
1100 | * p->ptrace_entry is p's link on the p->parent->ptraced list. | ||
1101 | */ | ||
1102 | struct list_head ptraced; | ||
1103 | struct list_head ptrace_entry; | ||
1104 | |||
1117 | /* PID/PID hash table linkage. */ | 1105 | /* PID/PID hash table linkage. */ |
1118 | struct pid_link pids[PIDTYPE_MAX]; | 1106 | struct pid_link pids[PIDTYPE_MAX]; |
1119 | struct list_head thread_group; | 1107 | struct list_head thread_group; |
@@ -1122,7 +1110,6 @@ struct task_struct { | |||
1122 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ | 1110 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ |
1123 | int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */ | 1111 | int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */ |
1124 | 1112 | ||
1125 | unsigned int rt_priority; | ||
1126 | cputime_t utime, stime, utimescaled, stimescaled; | 1113 | cputime_t utime, stime, utimescaled, stimescaled; |
1127 | cputime_t gtime; | 1114 | cputime_t gtime; |
1128 | cputime_t prev_utime, prev_stime; | 1115 | cputime_t prev_utime, prev_stime; |
@@ -1141,12 +1128,12 @@ struct task_struct { | |||
1141 | gid_t gid,egid,sgid,fsgid; | 1128 | gid_t gid,egid,sgid,fsgid; |
1142 | struct group_info *group_info; | 1129 | struct group_info *group_info; |
1143 | kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; | 1130 | kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; |
1144 | unsigned securebits; | ||
1145 | struct user_struct *user; | 1131 | struct user_struct *user; |
1132 | unsigned securebits; | ||
1146 | #ifdef CONFIG_KEYS | 1133 | #ifdef CONFIG_KEYS |
1134 | unsigned char jit_keyring; /* default keyring to attach requested keys to */ | ||
1147 | struct key *request_key_auth; /* assumed request_key authority */ | 1135 | struct key *request_key_auth; /* assumed request_key authority */ |
1148 | struct key *thread_keyring; /* keyring private to this thread */ | 1136 | struct key *thread_keyring; /* keyring private to this thread */ |
1149 | unsigned char jit_keyring; /* default keyring to attach requested keys to */ | ||
1150 | #endif | 1137 | #endif |
1151 | char comm[TASK_COMM_LEN]; /* executable name excluding path | 1138 | char comm[TASK_COMM_LEN]; /* executable name excluding path |
1152 | - access with [gs]et_task_comm (which lock | 1139 | - access with [gs]et_task_comm (which lock |
@@ -1233,8 +1220,8 @@ struct task_struct { | |||
1233 | # define MAX_LOCK_DEPTH 48UL | 1220 | # define MAX_LOCK_DEPTH 48UL |
1234 | u64 curr_chain_key; | 1221 | u64 curr_chain_key; |
1235 | int lockdep_depth; | 1222 | int lockdep_depth; |
1236 | struct held_lock held_locks[MAX_LOCK_DEPTH]; | ||
1237 | unsigned int lockdep_recursion; | 1223 | unsigned int lockdep_recursion; |
1224 | struct held_lock held_locks[MAX_LOCK_DEPTH]; | ||
1238 | #endif | 1225 | #endif |
1239 | 1226 | ||
1240 | /* journalling filesystem info */ | 1227 | /* journalling filesystem info */ |
@@ -1262,10 +1249,6 @@ struct task_struct { | |||
1262 | u64 acct_vm_mem1; /* accumulated virtual memory usage */ | 1249 | u64 acct_vm_mem1; /* accumulated virtual memory usage */ |
1263 | cputime_t acct_stimexpd;/* stime since last update */ | 1250 | cputime_t acct_stimexpd;/* stime since last update */ |
1264 | #endif | 1251 | #endif |
1265 | #ifdef CONFIG_NUMA | ||
1266 | struct mempolicy *mempolicy; | ||
1267 | short il_next; | ||
1268 | #endif | ||
1269 | #ifdef CONFIG_CPUSETS | 1252 | #ifdef CONFIG_CPUSETS |
1270 | nodemask_t mems_allowed; | 1253 | nodemask_t mems_allowed; |
1271 | int cpuset_mems_generation; | 1254 | int cpuset_mems_generation; |
@@ -1285,6 +1268,10 @@ struct task_struct { | |||
1285 | struct list_head pi_state_list; | 1268 | struct list_head pi_state_list; |
1286 | struct futex_pi_state *pi_state_cache; | 1269 | struct futex_pi_state *pi_state_cache; |
1287 | #endif | 1270 | #endif |
1271 | #ifdef CONFIG_NUMA | ||
1272 | struct mempolicy *mempolicy; | ||
1273 | short il_next; | ||
1274 | #endif | ||
1288 | atomic_t fs_excl; /* holding fs exclusive resources */ | 1275 | atomic_t fs_excl; /* holding fs exclusive resources */ |
1289 | struct rcu_head rcu; | 1276 | struct rcu_head rcu; |
1290 | 1277 | ||
@@ -1504,9 +1491,11 @@ static inline void put_task_struct(struct task_struct *t) | |||
1504 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ | 1491 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ |
1505 | #define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ | 1492 | #define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ |
1506 | #define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ | 1493 | #define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ |
1494 | #define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */ | ||
1507 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ | 1495 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ |
1508 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ | 1496 | #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 */ | 1497 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ |
1498 | #define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */ | ||
1510 | 1499 | ||
1511 | /* | 1500 | /* |
1512 | * Only the _current_ task can read/write to tsk->flags, but other | 1501 | * Only the _current_ task can read/write to tsk->flags, but other |
@@ -1573,13 +1562,28 @@ static inline void sched_clock_idle_sleep_event(void) | |||
1573 | static inline void sched_clock_idle_wakeup_event(u64 delta_ns) | 1562 | static inline void sched_clock_idle_wakeup_event(u64 delta_ns) |
1574 | { | 1563 | { |
1575 | } | 1564 | } |
1576 | #else | 1565 | |
1566 | #ifdef CONFIG_NO_HZ | ||
1567 | static inline void sched_clock_tick_stop(int cpu) | ||
1568 | { | ||
1569 | } | ||
1570 | |||
1571 | static inline void sched_clock_tick_start(int cpu) | ||
1572 | { | ||
1573 | } | ||
1574 | #endif | ||
1575 | |||
1576 | #else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */ | ||
1577 | extern void sched_clock_init(void); | 1577 | extern void sched_clock_init(void); |
1578 | extern u64 sched_clock_cpu(int cpu); | 1578 | extern u64 sched_clock_cpu(int cpu); |
1579 | extern void sched_clock_tick(void); | 1579 | extern void sched_clock_tick(void); |
1580 | extern void sched_clock_idle_sleep_event(void); | 1580 | extern void sched_clock_idle_sleep_event(void); |
1581 | extern void sched_clock_idle_wakeup_event(u64 delta_ns); | 1581 | extern void sched_clock_idle_wakeup_event(u64 delta_ns); |
1582 | #ifdef CONFIG_NO_HZ | ||
1583 | extern void sched_clock_tick_stop(int cpu); | ||
1584 | extern void sched_clock_tick_start(int cpu); | ||
1582 | #endif | 1585 | #endif |
1586 | #endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */ | ||
1583 | 1587 | ||
1584 | /* | 1588 | /* |
1585 | * For kernel-internal use: high-speed (but slightly incorrect) per-cpu | 1589 | * For kernel-internal use: high-speed (but slightly incorrect) per-cpu |
@@ -1622,6 +1626,7 @@ extern unsigned int sysctl_sched_child_runs_first; | |||
1622 | extern unsigned int sysctl_sched_features; | 1626 | extern unsigned int sysctl_sched_features; |
1623 | extern unsigned int sysctl_sched_migration_cost; | 1627 | extern unsigned int sysctl_sched_migration_cost; |
1624 | extern unsigned int sysctl_sched_nr_migrate; | 1628 | extern unsigned int sysctl_sched_nr_migrate; |
1629 | extern unsigned int sysctl_sched_shares_ratelimit; | ||
1625 | 1630 | ||
1626 | int sched_nr_latency_handler(struct ctl_table *table, int write, | 1631 | int sched_nr_latency_handler(struct ctl_table *table, int write, |
1627 | struct file *file, void __user *buffer, size_t *length, | 1632 | struct file *file, void __user *buffer, size_t *length, |
@@ -1655,6 +1660,8 @@ extern int can_nice(const struct task_struct *p, const int nice); | |||
1655 | extern int task_curr(const struct task_struct *p); | 1660 | extern int task_curr(const struct task_struct *p); |
1656 | extern int idle_cpu(int cpu); | 1661 | extern int idle_cpu(int cpu); |
1657 | extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); | 1662 | extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); |
1663 | extern int sched_setscheduler_nocheck(struct task_struct *, int, | ||
1664 | struct sched_param *); | ||
1658 | extern struct task_struct *idle_task(int cpu); | 1665 | extern struct task_struct *idle_task(int cpu); |
1659 | extern struct task_struct *curr_task(int cpu); | 1666 | extern struct task_struct *curr_task(int cpu); |
1660 | extern void set_curr_task(int cpu, struct task_struct *p); | 1667 | extern void set_curr_task(int cpu, struct task_struct *p); |
@@ -1870,9 +1877,6 @@ extern void wait_task_inactive(struct task_struct * p); | |||
1870 | #define wait_task_inactive(p) do { } while (0) | 1877 | #define wait_task_inactive(p) do { } while (0) |
1871 | #endif | 1878 | #endif |
1872 | 1879 | ||
1873 | #define remove_parent(p) list_del_init(&(p)->sibling) | ||
1874 | #define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children) | ||
1875 | |||
1876 | #define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks) | 1880 | #define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks) |
1877 | 1881 | ||
1878 | #define for_each_process(p) \ | 1882 | #define for_each_process(p) \ |
@@ -2131,6 +2135,18 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) | |||
2131 | } | 2135 | } |
2132 | #endif | 2136 | #endif |
2133 | 2137 | ||
2138 | #ifdef CONFIG_TRACING | ||
2139 | extern void | ||
2140 | __trace_special(void *__tr, void *__data, | ||
2141 | unsigned long arg1, unsigned long arg2, unsigned long arg3); | ||
2142 | #else | ||
2143 | static inline void | ||
2144 | __trace_special(void *__tr, void *__data, | ||
2145 | unsigned long arg1, unsigned long arg2, unsigned long arg3) | ||
2146 | { | ||
2147 | } | ||
2148 | #endif | ||
2149 | |||
2134 | extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask); | 2150 | extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask); |
2135 | extern long sched_getaffinity(pid_t pid, cpumask_t *mask); | 2151 | extern long sched_getaffinity(pid_t pid, cpumask_t *mask); |
2136 | 2152 | ||
@@ -2225,6 +2241,8 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) | |||
2225 | } | 2241 | } |
2226 | #endif /* CONFIG_MM_OWNER */ | 2242 | #endif /* CONFIG_MM_OWNER */ |
2227 | 2243 | ||
2244 | #define TASK_STATE_TO_CHAR_STR "RSDTtZX" | ||
2245 | |||
2228 | #endif /* __KERNEL__ */ | 2246 | #endif /* __KERNEL__ */ |
2229 | 2247 | ||
2230 | #endif | 2248 | #endif |