aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/fair.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 967e77faef5..abb602575be 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1840,6 +1840,17 @@ static int select_best_cpu(struct task_struct *p, int target, int reason,
int small_task = is_small_task(p);
int boost = sched_boost();
int cstate, min_cstate = INT_MAX;
+ int prefer_idle = reason ? 1 : sysctl_sched_prefer_idle;
+
+ /*
+ * PF_WAKE_UP_IDLE is a hint to scheduler that the thread waking up
+ * (p) needs to be placed on idle cpu.
+ */
+ if ((current->flags & PF_WAKE_UP_IDLE) ||
+ (p->flags & PF_WAKE_UP_IDLE)) {
+ prefer_idle = 1;
+ small_task = 0;
+ }
trace_sched_task_load(p, small_task, boost, reason, sync);
@@ -1950,7 +1961,7 @@ static int select_best_cpu(struct task_struct *p, int target, int reason,
}
if (min_cstate_cpu >= 0 &&
- (sysctl_sched_prefer_idle ||
+ (prefer_idle ||
!(best_cpu >= 0 && mostly_idle_cpu_sync(best_cpu, sync))))
best_cpu = min_cstate_cpu;
done: