aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-09-10 07:35:28 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-15 10:01:03 -0400
commitf5f08f39ee4c5fd0a757d25d9e04d696676b3df7 (patch)
treec2037357c38fd91b628ec71910d4ea4a36037932 /kernel/sched.c
parente26af0e8b2c9916f1e8a12ddaf52057bbe8ff600 (diff)
sched: Move code around
In preparation to other code movement, move weighted_cpuload(), source_load() and target_load() before the class includes. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c81
1 files changed, 39 insertions, 42 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 17e4391ec2de..b56d1505d058 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1507,8 +1507,45 @@ static int tg_nop(struct task_group *tg, void *data)
1507#endif 1507#endif
1508 1508
1509#ifdef CONFIG_SMP 1509#ifdef CONFIG_SMP
1510static unsigned long source_load(int cpu, int type); 1510/* Used instead of source_load when we know the type == 0 */
1511static unsigned long target_load(int cpu, int type); 1511static unsigned long weighted_cpuload(const int cpu)
1512{
1513 return cpu_rq(cpu)->load.weight;
1514}
1515
1516/*
1517 * Return a low guess at the load of a migration-source cpu weighted
1518 * according to the scheduling class and "nice" value.
1519 *
1520 * We want to under-estimate the load of migration sources, to
1521 * balance conservatively.
1522 */
1523static unsigned long source_load(int cpu, int type)
1524{
1525 struct rq *rq = cpu_rq(cpu);
1526 unsigned long total = weighted_cpuload(cpu);
1527
1528 if (type == 0 || !sched_feat(LB_BIAS))
1529 return total;
1530
1531 return min(rq->cpu_load[type-1], total);
1532}
1533
1534/*
1535 * Return a high guess at the load of a migration-target cpu weighted
1536 * according to the scheduling class and "nice" value.
1537 */
1538static unsigned long target_load(int cpu, int type)
1539{
1540 struct rq *rq = cpu_rq(cpu);
1541 unsigned long total = weighted_cpuload(cpu);
1542
1543 if (type == 0 || !sched_feat(LB_BIAS))
1544 return total;
1545
1546 return max(rq->cpu_load[type-1], total);
1547}
1548
1512static int task_hot(struct task_struct *p, u64 now, struct sched_domain *sd); 1549static int task_hot(struct task_struct *p, u64 now, struct sched_domain *sd);
1513 1550
1514static unsigned long cpu_avg_load_per_task(int cpu) 1551static unsigned long cpu_avg_load_per_task(int cpu)
@@ -1959,13 +1996,6 @@ static inline void check_class_changed(struct rq *rq, struct task_struct *p,
1959} 1996}
1960 1997
1961#ifdef CONFIG_SMP 1998#ifdef CONFIG_SMP
1962
1963/* Used instead of source_load when we know the type == 0 */
1964static unsigned long weighted_cpuload(const int cpu)
1965{
1966 return cpu_rq(cpu)->load.weight;
1967}
1968
1969/* 1999/*
1970 * Is this task likely cache-hot: 2000 * Is this task likely cache-hot:
1971 */ 2001 */
@@ -2241,39 +2271,6 @@ void kick_process(struct task_struct *p)
2241EXPORT_SYMBOL_GPL(kick_process); 2271EXPORT_SYMBOL_GPL(kick_process);
2242 2272
2243/* 2273/*
2244 * Return a low guess at the load of a migration-source cpu weighted
2245 * according to the scheduling class and "nice" value.
2246 *
2247 * We want to under-estimate the load of migration sources, to
2248 * balance conservatively.
2249 */
2250static unsigned long source_load(int cpu, int type)
2251{
2252 struct rq *rq = cpu_rq(cpu);
2253 unsigned long total = weighted_cpuload(cpu);
2254
2255 if (type == 0 || !sched_feat(LB_BIAS))
2256 return total;
2257
2258 return min(rq->cpu_load[type-1], total);
2259}
2260
2261/*
2262 * Return a high guess at the load of a migration-target cpu weighted
2263 * according to the scheduling class and "nice" value.
2264 */
2265static unsigned long target_load(int cpu, int type)
2266{
2267 struct rq *rq = cpu_rq(cpu);
2268 unsigned long total = weighted_cpuload(cpu);
2269
2270 if (type == 0 || !sched_feat(LB_BIAS))
2271 return total;
2272
2273 return max(rq->cpu_load[type-1], total);
2274}
2275
2276/*
2277 * find_idlest_group finds and returns the least busy CPU group within the 2274 * find_idlest_group finds and returns the least busy CPU group within the
2278 * domain. 2275 * domain.
2279 */ 2276 */