>From 1cb57d99317f26ffa390544903efb6907e834293 Mon Sep 17 00:00:00 2001
From: Jon Medhurst <tixy@linaro.org>
Date: Fri, 12 Oct 2012 13:45:35 +0100
Subject: [PATCH] ARM: sched: Avoid empty 'slow' HMP domain

On homogeneous (non-heterogeneous) systems all CPUs will be declared
'fast' and the slow cpu list will be empty. In this situation we need to
avoid adding an empty slow HMP domain otherwise the scheduler code will
blow up when it attempts to move a task to the slow domain.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
---
 arch/arm/kernel/topology.c   |   10 ++++++----
 linaro/configs/vexpress.conf |    2 ++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 58dac7a..0b51233 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -396,10 +396,12 @@ void __init arch_get_hmp_domains(struct list_head *hmp_domains_list)
 	 * Must be ordered with respect to compute capacity.
 	 * Fastest domain at head of list.
 	 */
-	domain = (struct hmp_domain *)
-		kmalloc(sizeof(struct hmp_domain), GFP_KERNEL);
-	cpumask_copy(&domain->cpus, &hmp_slow_cpu_mask);
-	list_add(&domain->hmp_domains, hmp_domains_list);
+	if(!cpumask_empty(&hmp_slow_cpu_mask)) {
+		domain = (struct hmp_domain *)
+			kmalloc(sizeof(struct hmp_domain), GFP_KERNEL);
+		cpumask_copy(&domain->cpus, &hmp_slow_cpu_mask);
+		list_add(&domain->hmp_domains, hmp_domains_list);
+	}
 	domain = (struct hmp_domain *)
 		kmalloc(sizeof(struct hmp_domain), GFP_KERNEL);
 	cpumask_copy(&domain->cpus, &hmp_fast_cpu_mask);
diff --git a/linaro/configs/vexpress.conf b/linaro/configs/vexpress.conf
index 1ee0101..8b304e1 100644
--- a/linaro/configs/vexpress.conf
+++ b/linaro/configs/vexpress.conf
@@ -58,3 +58,5 @@ CONFIG_NO_HZ=y
 CONFIG_SCHED_MC=y
 CONFIG_DISABLE_CPU_SCHED_DOMAIN_BALANCE=y
 CONFIG_SCHED_HMP=y
+CONFIG_SCHED_HMP_PRIO_FILTER=y
+CONFIG_SCHED_HMP_PRIO_FILTER_VAL=5
-- 
1.7.10.4

