diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index d04186d8cc68..541f4828f5e7 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.. |
@@ -683,6 +685,13 @@ static inline void prefetch_stack(struct task_struct *t) { } | |||
683 | struct audit_context; /* See audit.c */ | 685 | struct audit_context; /* See audit.c */ |
684 | struct mempolicy; | 686 | struct mempolicy; |
685 | 687 | ||
688 | enum sleep_type { | ||
689 | SLEEP_NORMAL, | ||
690 | SLEEP_NONINTERACTIVE, | ||
691 | SLEEP_INTERACTIVE, | ||
692 | SLEEP_INTERRUPTED, | ||
693 | }; | ||
694 | |||
686 | struct task_struct { | 695 | struct task_struct { |
687 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ | 696 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ |
688 | struct thread_info *thread_info; | 697 | struct thread_info *thread_info; |
@@ -705,7 +714,7 @@ struct task_struct { | |||
705 | unsigned long sleep_avg; | 714 | unsigned long sleep_avg; |
706 | unsigned long long timestamp, last_ran; | 715 | unsigned long long timestamp, last_ran; |
707 | unsigned long long sched_time; /* sched_clock time spent running */ | 716 | unsigned long long sched_time; /* sched_clock time spent running */ |
708 | int activated; | 717 | enum sleep_type sleep_type; |
709 | 718 | ||
710 | unsigned long policy; | 719 | unsigned long policy; |
711 | cpumask_t cpus_allowed; | 720 | cpumask_t cpus_allowed; |
@@ -751,7 +760,7 @@ struct task_struct { | |||
751 | struct task_struct *group_leader; /* threadgroup leader */ | 760 | struct task_struct *group_leader; /* threadgroup leader */ |
752 | 761 | ||
753 | /* PID/PID hash table linkage. */ | 762 | /* PID/PID hash table linkage. */ |
754 | struct pid pids[PIDTYPE_MAX]; | 763 | struct pid_link pids[PIDTYPE_MAX]; |
755 | struct list_head thread_group; | 764 | struct list_head thread_group; |
756 | 765 | ||
757 | struct completion *vfork_done; /* for vfork() */ | 766 | struct completion *vfork_done; /* for vfork() */ |
@@ -890,18 +899,19 @@ static inline pid_t process_group(struct task_struct *tsk) | |||
890 | */ | 899 | */ |
891 | static inline int pid_alive(struct task_struct *p) | 900 | static inline int pid_alive(struct task_struct *p) |
892 | { | 901 | { |
893 | return p->pids[PIDTYPE_PID].nr != 0; | 902 | return p->pids[PIDTYPE_PID].pid != NULL; |
894 | } | 903 | } |
895 | 904 | ||
896 | extern void free_task(struct task_struct *tsk); | 905 | extern void free_task(struct task_struct *tsk); |
897 | #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) | 906 | #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) |
898 | 907 | ||
899 | extern void __put_task_struct_cb(struct rcu_head *rhp); | 908 | extern void __put_task_struct_cb(struct rcu_head *rhp); |
909 | extern void __put_task_struct(struct task_struct *t); | ||
900 | 910 | ||
901 | static inline void put_task_struct(struct task_struct *t) | 911 | static inline void put_task_struct(struct task_struct *t) |
902 | { | 912 | { |
903 | if (atomic_dec_and_test(&t->usage)) | 913 | if (atomic_dec_and_test(&t->usage)) |
904 | call_rcu(&t->rcu, __put_task_struct_cb); | 914 | __put_task_struct(t); |
905 | } | 915 | } |
906 | 916 | ||
907 | /* | 917 | /* |