Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1479560 > unrolled thread
| Started by | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> |
|---|---|
| First post | 2016-09-09 00:30 +0200 |
| Last post | 2016-09-09 00:30 +0200 |
| Articles | 9 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH v3 0/8] Support Intel® Turbo Boost Max Technology 3.0 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2016-09-09 00:30 +0200
[PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2016-09-09 00:30 +0200
Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT Thomas Gleixner <tglx@linutronix.de> - 2016-09-10 15:20 +0200
Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT Thomas Gleixner <tglx@linutronix.de> - 2016-09-10 15:20 +0200
Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT Tim Chen <tim.c.chen@linux.intel.com> - 2016-09-12 23:00 +0200
Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT Peter Zijlstra <peterz@infradead.org> - 2016-09-13 09:30 +0200
Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT Jiri Olsa <jolsa@redhat.com> - 2016-09-19 11:20 +0200
Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT Tim Chen <tim.c.chen@linux.intel.com> - 2016-09-19 18:10 +0200
[PATCH v3 2/8] sched: Extend scheduler's asym packing Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2016-09-09 00:30 +0200
| From | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> |
|---|---|
| Date | 2016-09-09 00:30 +0200 |
| Subject | [PATCH v3 0/8] Support Intel® Turbo Boost Max Technology 3.0 |
| Message-ID | <sffZw-3f7-9@gated-at.bofh.it> |
v3:
- Fix race clash when more than one program are enabling/disabling ITMT
- Remove group_priority_cpu macro to simplify code.
- Error reported by 0-day for compile issue on ARM
v2
- The patchset is split into two parts so that CPPC changes can be merged first
1. Only ACPI CPPC changes (It is posted separately)
2. ITMT changes (scheduler and Intel P-State)
- Changes in patch: sched,x86: Enable Turbo Boost Max Technology
1. Use arch_update_cpu_topology to indicate need to completely
rebuild sched domain when ITMT related sched domain flags change
2. Enable client (single node) platform capable of ITMT with ITMT
scheduling by default
3. Implement arch_asym_cpu_priority to provide the cpu priority
value to scheduler for asym packing.
4. Fix a compile bug for i386 architecture.
- Changes in patch: sched: Extend scheduler's asym packing
1. Use arch_asym_cpu_priority() to provide cpu priority
value used for asym packing to the scheduler.
- Changes in acpi: bus: Enable HWP CPPC objects and
acpi: bus: Set _OSC for diverse core support
Minor code cleanup by removing #ifdef
- Changes in Kconfig for Intel P-State
Avoid building CPPC lib for i386 for issue reported by 0-day
- Feature is enabled by default for single socket systems
With Intel® Turbo Boost Max Technology 3.0 (ITMT), single-threaded performance is
optimized by identifying processor's fastest core and running critical workloads
on it.
Refere to:
http://www.intel.com/content/www/us/en/architecture-and-technology/turbo-boost/turbo-boost-max-technology.html
This patchset consist of all changes required to support ITMT feature:
- Use CPPC information in Intel P-State driver to get performance information
- Scheduler enhancements
- cppc lib patches (split in to a seprate series)
This featured can be enabled by writing at runtime
# echo 1 > /proc/sys/kernel/sched_itmt_enabled
This featured can be disabled by writing at runtime
# echo 0 > /proc/sys/kernel/sched_itmt_enabled
Srinivas Pandruvada (3):
acpi: bus: Enable HWP CPPC objects
acpi: bus: Set _OSC for diverse core support
cpufreq: intel_pstate: Use CPPC to get max performance
Tim Chen (5):
sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT
sched: Extend scheduler's asym packing
x86, cpu: provide a function topology_num_packages to enumerate
#packages
sched, x86: use arch_update_cpu_topology to indicate x86 need sched
domain rebuild
sched,x86: Enable Turbo Boost Max Technology
arch/x86/Kconfig | 9 +++
arch/x86/include/asm/topology.h | 25 ++++++
arch/x86/kernel/Makefile | 1 +
arch/x86/kernel/itmt.c | 164 ++++++++++++++++++++++++++++++++++++++++
arch/x86/kernel/smpboot.c | 92 +++++++++++++++++-----
drivers/acpi/bus.c | 10 +++
drivers/cpufreq/Kconfig.x86 | 1 +
drivers/cpufreq/intel_pstate.c | 75 +++++++++++++++++-
include/linux/acpi.h | 1 +
include/linux/sched.h | 2 +
kernel/sched/core.c | 21 +++++
kernel/sched/fair.c | 35 ++++++---
kernel/sched/sched.h | 6 ++
13 files changed, 410 insertions(+), 32 deletions(-)
create mode 100644 arch/x86/kernel/itmt.c
--
2.7.4
[toc] | [next] | [standalone]
| From | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> |
|---|---|
| Date | 2016-09-09 00:30 +0200 |
| Subject | [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT |
| Message-ID | <sffZx-3f7-51@gated-at.bofh.it> |
| In reply to | #1479560 |
From: Tim Chen <tim.c.chen@linux.intel.com>
We uses ASYM_PACKING feature in the scheduler to move tasks to more
capable cpus that can be boosted to higher frequency. This is enabled by
Intel Turbo Boost Max Technology 3.0 (ITMT). We mark the sched domain
topology level with SD_ASYM_PACKING flag for such systems to indicate
scheduler can use the ASYM_PACKING feature to move load to the
more capable cpus.
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
arch/x86/include/asm/topology.h | 4 +++
arch/x86/kernel/smpboot.c | 77 +++++++++++++++++++++++++++++++----------
kernel/sched/core.c | 3 ++
3 files changed, 66 insertions(+), 18 deletions(-)
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index cf75871..98b669d 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -146,4 +146,8 @@ struct pci_bus;
int x86_pci_root_bus_node(int bus);
void x86_pci_root_bus_resources(int bus, struct list_head *resources);
+#ifdef CONFIG_SCHED_ITMT
+extern unsigned int __read_mostly sysctl_sched_itmt_enabled;
+#endif /* CONFIG_SCHED_ITMT */
+
#endif /* _ASM_X86_TOPOLOGY_H */
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 4296beb..3782bd4 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -109,6 +109,8 @@ static bool logical_packages_frozen __read_mostly;
/* Maximum number of SMT threads on any online core */
int __max_smt_threads __read_mostly;
+unsigned int __read_mostly sysctl_sched_itmt_enabled;
+
static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
{
unsigned long flags;
@@ -471,31 +473,57 @@ static bool match_die(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
return false;
}
-static struct sched_domain_topology_level numa_inside_package_topology[] = {
+#ifdef CONFIG_SCHED_ITMT
+static int x86_core_flags(void)
+{
+ int flags = cpu_core_flags();
+
+ if (sysctl_sched_itmt_enabled)
+ flags |= SD_ASYM_PACKING;
+
+ return flags;
+}
+
+static int x86_smt_flags(void)
+{
+ int flags = cpu_smt_flags();
+
+ if (sysctl_sched_itmt_enabled)
+ flags |= SD_ASYM_PACKING;
+
+ return flags;
+}
+#else
+#define x86_core_flags cpu_core_flags
+#define x86_smt_flags cpu_smt_flags
+#endif
+
+static struct sched_domain_topology_level x86_topology[] = {
+#ifdef CONFIG_SCHED_SMT
+ { cpu_smt_mask, x86_smt_flags, SD_INIT_NAME(SMT) },
+#endif
+#ifdef CONFIG_SCHED_MC
+ { cpu_coregroup_mask, x86_core_flags, SD_INIT_NAME(MC) },
+#endif
+ { cpu_cpu_mask, SD_INIT_NAME(DIE) },
+ { NULL, },
+};
+
+static struct sched_domain_topology_level x86_numa_in_package_topology[] = {
#ifdef CONFIG_SCHED_SMT
- { cpu_smt_mask, cpu_smt_flags, SD_INIT_NAME(SMT) },
+ { cpu_smt_mask, x86_smt_flags, SD_INIT_NAME(SMT) },
#endif
#ifdef CONFIG_SCHED_MC
- { cpu_coregroup_mask, cpu_core_flags, SD_INIT_NAME(MC) },
+ { cpu_coregroup_mask, x86_core_flags, SD_INIT_NAME(MC) },
#endif
{ NULL, },
};
+
/*
- * set_sched_topology() sets the topology internal to a CPU. The
- * NUMA topologies are layered on top of it to build the full
- * system topology.
- *
- * If NUMA nodes are observed to occur within a CPU package, this
- * function should be called. It forces the sched domain code to
- * only use the SMT level for the CPU portion of the topology.
- * This essentially falls back to relying on NUMA information
- * from the SRAT table to describe the entire system topology
- * (except for hyperthreads).
+ * Set if a package/die has multiple NUMA nodes inside.
+ * AMD Magny-Cours and Intel Cluster-on-Die have this.
*/
-static void primarily_use_numa_for_topology(void)
-{
- set_sched_topology(numa_inside_package_topology);
-}
+static bool x86_has_numa_in_package;
void set_cpu_sibling_map(int cpu)
{
@@ -558,7 +586,7 @@ void set_cpu_sibling_map(int cpu)
c->booted_cores = cpu_data(i).booted_cores;
}
if (match_die(c, o) && !topology_same_node(c, o))
- primarily_use_numa_for_topology();
+ x86_has_numa_in_package = true;
}
threads = cpumask_weight(topology_sibling_cpumask(cpu));
@@ -1304,6 +1332,16 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
}
+
+ /*
+ * Set 'default' x86 topology, this matches default_topology() in that
+ * it has NUMA nodes as a topology level. See also
+ * native_smp_cpus_done().
+ *
+ * Must be done before set_cpus_sibling_map() is ran.
+ */
+ set_sched_topology(x86_topology);
+
set_cpu_sibling_map(0);
switch (smp_sanity_check(max_cpus)) {
@@ -1370,6 +1408,9 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
{
pr_debug("Boot done\n");
+ if (x86_has_numa_in_package)
+ set_sched_topology(x86_numa_in_package_topology);
+
nmi_selftest();
impress_friends();
setup_ioapic_dest();
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2a906f2..e86c4a5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6487,6 +6487,9 @@ static struct sched_domain_topology_level *sched_domain_topology =
void set_sched_topology(struct sched_domain_topology_level *tl)
{
+ if (WARN_ON_ONCE(sched_smp_initialized))
+ return;
+
sched_domain_topology = tl;
}
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2016-09-10 15:20 +0200 |
| Subject | Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT |
| Message-ID | <sfQml-H3-3@gated-at.bofh.it> |
| In reply to | #1479561 |
On Thu, 8 Sep 2016, Srinivas Pandruvada wrote:
>
> void set_sched_topology(struct sched_domain_topology_level *tl)
> {
> + if (WARN_ON_ONCE(sched_smp_initialized))
> + return;
> +
> sched_domain_topology = tl;
> }
This change has nothing to do with $subject. Seperate patch please.
Thanks,
tglx
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2016-09-10 15:20 +0200 |
| Subject | Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT |
| Message-ID | <sfQml-H3-7@gated-at.bofh.it> |
| In reply to | #1479561 |
On Thu, 8 Sep 2016, Srinivas Pandruvada wrote:
> From: Tim Chen <tim.c.chen@linux.intel.com>
>
> We uses ASYM_PACKING feature in the scheduler to move tasks to more
> capable cpus that can be boosted to higher frequency. This is enabled by
> Intel Turbo Boost Max Technology 3.0 (ITMT). We mark the sched domain
> topology level with SD_ASYM_PACKING flag for such systems to indicate
> scheduler can use the ASYM_PACKING feature to move load to the
> more capable cpus.
Sigh. This changelog does not tell anything about the nature of the patch,
the rationale for it etc. It's just a meaningless blurb.
> +unsigned int __read_mostly sysctl_sched_itmt_enabled;
> +
> static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
> {
> unsigned long flags;
> @@ -471,31 +473,57 @@ static bool match_die(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
> return false;
> }
>
> -static struct sched_domain_topology_level numa_inside_package_topology[] = {
> +#ifdef CONFIG_SCHED_ITMT
> +static int x86_core_flags(void)
> +{
> + int flags = cpu_core_flags();
> +
> + if (sysctl_sched_itmt_enabled)
> + flags |= SD_ASYM_PACKING;
> +
> + return flags;
> +}
> +
> +static int x86_smt_flags(void)
> +{
> + int flags = cpu_smt_flags();
> +
> + if (sysctl_sched_itmt_enabled)
> + flags |= SD_ASYM_PACKING;
> +
> + return flags;
> +}
> +#else
> +#define x86_core_flags cpu_core_flags
> +#define x86_smt_flags cpu_smt_flags
> +#endif
No. We first rework the code so that the IMT stuff can be added in a later
patch easily.
Thanks,
tglx
[toc] | [prev] | [next] | [standalone]
| From | Tim Chen <tim.c.chen@linux.intel.com> |
|---|---|
| Date | 2016-09-12 23:00 +0200 |
| Subject | Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT |
| Message-ID | <sgGuB-b1-17@gated-at.bofh.it> |
| In reply to | #1480624 |
On Sat, 2016-09-10 at 15:10 +0200, Thomas Gleixner wrote: > On Thu, 8 Sep 2016, Srinivas Pandruvada wrote: > > > > From: Tim Chen <tim.c.chen@linux.intel.com> > > > > We uses ASYM_PACKING feature in the scheduler to move tasks to more > > capable cpus that can be boosted to higher frequency. This is enabled by > > Intel Turbo Boost Max Technology 3.0 (ITMT). We mark the sched domain > > topology level with SD_ASYM_PACKING flag for such systems to indicate > > scheduler can use the ASYM_PACKING feature to move load to the > > more capable cpus. > Sigh. This changelog does not tell anything about the nature of the patch, > the rationale for it etc. It's just a meaningless blurb. Okay, I can add more details about ITMT. Will also be clearer if the ITMT patch (patch 5) comes before this one. > > +} > > +#else > > +#define x86_core_flags cpu_core_flags > > +#define x86_smt_flags cpu_smt_flags > > +#endif > No. We first rework the code so that the IMT stuff can be added in a later > patch easily. I'll move this patch to come after current patch 5. Thanks. Tim
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-09-13 09:30 +0200 |
| Subject | Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT |
| Message-ID | <sgQkh-77I-9@gated-at.bofh.it> |
| In reply to | #1481958 |
On Mon, Sep 12, 2016 at 01:50:15PM -0700, Tim Chen wrote: > > No. We first rework the code so that the IMT stuff can be added in a later > > patch easily. > > I'll move this patch to come after current patch 5. Split the patch, one doing the topo cleanup, one adding the x86_*_flags().
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2016-09-19 11:20 +0200 |
| Subject | Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT |
| Message-ID | <sj2U2-3y7-17@gated-at.bofh.it> |
| In reply to | #1482199 |
On Tue, Sep 13, 2016 at 09:26:13AM +0200, Peter Zijlstra wrote: > On Mon, Sep 12, 2016 at 01:50:15PM -0700, Tim Chen wrote: > > > No. We first rework the code so that the IMT stuff can be added in a later > > > patch easily. > > > > I'll move this patch to come after current patch 5. > > Split the patch, one doing the topo cleanup, one adding the > x86_*_flags(). hi, could you please CC me on the next version, I'm interested in that cleanup patch.. thanks a lot, jirka
[toc] | [prev] | [next] | [standalone]
| From | Tim Chen <tim.c.chen@linux.intel.com> |
|---|---|
| Date | 2016-09-19 18:10 +0200 |
| Subject | Re: [PATCH v3 1/8] sched, x86: Add SD_ASYM_PACKING flags to x86 cpu topology for ITMT |
| Message-ID | <sj9iO-7Bu-27@gated-at.bofh.it> |
| In reply to | #1486282 |
On Mon, 2016-09-19 at 11:11 +0200, Jiri Olsa wrote: > On Tue, Sep 13, 2016 at 09:26:13AM +0200, Peter Zijlstra wrote: > > > > On Mon, Sep 12, 2016 at 01:50:15PM -0700, Tim Chen wrote: > > > > > > > > > > > No. We first rework the code so that the IMT stuff can be added in a later > > > > patch easily. > > > I'll move this patch to come after current patch 5. > > Split the patch, one doing the topo cleanup, one adding the > > x86_*_flags(). > hi, > could you please CC me on the next version, > I'm interested in that cleanup patch.. Sure. Will do. Tim
[toc] | [prev] | [next] | [standalone]
| From | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> |
|---|---|
| Date | 2016-09-09 00:30 +0200 |
| Subject | [PATCH v3 2/8] sched: Extend scheduler's asym packing |
| Message-ID | <sffZw-3f7-41@gated-at.bofh.it> |
| In reply to | #1479560 |
From: Tim Chen <tim.c.chen@linux.intel.com>
We generalize the scheduler's asym packing to provide an ordering
of the cpu beyond just the cpu number. This allows the use of the
ASYM_PACKING scheduler machinery to move loads to preferred CPU in a
sched domain. The preference is defined with the cpu priority
given by arch_asym_cpu_priority(cpu).
We also record the most preferred cpu in a sched group when
we build the cpu's capacity for fast lookup of preferred cpu
during load balancing.
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
include/linux/sched.h | 2 ++
kernel/sched/core.c | 18 ++++++++++++++++++
kernel/sched/fair.c | 35 ++++++++++++++++++++++++-----------
kernel/sched/sched.h | 6 ++++++
4 files changed, 50 insertions(+), 11 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b0fa726..15d3f29 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1052,6 +1052,8 @@ static inline int cpu_numa_flags(void)
}
#endif
+int arch_asym_cpu_priority(int cpu);
+
struct sched_domain_attr {
int relax_domain_level;
};
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e86c4a5..08135ca 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6237,7 +6237,25 @@ static void init_sched_groups_capacity(int cpu, struct sched_domain *sd)
WARN_ON(!sg);
do {
+ int cpu, max_cpu = -1, prev_cpu = -1;
+
sg->group_weight = cpumask_weight(sched_group_cpus(sg));
+
+ if (!(sd->flags & SD_ASYM_PACKING))
+ goto next;
+
+ for_each_cpu(cpu, sched_group_cpus(sg)) {
+ if (prev_cpu < 0) {
+ prev_cpu = cpu;
+ max_cpu = cpu;
+ } else {
+ if (sched_asym_prefer(cpu, max_cpu))
+ max_cpu = cpu;
+ }
+ }
+ sg->asym_prefer_cpu = max_cpu;
+
+next:
sg = sg->next;
} while (sg != sd->groups);
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 5d558cc..a37a390 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -100,6 +100,16 @@ const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
*/
unsigned int __read_mostly sysctl_sched_shares_window = 10000000UL;
+#ifdef CONFIG_SMP
+/*
+ * For asym packing, by default the lower numbered cpu has higher priority.
+ */
+int __weak arch_asym_cpu_priority(int cpu)
+{
+ return -cpu;
+}
+#endif
+
#ifdef CONFIG_CFS_BANDWIDTH
/*
* Amount of runtime to allocate from global (tg) to local (per-cfs_rq) pool
@@ -6853,16 +6863,18 @@ static bool update_sd_pick_busiest(struct lb_env *env,
if (env->idle == CPU_NOT_IDLE)
return true;
/*
- * ASYM_PACKING needs to move all the work to the lowest
- * numbered CPUs in the group, therefore mark all groups
- * higher than ourself as busy.
+ * ASYM_PACKING needs to move all the work to the highest
+ * prority CPUs in the group, therefore mark all groups
+ * of lower priority than ourself as busy.
*/
- if (sgs->sum_nr_running && env->dst_cpu < group_first_cpu(sg)) {
+ if (sgs->sum_nr_running &&
+ sched_asym_prefer(env->dst_cpu, sg->asym_prefer_cpu)) {
if (!sds->busiest)
return true;
- /* Prefer to move from highest possible cpu's work */
- if (group_first_cpu(sds->busiest) < group_first_cpu(sg))
+ /* Prefer to move from lowest priority cpu's work */
+ if (sched_asym_prefer(sds->busiest->asym_prefer_cpu,
+ sg->asym_prefer_cpu))
return true;
}
@@ -7014,8 +7026,8 @@ static int check_asym_packing(struct lb_env *env, struct sd_lb_stats *sds)
if (!sds->busiest)
return 0;
- busiest_cpu = group_first_cpu(sds->busiest);
- if (env->dst_cpu > busiest_cpu)
+ busiest_cpu = sds->busiest->asym_prefer_cpu;
+ if (sched_asym_prefer(busiest_cpu, env->dst_cpu))
return 0;
env->imbalance = DIV_ROUND_CLOSEST(
@@ -7356,10 +7368,11 @@ static int need_active_balance(struct lb_env *env)
/*
* ASYM_PACKING needs to force migrate tasks from busy but
- * higher numbered CPUs in order to pack all tasks in the
- * lowest numbered CPUs.
+ * lower priority CPUs in order to pack all tasks in the
+ * highest priority CPUs.
*/
- if ((sd->flags & SD_ASYM_PACKING) && env->src_cpu > env->dst_cpu)
+ if ((sd->flags & SD_ASYM_PACKING) &&
+ sched_asym_prefer(env->dst_cpu, env->src_cpu))
return 1;
}
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index b7fc1ce..3f3d04a 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -532,6 +532,11 @@ struct dl_rq {
#ifdef CONFIG_SMP
+static inline bool sched_asym_prefer(int a, int b)
+{
+ return arch_asym_cpu_priority(a) > arch_asym_cpu_priority(b);
+}
+
/*
* We add the notion of a root-domain which will be used to define per-domain
* variables. Each exclusive cpuset essentially defines an island domain by
@@ -884,6 +889,7 @@ struct sched_group {
unsigned int group_weight;
struct sched_group_capacity *sgc;
+ int asym_prefer_cpu; /* cpu of highest priority in group */
/*
* The CPUs this group covers.
--
2.7.4
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web