diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 83bd2e2982fc..885c4f242ad7 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -360,7 +360,7 @@ extern signed long schedule_timeout_interruptible(signed long timeout); | |||
360 | extern signed long schedule_timeout_killable(signed long timeout); | 360 | extern signed long schedule_timeout_killable(signed long timeout); |
361 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | 361 | extern signed long schedule_timeout_uninterruptible(signed long timeout); |
362 | asmlinkage void schedule(void); | 362 | asmlinkage void schedule(void); |
363 | extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner); | 363 | extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner); |
364 | 364 | ||
365 | struct nsproxy; | 365 | struct nsproxy; |
366 | struct user_namespace; | 366 | struct user_namespace; |
@@ -653,9 +653,8 @@ struct signal_struct { | |||
653 | * Bits in flags field of signal_struct. | 653 | * Bits in flags field of signal_struct. |
654 | */ | 654 | */ |
655 | #define SIGNAL_STOP_STOPPED 0x00000001 /* job control stop in effect */ | 655 | #define SIGNAL_STOP_STOPPED 0x00000001 /* job control stop in effect */ |
656 | #define SIGNAL_STOP_DEQUEUED 0x00000002 /* stop signal dequeued */ | 656 | #define SIGNAL_STOP_CONTINUED 0x00000002 /* SIGCONT since WCONTINUED reap */ |
657 | #define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */ | 657 | #define SIGNAL_GROUP_EXIT 0x00000004 /* group exit in progress */ |
658 | #define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */ | ||
659 | /* | 658 | /* |
660 | * Pending notifications to parent. | 659 | * Pending notifications to parent. |
661 | */ | 660 | */ |
@@ -731,10 +730,6 @@ struct sched_info { | |||
731 | /* timestamps */ | 730 | /* timestamps */ |
732 | unsigned long long last_arrival,/* when we last ran on a cpu */ | 731 | unsigned long long last_arrival,/* when we last ran on a cpu */ |
733 | last_queued; /* when we were last queued to run */ | 732 | last_queued; /* when we were last queued to run */ |
734 | #ifdef CONFIG_SCHEDSTATS | ||
735 | /* BKL stats */ | ||
736 | unsigned int bkl_count; | ||
737 | #endif | ||
738 | }; | 733 | }; |
739 | #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ | 734 | #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ |
740 | 735 | ||
@@ -854,7 +849,7 @@ extern int __weak arch_sd_sibiling_asym_packing(void); | |||
854 | 849 | ||
855 | /* | 850 | /* |
856 | * Optimise SD flags for power savings: | 851 | * Optimise SD flags for power savings: |
857 | * SD_BALANCE_NEWIDLE helps agressive task consolidation and power savings. | 852 | * SD_BALANCE_NEWIDLE helps aggressive task consolidation and power savings. |
858 | * Keep default SD flags if sched_{smt,mc}_power_saving=0 | 853 | * Keep default SD flags if sched_{smt,mc}_power_saving=0 |
859 | */ | 854 | */ |
860 | 855 | ||
@@ -868,6 +863,7 @@ static inline int sd_power_saving_flags(void) | |||
868 | 863 | ||
869 | struct sched_group { | 864 | struct sched_group { |
870 | struct sched_group *next; /* Must be a circular list */ | 865 | struct sched_group *next; /* Must be a circular list */ |
866 | atomic_t ref; | ||
871 | 867 | ||
872 | /* | 868 | /* |
873 | * CPU power of this group, SCHED_LOAD_SCALE being max power for a | 869 | * CPU power of this group, SCHED_LOAD_SCALE being max power for a |
@@ -882,9 +878,6 @@ struct sched_group { | |||
882 | * NOTE: this field is variable length. (Allocated dynamically | 878 | * NOTE: this field is variable length. (Allocated dynamically |
883 | * by attaching extra space to the end of the structure, | 879 | * by attaching extra space to the end of the structure, |
884 | * depending on how many CPUs the kernel has booted up with) | 880 | * depending on how many CPUs the kernel has booted up with) |
885 | * | ||
886 | * It is also be embedded into static data structures at build | ||
887 | * time. (See 'struct static_sched_group' in kernel/sched.c) | ||
888 | */ | 881 | */ |
889 | unsigned long cpumask[0]; | 882 | unsigned long cpumask[0]; |
890 | }; | 883 | }; |
@@ -894,17 +887,6 @@ static inline struct cpumask *sched_group_cpus(struct sched_group *sg) | |||
894 | return to_cpumask(sg->cpumask); | 887 | return to_cpumask(sg->cpumask); |
895 | } | 888 | } |
896 | 889 | ||
897 | enum sched_domain_level { | ||
898 | SD_LV_NONE = 0, | ||
899 | SD_LV_SIBLING, | ||
900 | SD_LV_MC, | ||
901 | SD_LV_BOOK, | ||
902 | SD_LV_CPU, | ||
903 | SD_LV_NODE, | ||
904 | SD_LV_ALLNODES, | ||
905 | SD_LV_MAX | ||
906 | }; | ||
907 | |||
908 | struct sched_domain_attr { | 890 | struct sched_domain_attr { |
909 | int relax_domain_level; | 891 | int relax_domain_level; |
910 | }; | 892 | }; |
@@ -913,6 +895,8 @@ struct sched_domain_attr { | |||
913 | .relax_domain_level = -1, \ | 895 | .relax_domain_level = -1, \ |
914 | } | 896 | } |
915 | 897 | ||
898 | extern int sched_domain_level_max; | ||
899 | |||
916 | struct sched_domain { | 900 | struct sched_domain { |
917 | /* These fields must be setup */ | 901 | /* These fields must be setup */ |
918 | struct sched_domain *parent; /* top domain must be null terminated */ | 902 | struct sched_domain *parent; /* top domain must be null terminated */ |
@@ -930,7 +914,7 @@ struct sched_domain { | |||
930 | unsigned int forkexec_idx; | 914 | unsigned int forkexec_idx; |
931 | unsigned int smt_gain; | 915 | unsigned int smt_gain; |
932 | int flags; /* See SD_* */ | 916 | int flags; /* See SD_* */ |
933 | enum sched_domain_level level; | 917 | int level; |
934 | 918 | ||
935 | /* Runtime fields. */ | 919 | /* Runtime fields. */ |
936 | unsigned long last_balance; /* init to jiffies. units in jiffies */ | 920 | unsigned long last_balance; /* init to jiffies. units in jiffies */ |
@@ -973,6 +957,10 @@ struct sched_domain { | |||
973 | #ifdef CONFIG_SCHED_DEBUG | 957 | #ifdef CONFIG_SCHED_DEBUG |
974 | char *name; | 958 | char *name; |
975 | #endif | 959 | #endif |
960 | union { | ||
961 | void *private; /* used during construction */ | ||
962 | struct rcu_head rcu; /* used during destruction */ | ||
963 | }; | ||
976 | 964 | ||
977 | unsigned int span_weight; | 965 | unsigned int span_weight; |
978 | /* | 966 | /* |
@@ -981,9 +969,6 @@ struct sched_domain { | |||
981 | * NOTE: this field is variable length. (Allocated dynamically | 969 | * NOTE: this field is variable length. (Allocated dynamically |
982 | * by attaching extra space to the end of the structure, | 970 | * by attaching extra space to the end of the structure, |
983 | * depending on how many CPUs the kernel has booted up with) | 971 | * depending on how many CPUs the kernel has booted up with) |
984 | * | ||
985 | * It is also be embedded into static data structures at build | ||
986 | * time. (See 'struct static_sched_domain' in kernel/sched.c) | ||
987 | */ | 972 | */ |
988 | unsigned long span[0]; | 973 | unsigned long span[0]; |
989 | }; | 974 | }; |
@@ -1048,8 +1033,12 @@ struct sched_domain; | |||
1048 | #define WF_FORK 0x02 /* child wakeup after fork */ | 1033 | #define WF_FORK 0x02 /* child wakeup after fork */ |
1049 | 1034 | ||
1050 | #define ENQUEUE_WAKEUP 1 | 1035 | #define ENQUEUE_WAKEUP 1 |
1051 | #define ENQUEUE_WAKING 2 | 1036 | #define ENQUEUE_HEAD 2 |
1052 | #define ENQUEUE_HEAD 4 | 1037 | #ifdef CONFIG_SMP |
1038 | #define ENQUEUE_WAKING 4 /* sched_class::task_waking was called */ | ||
1039 | #else | ||
1040 | #define ENQUEUE_WAKING 0 | ||
1041 | #endif | ||
1053 | 1042 | ||
1054 | #define DEQUEUE_SLEEP 1 | 1043 | #define DEQUEUE_SLEEP 1 |
1055 | 1044 | ||
@@ -1067,12 +1056,11 @@ struct sched_class { | |||
1067 | void (*put_prev_task) (struct rq *rq, struct task_struct *p); | 1056 | void (*put_prev_task) (struct rq *rq, struct task_struct *p); |
1068 | 1057 | ||
1069 | #ifdef CONFIG_SMP | 1058 | #ifdef CONFIG_SMP |
1070 | int (*select_task_rq)(struct rq *rq, struct task_struct *p, | 1059 | int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); |
1071 | int sd_flag, int flags); | ||
1072 | 1060 | ||
1073 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); | 1061 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); |
1074 | void (*post_schedule) (struct rq *this_rq); | 1062 | void (*post_schedule) (struct rq *this_rq); |
1075 | void (*task_waking) (struct rq *this_rq, struct task_struct *task); | 1063 | void (*task_waking) (struct task_struct *task); |
1076 | void (*task_woken) (struct rq *this_rq, struct task_struct *task); | 1064 | void (*task_woken) (struct rq *this_rq, struct task_struct *task); |
1077 | 1065 | ||
1078 | void (*set_cpus_allowed)(struct task_struct *p, | 1066 | void (*set_cpus_allowed)(struct task_struct *p, |
@@ -1197,13 +1185,11 @@ struct task_struct { | |||
1197 | unsigned int flags; /* per process flags, defined below */ | 1185 | unsigned int flags; /* per process flags, defined below */ |
1198 | unsigned int ptrace; | 1186 | unsigned int ptrace; |
1199 | 1187 | ||
1200 | int lock_depth; /* BKL lock depth */ | ||
1201 | |||
1202 | #ifdef CONFIG_SMP | 1188 | #ifdef CONFIG_SMP |
1203 | #ifdef __ARCH_WANT_UNLOCKED_CTXSW | 1189 | struct task_struct *wake_entry; |
1204 | int oncpu; | 1190 | int on_cpu; |
1205 | #endif | ||
1206 | #endif | 1191 | #endif |
1192 | int on_rq; | ||
1207 | 1193 | ||
1208 | int prio, static_prio, normal_prio; | 1194 | int prio, static_prio, normal_prio; |
1209 | unsigned int rt_priority; | 1195 | unsigned int rt_priority; |
@@ -1254,6 +1240,9 @@ struct task_struct { | |||
1254 | #endif | 1240 | #endif |
1255 | 1241 | ||
1256 | struct mm_struct *mm, *active_mm; | 1242 | struct mm_struct *mm, *active_mm; |
1243 | #ifdef CONFIG_COMPAT_BRK | ||
1244 | unsigned brk_randomized:1; | ||
1245 | #endif | ||
1257 | #if defined(SPLIT_RSS_COUNTING) | 1246 | #if defined(SPLIT_RSS_COUNTING) |
1258 | struct task_rss_stat rss_stat; | 1247 | struct task_rss_stat rss_stat; |
1259 | #endif | 1248 | #endif |
@@ -1261,6 +1250,7 @@ struct task_struct { | |||
1261 | int exit_state; | 1250 | int exit_state; |
1262 | int exit_code, exit_signal; | 1251 | int exit_code, exit_signal; |
1263 | int pdeath_signal; /* The signal sent when the parent dies */ | 1252 | int pdeath_signal; /* The signal sent when the parent dies */ |
1253 | unsigned int group_stop; /* GROUP_STOP_*, siglock protected */ | ||
1264 | /* ??? */ | 1254 | /* ??? */ |
1265 | unsigned int personality; | 1255 | unsigned int personality; |
1266 | unsigned did_exec:1; | 1256 | unsigned did_exec:1; |
@@ -1271,6 +1261,7 @@ struct task_struct { | |||
1271 | 1261 | ||
1272 | /* Revert to default priority/policy when forking */ | 1262 | /* Revert to default priority/policy when forking */ |
1273 | unsigned sched_reset_on_fork:1; | 1263 | unsigned sched_reset_on_fork:1; |
1264 | unsigned sched_contributes_to_load:1; | ||
1274 | 1265 | ||
1275 | pid_t pid; | 1266 | pid_t pid; |
1276 | pid_t tgid; | 1267 | pid_t tgid; |
@@ -1534,6 +1525,9 @@ struct task_struct { | |||
1534 | unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ | 1525 | unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ |
1535 | } memcg_batch; | 1526 | } memcg_batch; |
1536 | #endif | 1527 | #endif |
1528 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
1529 | atomic_t ptrace_bp_refcnt; | ||
1530 | #endif | ||
1537 | }; | 1531 | }; |
1538 | 1532 | ||
1539 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ | 1533 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ |
@@ -1777,6 +1771,17 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t * | |||
1777 | #define tsk_used_math(p) ((p)->flags & PF_USED_MATH) | 1771 | #define tsk_used_math(p) ((p)->flags & PF_USED_MATH) |
1778 | #define used_math() tsk_used_math(current) | 1772 | #define used_math() tsk_used_math(current) |
1779 | 1773 | ||
1774 | /* | ||
1775 | * task->group_stop flags | ||
1776 | */ | ||
1777 | #define GROUP_STOP_SIGMASK 0xffff /* signr of the last group stop */ | ||
1778 | #define GROUP_STOP_PENDING (1 << 16) /* task should stop for group stop */ | ||
1779 | #define GROUP_STOP_CONSUME (1 << 17) /* consume group stop count */ | ||
1780 | #define GROUP_STOP_TRAPPING (1 << 18) /* switching from STOPPED to TRACED */ | ||
1781 | #define GROUP_STOP_DEQUEUED (1 << 19) /* stop signal dequeued */ | ||
1782 | |||
1783 | extern void task_clear_group_stop_pending(struct task_struct *task); | ||
1784 | |||
1780 | #ifdef CONFIG_PREEMPT_RCU | 1785 | #ifdef CONFIG_PREEMPT_RCU |
1781 | 1786 | ||
1782 | #define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ | 1787 | #define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ |
@@ -2057,14 +2062,13 @@ extern void xtime_update(unsigned long ticks); | |||
2057 | 2062 | ||
2058 | extern int wake_up_state(struct task_struct *tsk, unsigned int state); | 2063 | extern int wake_up_state(struct task_struct *tsk, unsigned int state); |
2059 | extern int wake_up_process(struct task_struct *tsk); | 2064 | extern int wake_up_process(struct task_struct *tsk); |
2060 | extern void wake_up_new_task(struct task_struct *tsk, | 2065 | extern void wake_up_new_task(struct task_struct *tsk); |
2061 | unsigned long clone_flags); | ||
2062 | #ifdef CONFIG_SMP | 2066 | #ifdef CONFIG_SMP |
2063 | extern void kick_process(struct task_struct *tsk); | 2067 | extern void kick_process(struct task_struct *tsk); |
2064 | #else | 2068 | #else |
2065 | static inline void kick_process(struct task_struct *tsk) { } | 2069 | static inline void kick_process(struct task_struct *tsk) { } |
2066 | #endif | 2070 | #endif |
2067 | extern void sched_fork(struct task_struct *p, int clone_flags); | 2071 | extern void sched_fork(struct task_struct *p); |
2068 | extern void sched_dead(struct task_struct *p); | 2072 | extern void sched_dead(struct task_struct *p); |
2069 | 2073 | ||
2070 | extern void proc_caches_init(void); | 2074 | extern void proc_caches_init(void); |
@@ -2189,8 +2193,10 @@ extern void set_task_comm(struct task_struct *tsk, char *from); | |||
2189 | extern char *get_task_comm(char *to, struct task_struct *tsk); | 2193 | extern char *get_task_comm(char *to, struct task_struct *tsk); |
2190 | 2194 | ||
2191 | #ifdef CONFIG_SMP | 2195 | #ifdef CONFIG_SMP |
2196 | void scheduler_ipi(void); | ||
2192 | extern unsigned long wait_task_inactive(struct task_struct *, long match_state); | 2197 | extern unsigned long wait_task_inactive(struct task_struct *, long match_state); |
2193 | #else | 2198 | #else |
2199 | static inline void scheduler_ipi(void) { } | ||
2194 | static inline unsigned long wait_task_inactive(struct task_struct *p, | 2200 | static inline unsigned long wait_task_inactive(struct task_struct *p, |
2195 | long match_state) | 2201 | long match_state) |
2196 | { | 2202 | { |