diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 94 |
1 files changed, 55 insertions, 39 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 379531c08975..f3d74bd04d18 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -38,6 +38,8 @@ | |||
38 | #define SCHED_BATCH 3 | 38 | #define SCHED_BATCH 3 |
39 | /* SCHED_ISO: reserved but not implemented yet */ | 39 | /* SCHED_ISO: reserved but not implemented yet */ |
40 | #define SCHED_IDLE 5 | 40 | #define SCHED_IDLE 5 |
41 | /* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */ | ||
42 | #define SCHED_RESET_ON_FORK 0x40000000 | ||
41 | 43 | ||
42 | #ifdef __KERNEL__ | 44 | #ifdef __KERNEL__ |
43 | 45 | ||
@@ -796,18 +798,19 @@ enum cpu_idle_type { | |||
796 | #define SCHED_LOAD_SCALE_FUZZ SCHED_LOAD_SCALE | 798 | #define SCHED_LOAD_SCALE_FUZZ SCHED_LOAD_SCALE |
797 | 799 | ||
798 | #ifdef CONFIG_SMP | 800 | #ifdef CONFIG_SMP |
799 | #define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ | 801 | #define SD_LOAD_BALANCE 0x0001 /* Do load balancing on this domain. */ |
800 | #define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */ | 802 | #define SD_BALANCE_NEWIDLE 0x0002 /* Balance when about to become idle */ |
801 | #define SD_BALANCE_EXEC 4 /* Balance on exec */ | 803 | #define SD_BALANCE_EXEC 0x0004 /* Balance on exec */ |
802 | #define SD_BALANCE_FORK 8 /* Balance on fork, clone */ | 804 | #define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */ |
803 | #define SD_WAKE_IDLE 16 /* Wake to idle CPU on task wakeup */ | 805 | #define SD_WAKE_IDLE 0x0010 /* Wake to idle CPU on task wakeup */ |
804 | #define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */ | 806 | #define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */ |
805 | #define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */ | 807 | #define SD_WAKE_BALANCE 0x0040 /* Perform balancing at task wakeup */ |
806 | #define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ | 808 | #define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */ |
807 | #define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */ | 809 | #define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */ |
808 | #define SD_SHARE_PKG_RESOURCES 512 /* Domain members share cpu pkg resources */ | 810 | #define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ |
809 | #define SD_SERIALIZE 1024 /* Only a single load balancing instance */ | 811 | #define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ |
810 | #define SD_WAKE_IDLE_FAR 2048 /* Gain latency sacrificing cache hit */ | 812 | #define SD_WAKE_IDLE_FAR 0x0800 /* Gain latency sacrificing cache hit */ |
813 | #define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ | ||
811 | 814 | ||
812 | enum powersavings_balance_level { | 815 | enum powersavings_balance_level { |
813 | POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */ | 816 | POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */ |
@@ -827,7 +830,7 @@ static inline int sd_balance_for_mc_power(void) | |||
827 | if (sched_smt_power_savings) | 830 | if (sched_smt_power_savings) |
828 | return SD_POWERSAVINGS_BALANCE; | 831 | return SD_POWERSAVINGS_BALANCE; |
829 | 832 | ||
830 | return 0; | 833 | return SD_PREFER_SIBLING; |
831 | } | 834 | } |
832 | 835 | ||
833 | static inline int sd_balance_for_package_power(void) | 836 | static inline int sd_balance_for_package_power(void) |
@@ -835,7 +838,7 @@ static inline int sd_balance_for_package_power(void) | |||
835 | if (sched_mc_power_savings | sched_smt_power_savings) | 838 | if (sched_mc_power_savings | sched_smt_power_savings) |
836 | return SD_POWERSAVINGS_BALANCE; | 839 | return SD_POWERSAVINGS_BALANCE; |
837 | 840 | ||
838 | return 0; | 841 | return SD_PREFER_SIBLING; |
839 | } | 842 | } |
840 | 843 | ||
841 | /* | 844 | /* |
@@ -857,15 +860,9 @@ struct sched_group { | |||
857 | 860 | ||
858 | /* | 861 | /* |
859 | * CPU power of this group, SCHED_LOAD_SCALE being max power for a | 862 | * CPU power of this group, SCHED_LOAD_SCALE being max power for a |
860 | * single CPU. This is read only (except for setup, hotplug CPU). | 863 | * single CPU. |
861 | * Note : Never change cpu_power without recompute its reciprocal | ||
862 | */ | ||
863 | unsigned int __cpu_power; | ||
864 | /* | ||
865 | * reciprocal value of cpu_power to avoid expensive divides | ||
866 | * (see include/linux/reciprocal_div.h) | ||
867 | */ | 864 | */ |
868 | u32 reciprocal_cpu_power; | 865 | unsigned int cpu_power; |
869 | 866 | ||
870 | /* | 867 | /* |
871 | * The CPUs this group covers. | 868 | * The CPUs this group covers. |
@@ -918,6 +915,7 @@ struct sched_domain { | |||
918 | unsigned int newidle_idx; | 915 | unsigned int newidle_idx; |
919 | unsigned int wake_idx; | 916 | unsigned int wake_idx; |
920 | unsigned int forkexec_idx; | 917 | unsigned int forkexec_idx; |
918 | unsigned int smt_gain; | ||
921 | int flags; /* See SD_* */ | 919 | int flags; /* See SD_* */ |
922 | enum sched_domain_level level; | 920 | enum sched_domain_level level; |
923 | 921 | ||
@@ -1045,7 +1043,6 @@ struct sched_class { | |||
1045 | struct rq *busiest, struct sched_domain *sd, | 1043 | struct rq *busiest, struct sched_domain *sd, |
1046 | enum cpu_idle_type idle); | 1044 | enum cpu_idle_type idle); |
1047 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); | 1045 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); |
1048 | int (*needs_post_schedule) (struct rq *this_rq); | ||
1049 | void (*post_schedule) (struct rq *this_rq); | 1046 | void (*post_schedule) (struct rq *this_rq); |
1050 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); | 1047 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); |
1051 | 1048 | ||
@@ -1110,6 +1107,8 @@ struct sched_entity { | |||
1110 | u64 wait_max; | 1107 | u64 wait_max; |
1111 | u64 wait_count; | 1108 | u64 wait_count; |
1112 | u64 wait_sum; | 1109 | u64 wait_sum; |
1110 | u64 iowait_count; | ||
1111 | u64 iowait_sum; | ||
1113 | 1112 | ||
1114 | u64 sleep_start; | 1113 | u64 sleep_start; |
1115 | u64 sleep_max; | 1114 | u64 sleep_max; |
@@ -1234,11 +1233,19 @@ struct task_struct { | |||
1234 | unsigned did_exec:1; | 1233 | unsigned did_exec:1; |
1235 | unsigned in_execve:1; /* Tell the LSMs that the process is doing an | 1234 | unsigned in_execve:1; /* Tell the LSMs that the process is doing an |
1236 | * execve */ | 1235 | * execve */ |
1236 | unsigned in_iowait:1; | ||
1237 | |||
1238 | |||
1239 | /* Revert to default priority/policy when forking */ | ||
1240 | unsigned sched_reset_on_fork:1; | ||
1241 | |||
1237 | pid_t pid; | 1242 | pid_t pid; |
1238 | pid_t tgid; | 1243 | pid_t tgid; |
1239 | 1244 | ||
1245 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
1240 | /* Canary value for the -fstack-protector gcc feature */ | 1246 | /* Canary value for the -fstack-protector gcc feature */ |
1241 | unsigned long stack_canary; | 1247 | unsigned long stack_canary; |
1248 | #endif | ||
1242 | 1249 | ||
1243 | /* | 1250 | /* |
1244 | * pointers to (original) parent process, youngest child, younger sibling, | 1251 | * pointers to (original) parent process, youngest child, younger sibling, |
@@ -1840,11 +1847,12 @@ extern unsigned int sysctl_sched_min_granularity; | |||
1840 | extern unsigned int sysctl_sched_wakeup_granularity; | 1847 | extern unsigned int sysctl_sched_wakeup_granularity; |
1841 | extern unsigned int sysctl_sched_shares_ratelimit; | 1848 | extern unsigned int sysctl_sched_shares_ratelimit; |
1842 | extern unsigned int sysctl_sched_shares_thresh; | 1849 | extern unsigned int sysctl_sched_shares_thresh; |
1843 | #ifdef CONFIG_SCHED_DEBUG | ||
1844 | extern unsigned int sysctl_sched_child_runs_first; | 1850 | extern unsigned int sysctl_sched_child_runs_first; |
1851 | #ifdef CONFIG_SCHED_DEBUG | ||
1845 | extern unsigned int sysctl_sched_features; | 1852 | extern unsigned int sysctl_sched_features; |
1846 | extern unsigned int sysctl_sched_migration_cost; | 1853 | extern unsigned int sysctl_sched_migration_cost; |
1847 | extern unsigned int sysctl_sched_nr_migrate; | 1854 | extern unsigned int sysctl_sched_nr_migrate; |
1855 | extern unsigned int sysctl_sched_time_avg; | ||
1848 | extern unsigned int sysctl_timer_migration; | 1856 | extern unsigned int sysctl_timer_migration; |
1849 | 1857 | ||
1850 | int sched_nr_latency_handler(struct ctl_table *table, int write, | 1858 | int sched_nr_latency_handler(struct ctl_table *table, int write, |
@@ -2308,23 +2316,31 @@ static inline int need_resched(void) | |||
2308 | * cond_resched_softirq() will enable bhs before scheduling. | 2316 | * cond_resched_softirq() will enable bhs before scheduling. |
2309 | */ | 2317 | */ |
2310 | extern int _cond_resched(void); | 2318 | extern int _cond_resched(void); |
2311 | #ifdef CONFIG_PREEMPT_BKL | 2319 | |
2312 | static inline int cond_resched(void) | 2320 | #define cond_resched() ({ \ |
2313 | { | 2321 | __might_sleep(__FILE__, __LINE__, 0); \ |
2314 | return 0; | 2322 | _cond_resched(); \ |
2315 | } | 2323 | }) |
2324 | |||
2325 | extern int __cond_resched_lock(spinlock_t *lock); | ||
2326 | |||
2327 | #ifdef CONFIG_PREEMPT | ||
2328 | #define PREEMPT_LOCK_OFFSET PREEMPT_OFFSET | ||
2316 | #else | 2329 | #else |
2317 | static inline int cond_resched(void) | 2330 | #define PREEMPT_LOCK_OFFSET 0 |
2318 | { | ||
2319 | return _cond_resched(); | ||
2320 | } | ||
2321 | #endif | 2331 | #endif |
2322 | extern int cond_resched_lock(spinlock_t * lock); | 2332 | |
2323 | extern int cond_resched_softirq(void); | 2333 | #define cond_resched_lock(lock) ({ \ |
2324 | static inline int cond_resched_bkl(void) | 2334 | __might_sleep(__FILE__, __LINE__, PREEMPT_LOCK_OFFSET); \ |
2325 | { | 2335 | __cond_resched_lock(lock); \ |
2326 | return _cond_resched(); | 2336 | }) |
2327 | } | 2337 | |
2338 | extern int __cond_resched_softirq(void); | ||
2339 | |||
2340 | #define cond_resched_softirq() ({ \ | ||
2341 | __might_sleep(__FILE__, __LINE__, SOFTIRQ_OFFSET); \ | ||
2342 | __cond_resched_softirq(); \ | ||
2343 | }) | ||
2328 | 2344 | ||
2329 | /* | 2345 | /* |
2330 | * Does a critical section need to be broken due to another | 2346 | * Does a critical section need to be broken due to another |