From 1820def80ce1303b6e671143673191ff23ef4a25 Mon Sep 17 00:00:00 2001
From: Olav Haugan <ohaugan@codeaurora.org>
Date: Tue, 19 Jul 2016 10:50:03 -0700
Subject: [PATCH] sched/fair: Don't check for migration for a pinned task

There is no point of checking whether a currently running task should be
migrated off this cpu if the task is pinned to the cpu.

Change-Id: I33e5ddb318200535c3563f5670059144e0f5eba8
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 958d79e1933c..584cd048c24b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4096,7 +4096,8 @@ static inline int migration_needed(struct task_struct *p, int cpu)
 	int nice;
 	struct related_thread_group *grp;
 
-	if (!sched_enable_hmp || p->state != TASK_RUNNING)
+	if (!sched_enable_hmp || p->state != TASK_RUNNING ||
+	    p->nr_cpus_allowed == 1)
 		return 0;
 
 	/* No need to migrate task that is about to be throttled */