diff options
| author | Jeff Garzik <jeff@garzik.org> | 2006-04-12 16:54:16 -0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-04-12 16:54:16 -0400 |
| commit | 875999c5539999f61a45620aae0c3e5fb1d2b035 (patch) | |
| tree | 4535032a8a10f5782c0aef6a620b1a624ea9f863 /include/linux/sched.h | |
| parent | 79072f38909e3d9883317238887460c39ddcc4cb (diff) | |
| parent | 26ec634c31a11a003040e10b4d650495158632fd (diff) | |
Merge branch 'upstream'
Diffstat (limited to 'include/linux/sched.h')
| -rw-r--r-- | include/linux/sched.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index d04186d8cc68..e3539c14e47e 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -100,6 +100,7 @@ DECLARE_PER_CPU(unsigned long, process_counts); | |||
| 100 | extern int nr_processes(void); | 100 | extern int nr_processes(void); |
| 101 | extern unsigned long nr_running(void); | 101 | extern unsigned long nr_running(void); |
| 102 | extern unsigned long nr_uninterruptible(void); | 102 | extern unsigned long nr_uninterruptible(void); |
| 103 | extern unsigned long nr_active(void); | ||
| 103 | extern unsigned long nr_iowait(void); | 104 | extern unsigned long nr_iowait(void); |
| 104 | 105 | ||
| 105 | #include <linux/time.h> | 106 | #include <linux/time.h> |
| @@ -483,6 +484,7 @@ struct signal_struct { | |||
| 483 | #define MAX_PRIO (MAX_RT_PRIO + 40) | 484 | #define MAX_PRIO (MAX_RT_PRIO + 40) |
| 484 | 485 | ||
| 485 | #define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO)) | 486 | #define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO)) |
| 487 | #define batch_task(p) (unlikely((p)->policy == SCHED_BATCH)) | ||
| 486 | 488 | ||
| 487 | /* | 489 | /* |
| 488 | * Some day this will be a full-fledged user tracking system.. | 490 | * Some day this will be a full-fledged user tracking system.. |
| @@ -682,6 +684,14 @@ static inline void prefetch_stack(struct task_struct *t) { } | |||
| 682 | 684 | ||
| 683 | struct audit_context; /* See audit.c */ | 685 | struct audit_context; /* See audit.c */ |
| 684 | struct mempolicy; | 686 | struct mempolicy; |
| 687 | struct pipe_inode_info; | ||
| 688 | |||
| 689 | enum sleep_type { | ||
| 690 | SLEEP_NORMAL, | ||
| 691 | SLEEP_NONINTERACTIVE, | ||
| 692 | SLEEP_INTERACTIVE, | ||
| 693 | SLEEP_INTERRUPTED, | ||
| 694 | }; | ||
| 685 | 695 | ||
| 686 | struct task_struct { | 696 | struct task_struct { |
| 687 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ | 697 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ |
| @@ -705,7 +715,7 @@ struct task_struct { | |||
| 705 | unsigned long sleep_avg; | 715 | unsigned long sleep_avg; |
| 706 | unsigned long long timestamp, last_ran; | 716 | unsigned long long timestamp, last_ran; |
| 707 | unsigned long long sched_time; /* sched_clock time spent running */ | 717 | unsigned long long sched_time; /* sched_clock time spent running */ |
| 708 | int activated; | 718 | enum sleep_type sleep_type; |
| 709 | 719 | ||
| 710 | unsigned long policy; | 720 | unsigned long policy; |
| 711 | cpumask_t cpus_allowed; | 721 | cpumask_t cpus_allowed; |
| @@ -751,7 +761,7 @@ struct task_struct { | |||
| 751 | struct task_struct *group_leader; /* threadgroup leader */ | 761 | struct task_struct *group_leader; /* threadgroup leader */ |
| 752 | 762 | ||
| 753 | /* PID/PID hash table linkage. */ | 763 | /* PID/PID hash table linkage. */ |
| 754 | struct pid pids[PIDTYPE_MAX]; | 764 | struct pid_link pids[PIDTYPE_MAX]; |
| 755 | struct list_head thread_group; | 765 | struct list_head thread_group; |
| 756 | 766 | ||
| 757 | struct completion *vfork_done; /* for vfork() */ | 767 | struct completion *vfork_done; /* for vfork() */ |
| @@ -873,6 +883,11 @@ struct task_struct { | |||
| 873 | 883 | ||
| 874 | atomic_t fs_excl; /* holding fs exclusive resources */ | 884 | atomic_t fs_excl; /* holding fs exclusive resources */ |
| 875 | struct rcu_head rcu; | 885 | struct rcu_head rcu; |
| 886 | |||
| 887 | /* | ||
| 888 | * cache last used pipe for splice | ||
| 889 | */ | ||
| 890 | struct pipe_inode_info *splice_pipe; | ||
| 876 | }; | 891 | }; |
| 877 | 892 | ||
| 878 | static inline pid_t process_group(struct task_struct *tsk) | 893 | static inline pid_t process_group(struct task_struct *tsk) |
| @@ -890,18 +905,19 @@ static inline pid_t process_group(struct task_struct *tsk) | |||
| 890 | */ | 905 | */ |
| 891 | static inline int pid_alive(struct task_struct *p) | 906 | static inline int pid_alive(struct task_struct *p) |
| 892 | { | 907 | { |
| 893 | return p->pids[PIDTYPE_PID].nr != 0; | 908 | return p->pids[PIDTYPE_PID].pid != NULL; |
| 894 | } | 909 | } |
| 895 | 910 | ||
| 896 | extern void free_task(struct task_struct *tsk); | 911 | extern void free_task(struct task_struct *tsk); |
| 897 | #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) | 912 | #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) |
| 898 | 913 | ||
| 899 | extern void __put_task_struct_cb(struct rcu_head *rhp); | 914 | extern void __put_task_struct_cb(struct rcu_head *rhp); |
| 915 | extern void __put_task_struct(struct task_struct *t); | ||
| 900 | 916 | ||
| 901 | static inline void put_task_struct(struct task_struct *t) | 917 | static inline void put_task_struct(struct task_struct *t) |
| 902 | { | 918 | { |
| 903 | if (atomic_dec_and_test(&t->usage)) | 919 | if (atomic_dec_and_test(&t->usage)) |
| 904 | call_rcu(&t->rcu, __put_task_struct_cb); | 920 | __put_task_struct(t); |
| 905 | } | 921 | } |
| 906 | 922 | ||
| 907 | /* | 923 | /* |
| @@ -1193,9 +1209,10 @@ extern void wait_task_inactive(task_t * p); | |||
| 1193 | #define while_each_thread(g, t) \ | 1209 | #define while_each_thread(g, t) \ |
| 1194 | while ((t = next_thread(t)) != g) | 1210 | while ((t = next_thread(t)) != g) |
| 1195 | 1211 | ||
| 1196 | #define thread_group_leader(p) (p->pid == p->tgid) | 1212 | /* de_thread depends on thread_group_leader not being a pid based check */ |
| 1213 | #define thread_group_leader(p) (p == p->group_leader) | ||
| 1197 | 1214 | ||
| 1198 | static inline task_t *next_thread(task_t *p) | 1215 | static inline task_t *next_thread(const task_t *p) |
| 1199 | { | 1216 | { |
| 1200 | return list_entry(rcu_dereference(p->thread_group.next), | 1217 | return list_entry(rcu_dereference(p->thread_group.next), |
| 1201 | task_t, thread_group); | 1218 | task_t, thread_group); |
