diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 92 |
1 files changed, 72 insertions, 20 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 8395e715809d..158d53d07765 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -250,7 +250,7 @@ extern void init_idle_bootup_task(struct task_struct *idle); | |||
250 | extern int runqueue_is_locked(void); | 250 | extern int runqueue_is_locked(void); |
251 | extern void task_rq_unlock_wait(struct task_struct *p); | 251 | extern void task_rq_unlock_wait(struct task_struct *p); |
252 | 252 | ||
253 | extern cpumask_t nohz_cpu_mask; | 253 | extern cpumask_var_t nohz_cpu_mask; |
254 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) | 254 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) |
255 | extern int select_nohz_load_balancer(int cpu); | 255 | extern int select_nohz_load_balancer(int cpu); |
256 | #else | 256 | #else |
@@ -758,20 +758,51 @@ enum cpu_idle_type { | |||
758 | #define SD_SERIALIZE 1024 /* Only a single load balancing instance */ | 758 | #define SD_SERIALIZE 1024 /* Only a single load balancing instance */ |
759 | #define SD_WAKE_IDLE_FAR 2048 /* Gain latency sacrificing cache hit */ | 759 | #define SD_WAKE_IDLE_FAR 2048 /* Gain latency sacrificing cache hit */ |
760 | 760 | ||
761 | #define BALANCE_FOR_MC_POWER \ | 761 | enum powersavings_balance_level { |
762 | (sched_smt_power_savings ? SD_POWERSAVINGS_BALANCE : 0) | 762 | POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */ |
763 | POWERSAVINGS_BALANCE_BASIC, /* Fill one thread/core/package | ||
764 | * first for long running threads | ||
765 | */ | ||
766 | POWERSAVINGS_BALANCE_WAKEUP, /* Also bias task wakeups to semi-idle | ||
767 | * cpu package for power savings | ||
768 | */ | ||
769 | MAX_POWERSAVINGS_BALANCE_LEVELS | ||
770 | }; | ||
763 | 771 | ||
764 | #define BALANCE_FOR_PKG_POWER \ | 772 | extern int sched_mc_power_savings, sched_smt_power_savings; |
765 | ((sched_mc_power_savings || sched_smt_power_savings) ? \ | ||
766 | SD_POWERSAVINGS_BALANCE : 0) | ||
767 | 773 | ||
768 | #define test_sd_parent(sd, flag) ((sd->parent && \ | 774 | static inline int sd_balance_for_mc_power(void) |
769 | (sd->parent->flags & flag)) ? 1 : 0) | 775 | { |
776 | if (sched_smt_power_savings) | ||
777 | return SD_POWERSAVINGS_BALANCE; | ||
770 | 778 | ||
779 | return 0; | ||
780 | } | ||
781 | |||
782 | static inline int sd_balance_for_package_power(void) | ||
783 | { | ||
784 | if (sched_mc_power_savings | sched_smt_power_savings) | ||
785 | return SD_POWERSAVINGS_BALANCE; | ||
786 | |||
787 | return 0; | ||
788 | } | ||
789 | |||
790 | /* | ||
791 | * Optimise SD flags for power savings: | ||
792 | * SD_BALANCE_NEWIDLE helps agressive task consolidation and power savings. | ||
793 | * Keep default SD flags if sched_{smt,mc}_power_saving=0 | ||
794 | */ | ||
795 | |||
796 | static inline int sd_power_saving_flags(void) | ||
797 | { | ||
798 | if (sched_mc_power_savings | sched_smt_power_savings) | ||
799 | return SD_BALANCE_NEWIDLE; | ||
800 | |||
801 | return 0; | ||
802 | } | ||
771 | 803 | ||
772 | struct sched_group { | 804 | struct sched_group { |
773 | struct sched_group *next; /* Must be a circular list */ | 805 | struct sched_group *next; /* Must be a circular list */ |
774 | cpumask_t cpumask; | ||
775 | 806 | ||
776 | /* | 807 | /* |
777 | * CPU power of this group, SCHED_LOAD_SCALE being max power for a | 808 | * CPU power of this group, SCHED_LOAD_SCALE being max power for a |
@@ -784,8 +815,15 @@ struct sched_group { | |||
784 | * (see include/linux/reciprocal_div.h) | 815 | * (see include/linux/reciprocal_div.h) |
785 | */ | 816 | */ |
786 | u32 reciprocal_cpu_power; | 817 | u32 reciprocal_cpu_power; |
818 | |||
819 | unsigned long cpumask[]; | ||
787 | }; | 820 | }; |
788 | 821 | ||
822 | static inline struct cpumask *sched_group_cpus(struct sched_group *sg) | ||
823 | { | ||
824 | return to_cpumask(sg->cpumask); | ||
825 | } | ||
826 | |||
789 | enum sched_domain_level { | 827 | enum sched_domain_level { |
790 | SD_LV_NONE = 0, | 828 | SD_LV_NONE = 0, |
791 | SD_LV_SIBLING, | 829 | SD_LV_SIBLING, |
@@ -809,7 +847,6 @@ struct sched_domain { | |||
809 | struct sched_domain *parent; /* top domain must be null terminated */ | 847 | struct sched_domain *parent; /* top domain must be null terminated */ |
810 | struct sched_domain *child; /* bottom domain must be null terminated */ | 848 | struct sched_domain *child; /* bottom domain must be null terminated */ |
811 | struct sched_group *groups; /* the balancing groups of the domain */ | 849 | struct sched_group *groups; /* the balancing groups of the domain */ |
812 | cpumask_t span; /* span of all CPUs in this domain */ | ||
813 | unsigned long min_interval; /* Minimum balance interval ms */ | 850 | unsigned long min_interval; /* Minimum balance interval ms */ |
814 | unsigned long max_interval; /* Maximum balance interval ms */ | 851 | unsigned long max_interval; /* Maximum balance interval ms */ |
815 | unsigned int busy_factor; /* less balancing by factor if busy */ | 852 | unsigned int busy_factor; /* less balancing by factor if busy */ |
@@ -864,18 +901,35 @@ struct sched_domain { | |||
864 | #ifdef CONFIG_SCHED_DEBUG | 901 | #ifdef CONFIG_SCHED_DEBUG |
865 | char *name; | 902 | char *name; |
866 | #endif | 903 | #endif |
904 | |||
905 | /* span of all CPUs in this domain */ | ||
906 | unsigned long span[]; | ||
867 | }; | 907 | }; |
868 | 908 | ||
869 | extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new, | 909 | static inline struct cpumask *sched_domain_span(struct sched_domain *sd) |
910 | { | ||
911 | return to_cpumask(sd->span); | ||
912 | } | ||
913 | |||
914 | extern void partition_sched_domains(int ndoms_new, struct cpumask *doms_new, | ||
870 | struct sched_domain_attr *dattr_new); | 915 | struct sched_domain_attr *dattr_new); |
871 | extern int arch_reinit_sched_domains(void); | 916 | extern int arch_reinit_sched_domains(void); |
872 | 917 | ||
918 | /* Test a flag in parent sched domain */ | ||
919 | static inline int test_sd_parent(struct sched_domain *sd, int flag) | ||
920 | { | ||
921 | if (sd->parent && (sd->parent->flags & flag)) | ||
922 | return 1; | ||
923 | |||
924 | return 0; | ||
925 | } | ||
926 | |||
873 | #else /* CONFIG_SMP */ | 927 | #else /* CONFIG_SMP */ |
874 | 928 | ||
875 | struct sched_domain_attr; | 929 | struct sched_domain_attr; |
876 | 930 | ||
877 | static inline void | 931 | static inline void |
878 | partition_sched_domains(int ndoms_new, cpumask_t *doms_new, | 932 | partition_sched_domains(int ndoms_new, struct cpumask *doms_new, |
879 | struct sched_domain_attr *dattr_new) | 933 | struct sched_domain_attr *dattr_new) |
880 | { | 934 | { |
881 | } | 935 | } |
@@ -926,7 +980,7 @@ struct sched_class { | |||
926 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); | 980 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); |
927 | 981 | ||
928 | void (*set_cpus_allowed)(struct task_struct *p, | 982 | void (*set_cpus_allowed)(struct task_struct *p, |
929 | const cpumask_t *newmask); | 983 | const struct cpumask *newmask); |
930 | 984 | ||
931 | void (*rq_online)(struct rq *rq); | 985 | void (*rq_online)(struct rq *rq); |
932 | void (*rq_offline)(struct rq *rq); | 986 | void (*rq_offline)(struct rq *rq); |
@@ -1579,12 +1633,12 @@ extern cputime_t task_gtime(struct task_struct *p); | |||
1579 | 1633 | ||
1580 | #ifdef CONFIG_SMP | 1634 | #ifdef CONFIG_SMP |
1581 | extern int set_cpus_allowed_ptr(struct task_struct *p, | 1635 | extern int set_cpus_allowed_ptr(struct task_struct *p, |
1582 | const cpumask_t *new_mask); | 1636 | const struct cpumask *new_mask); |
1583 | #else | 1637 | #else |
1584 | static inline int set_cpus_allowed_ptr(struct task_struct *p, | 1638 | static inline int set_cpus_allowed_ptr(struct task_struct *p, |
1585 | const cpumask_t *new_mask) | 1639 | const struct cpumask *new_mask) |
1586 | { | 1640 | { |
1587 | if (!cpu_isset(0, *new_mask)) | 1641 | if (!cpumask_test_cpu(0, new_mask)) |
1588 | return -EINVAL; | 1642 | return -EINVAL; |
1589 | return 0; | 1643 | return 0; |
1590 | } | 1644 | } |
@@ -2195,10 +2249,8 @@ __trace_special(void *__tr, void *__data, | |||
2195 | } | 2249 | } |
2196 | #endif | 2250 | #endif |
2197 | 2251 | ||
2198 | extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask); | 2252 | extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); |
2199 | extern long sched_getaffinity(pid_t pid, cpumask_t *mask); | 2253 | extern long sched_getaffinity(pid_t pid, struct cpumask *mask); |
2200 | |||
2201 | extern int sched_mc_power_savings, sched_smt_power_savings; | ||
2202 | 2254 | ||
2203 | extern void normalize_rt_tasks(void); | 2255 | extern void normalize_rt_tasks(void); |
2204 | 2256 | ||