diff options
Diffstat (limited to 'include/linux/sched.h')
| -rw-r--r-- | include/linux/sched.h | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 62e6314382f0..d04186d8cc68 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <linux/topology.h> | 35 | #include <linux/topology.h> |
| 36 | #include <linux/seccomp.h> | 36 | #include <linux/seccomp.h> |
| 37 | #include <linux/rcupdate.h> | 37 | #include <linux/rcupdate.h> |
| 38 | #include <linux/futex.h> | ||
| 38 | 39 | ||
| 39 | #include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ | 40 | #include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ |
| 40 | 41 | ||
| @@ -206,11 +207,11 @@ extern void update_process_times(int user); | |||
| 206 | extern void scheduler_tick(void); | 207 | extern void scheduler_tick(void); |
| 207 | 208 | ||
| 208 | #ifdef CONFIG_DETECT_SOFTLOCKUP | 209 | #ifdef CONFIG_DETECT_SOFTLOCKUP |
| 209 | extern void softlockup_tick(struct pt_regs *regs); | 210 | extern void softlockup_tick(void); |
| 210 | extern void spawn_softlockup_task(void); | 211 | extern void spawn_softlockup_task(void); |
| 211 | extern void touch_softlockup_watchdog(void); | 212 | extern void touch_softlockup_watchdog(void); |
| 212 | #else | 213 | #else |
| 213 | static inline void softlockup_tick(struct pt_regs *regs) | 214 | static inline void softlockup_tick(void) |
| 214 | { | 215 | { |
| 215 | } | 216 | } |
| 216 | static inline void spawn_softlockup_task(void) | 217 | static inline void spawn_softlockup_task(void) |
| @@ -354,16 +355,8 @@ struct sighand_struct { | |||
| 354 | atomic_t count; | 355 | atomic_t count; |
| 355 | struct k_sigaction action[_NSIG]; | 356 | struct k_sigaction action[_NSIG]; |
| 356 | spinlock_t siglock; | 357 | spinlock_t siglock; |
| 357 | struct rcu_head rcu; | ||
| 358 | }; | 358 | }; |
| 359 | 359 | ||
| 360 | extern void sighand_free_cb(struct rcu_head *rhp); | ||
| 361 | |||
| 362 | static inline void sighand_free(struct sighand_struct *sp) | ||
| 363 | { | ||
| 364 | call_rcu(&sp->rcu, sighand_free_cb); | ||
| 365 | } | ||
| 366 | |||
| 367 | /* | 360 | /* |
| 368 | * NOTE! "signal_struct" does not have it's own | 361 | * NOTE! "signal_struct" does not have it's own |
| 369 | * locking, because a shared signal_struct always | 362 | * locking, because a shared signal_struct always |
| @@ -402,6 +395,7 @@ struct signal_struct { | |||
| 402 | 395 | ||
| 403 | /* ITIMER_REAL timer for the process */ | 396 | /* ITIMER_REAL timer for the process */ |
| 404 | struct hrtimer real_timer; | 397 | struct hrtimer real_timer; |
| 398 | struct task_struct *tsk; | ||
| 405 | ktime_t it_real_incr; | 399 | ktime_t it_real_incr; |
| 406 | 400 | ||
| 407 | /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ | 401 | /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ |
| @@ -706,6 +700,7 @@ struct task_struct { | |||
| 706 | prio_array_t *array; | 700 | prio_array_t *array; |
| 707 | 701 | ||
| 708 | unsigned short ioprio; | 702 | unsigned short ioprio; |
| 703 | unsigned int btrace_seq; | ||
| 709 | 704 | ||
| 710 | unsigned long sleep_avg; | 705 | unsigned long sleep_avg; |
| 711 | unsigned long long timestamp, last_ran; | 706 | unsigned long long timestamp, last_ran; |
| @@ -757,6 +752,7 @@ struct task_struct { | |||
| 757 | 752 | ||
| 758 | /* PID/PID hash table linkage. */ | 753 | /* PID/PID hash table linkage. */ |
| 759 | struct pid pids[PIDTYPE_MAX]; | 754 | struct pid pids[PIDTYPE_MAX]; |
| 755 | struct list_head thread_group; | ||
| 760 | 756 | ||
| 761 | struct completion *vfork_done; /* for vfork() */ | 757 | struct completion *vfork_done; /* for vfork() */ |
| 762 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ | 758 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ |
| @@ -868,7 +864,13 @@ struct task_struct { | |||
| 868 | struct cpuset *cpuset; | 864 | struct cpuset *cpuset; |
| 869 | nodemask_t mems_allowed; | 865 | nodemask_t mems_allowed; |
| 870 | int cpuset_mems_generation; | 866 | int cpuset_mems_generation; |
| 867 | int cpuset_mem_spread_rotor; | ||
| 868 | #endif | ||
| 869 | struct robust_list_head __user *robust_list; | ||
| 870 | #ifdef CONFIG_COMPAT | ||
| 871 | struct compat_robust_list_head __user *compat_robust_list; | ||
| 871 | #endif | 872 | #endif |
| 873 | |||
| 872 | atomic_t fs_excl; /* holding fs exclusive resources */ | 874 | atomic_t fs_excl; /* holding fs exclusive resources */ |
| 873 | struct rcu_head rcu; | 875 | struct rcu_head rcu; |
| 874 | }; | 876 | }; |
| @@ -928,6 +930,9 @@ static inline void put_task_struct(struct task_struct *t) | |||
| 928 | #define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ | 930 | #define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ |
| 929 | #define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ | 931 | #define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ |
| 930 | #define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */ | 932 | #define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */ |
| 933 | #define PF_SPREAD_PAGE 0x04000000 /* Spread page cache over cpuset */ | ||
| 934 | #define PF_SPREAD_SLAB 0x08000000 /* Spread some slab caches over cpuset */ | ||
| 935 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ | ||
| 931 | 936 | ||
| 932 | /* | 937 | /* |
| 933 | * Only the _current_ task can read/write to tsk->flags, but other | 938 | * Only the _current_ task can read/write to tsk->flags, but other |
| @@ -1089,7 +1094,6 @@ extern void force_sig_specific(int, struct task_struct *); | |||
| 1089 | extern int send_sig(int, struct task_struct *, int); | 1094 | extern int send_sig(int, struct task_struct *, int); |
| 1090 | extern void zap_other_threads(struct task_struct *p); | 1095 | extern void zap_other_threads(struct task_struct *p); |
| 1091 | extern int kill_pg(pid_t, int, int); | 1096 | extern int kill_pg(pid_t, int, int); |
| 1092 | extern int kill_sl(pid_t, int, int); | ||
| 1093 | extern int kill_proc(pid_t, int, int); | 1097 | extern int kill_proc(pid_t, int, int); |
| 1094 | extern struct sigqueue *sigqueue_alloc(void); | 1098 | extern struct sigqueue *sigqueue_alloc(void); |
| 1095 | extern void sigqueue_free(struct sigqueue *); | 1099 | extern void sigqueue_free(struct sigqueue *); |
| @@ -1146,10 +1150,8 @@ extern void flush_thread(void); | |||
| 1146 | extern void exit_thread(void); | 1150 | extern void exit_thread(void); |
| 1147 | 1151 | ||
| 1148 | extern void exit_files(struct task_struct *); | 1152 | extern void exit_files(struct task_struct *); |
| 1149 | extern void exit_signal(struct task_struct *); | 1153 | extern void __cleanup_signal(struct signal_struct *); |
| 1150 | extern void __exit_signal(struct task_struct *); | 1154 | extern void __cleanup_sighand(struct sighand_struct *); |
| 1151 | extern void exit_sighand(struct task_struct *); | ||
| 1152 | extern void __exit_sighand(struct task_struct *); | ||
| 1153 | extern void exit_itimers(struct signal_struct *); | 1155 | extern void exit_itimers(struct signal_struct *); |
| 1154 | 1156 | ||
| 1155 | extern NORET_TYPE void do_group_exit(int); | 1157 | extern NORET_TYPE void do_group_exit(int); |
| @@ -1173,19 +1175,7 @@ extern void wait_task_inactive(task_t * p); | |||
| 1173 | #endif | 1175 | #endif |
| 1174 | 1176 | ||
| 1175 | #define remove_parent(p) list_del_init(&(p)->sibling) | 1177 | #define remove_parent(p) list_del_init(&(p)->sibling) |
| 1176 | #define add_parent(p, parent) list_add_tail(&(p)->sibling,&(parent)->children) | 1178 | #define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children) |
| 1177 | |||
| 1178 | #define REMOVE_LINKS(p) do { \ | ||
| 1179 | if (thread_group_leader(p)) \ | ||
| 1180 | list_del_init(&(p)->tasks); \ | ||
| 1181 | remove_parent(p); \ | ||
| 1182 | } while (0) | ||
| 1183 | |||
| 1184 | #define SET_LINKS(p) do { \ | ||
| 1185 | if (thread_group_leader(p)) \ | ||
| 1186 | list_add_tail(&(p)->tasks,&init_task.tasks); \ | ||
| 1187 | add_parent(p, (p)->parent); \ | ||
| 1188 | } while (0) | ||
| 1189 | 1179 | ||
| 1190 | #define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) | 1180 | #define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) |
| 1191 | #define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) | 1181 | #define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) |
| @@ -1203,20 +1193,22 @@ extern void wait_task_inactive(task_t * p); | |||
| 1203 | #define while_each_thread(g, t) \ | 1193 | #define while_each_thread(g, t) \ |
| 1204 | while ((t = next_thread(t)) != g) | 1194 | while ((t = next_thread(t)) != g) |
| 1205 | 1195 | ||
| 1206 | extern task_t * FASTCALL(next_thread(const task_t *p)); | ||
| 1207 | |||
| 1208 | #define thread_group_leader(p) (p->pid == p->tgid) | 1196 | #define thread_group_leader(p) (p->pid == p->tgid) |
| 1209 | 1197 | ||
| 1198 | static inline task_t *next_thread(task_t *p) | ||
| 1199 | { | ||
| 1200 | return list_entry(rcu_dereference(p->thread_group.next), | ||
| 1201 | task_t, thread_group); | ||
| 1202 | } | ||
| 1203 | |||
| 1210 | static inline int thread_group_empty(task_t *p) | 1204 | static inline int thread_group_empty(task_t *p) |
| 1211 | { | 1205 | { |
| 1212 | return list_empty(&p->pids[PIDTYPE_TGID].pid_list); | 1206 | return list_empty(&p->thread_group); |
| 1213 | } | 1207 | } |
| 1214 | 1208 | ||
| 1215 | #define delay_group_leader(p) \ | 1209 | #define delay_group_leader(p) \ |
| 1216 | (thread_group_leader(p) && !thread_group_empty(p)) | 1210 | (thread_group_leader(p) && !thread_group_empty(p)) |
| 1217 | 1211 | ||
| 1218 | extern void unhash_process(struct task_struct *p); | ||
| 1219 | |||
| 1220 | /* | 1212 | /* |
| 1221 | * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring | 1213 | * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring |
| 1222 | * subscriptions and synchronises with wait4(). Also used in procfs. Also | 1214 | * subscriptions and synchronises with wait4(). Also used in procfs. Also |
| @@ -1236,6 +1228,15 @@ static inline void task_unlock(struct task_struct *p) | |||
| 1236 | spin_unlock(&p->alloc_lock); | 1228 | spin_unlock(&p->alloc_lock); |
| 1237 | } | 1229 | } |
| 1238 | 1230 | ||
| 1231 | extern struct sighand_struct *lock_task_sighand(struct task_struct *tsk, | ||
| 1232 | unsigned long *flags); | ||
| 1233 | |||
| 1234 | static inline void unlock_task_sighand(struct task_struct *tsk, | ||
| 1235 | unsigned long *flags) | ||
| 1236 | { | ||
| 1237 | spin_unlock_irqrestore(&tsk->sighand->siglock, *flags); | ||
| 1238 | } | ||
| 1239 | |||
| 1239 | #ifndef __HAVE_THREAD_FUNCTIONS | 1240 | #ifndef __HAVE_THREAD_FUNCTIONS |
| 1240 | 1241 | ||
| 1241 | #define task_thread_info(task) (task)->thread_info | 1242 | #define task_thread_info(task) (task)->thread_info |
