From d89e049987ba496c73a98a2aa060d2402adb8d0e Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Fri, 8 Mar 2019 10:04:40 +0530 Subject: [PATCH] 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 --- kernel/sched/fair.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f362c58ec9d6..24faaddb386b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -203,6 +203,7 @@ unsigned int sysctl_sched_min_task_util_for_boost = 51; /* 0.68ms default for 20ms window size scaled to 1024 */ unsigned int sysctl_sched_min_task_util_for_colocation = 35; #endif +static unsigned int __maybe_unused sched_small_task_threshold = 102; static inline void update_load_add(struct load_weight *lw, unsigned long inc) { @@ -10709,7 +10710,8 @@ static struct rq *find_busiest_queue(struct lb_env *env, */ 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);