lkml.org 
[lkml]   [2014]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 14/16] sched: Use energy model in select_idle_sibling
Date
Make select_idle_sibling() consider energy when picking an idle cpu.

Only idle cpus are still considered. A more aggressive energy conserving
approach could go further and consider partly utilized cpus.

Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
---
kernel/sched/fair.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 5a52467..542c2b2 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4644,7 +4644,9 @@ static int select_idle_sibling(struct task_struct *p, int target)
struct sched_domain *sd;
struct sched_group *sg;
int i = task_cpu(p);
+ int target_energy;

+#ifndef CONFIG_SCHED_ENERGY
if (idle_cpu(target))
return target;

@@ -4653,6 +4655,8 @@ static int select_idle_sibling(struct task_struct *p, int target)
*/
if (i != target && cpus_share_cache(i, target) && idle_cpu(i))
return i;
+#endif
+ target_energy = energy_diff_task(target, p);

/*
* Otherwise, iterate the domains and find an elegible idle cpu.
@@ -4666,8 +4670,12 @@ static int select_idle_sibling(struct task_struct *p, int target)
goto next;

for_each_cpu(i, sched_group_cpus(sg)) {
+ int diff;
if (i == target || !idle_cpu(i))
goto next;
+ diff = energy_diff_task(i, p);
+ if (diff > target_energy)
+ goto next;
}

target = cpumask_first_and(sched_group_cpus(sg),
--
1.7.9.5



\
 
 \ /
  Last update: 2014-05-23 21:01    [W:0.313 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site