sched/fair: Don't let tasks slip away from gold to silver cluster

We often see a BIG/medium task being migrated from gold cluster to
silver cluster during load balance when the gold CPU has 2 tasks
including this BIG task. For example, BIG task wakes up a binder
and binder preempts and running. At this time, the silver CPU pull
the BIG task since the overall utilization is more. The gold CPU
becomes idle immediately and may not be able to pull the medium
task. It can also happen when a pinned kworker runs on the gold
CPU.

Change-Id: I7d8caad6978bfa93aa3cdd772400e807b9f15e3d
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Runmin Wang <runminw@codeaurora.org>
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 6a45c8a..465a1a7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -187,6 +187,7 @@
 /* 0.68ms default for 20ms window size scaled to 1024 */
 unsigned int sysctl_sched_min_task_util_for_colocation = 35;
 #endif
+unsigned int sched_small_task_threshold = 102;
 
 static inline void update_load_add(struct load_weight *lw, unsigned long inc)
 {
@@ -9944,7 +9945,9 @@
 		 */
 		if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
 		    capacity_of(env->dst_cpu) < capacity &&
-		    rq->nr_running == 1)
+		    (rq->nr_running == 1 ||
+			 (rq->nr_running == 2 && task_util(rq->curr) <
+			  sched_small_task_threshold)))
 			continue;
 
 		wl = weighted_cpuload(rq);