[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-6dfdb0629019f307ab18864b1fd3e5dbb02f383c@git.kernel.org>
Date: Wed, 25 Mar 2009 09:46:09 GMT
From: Gautham R Shenoy <ego@...ibm.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, ego@...ibm.com, hpa@...or.com,
mingo@...hat.com, a.p.zijlstra@...llo.nl,
dhaval@...ux.vnet.ibm.com, balbir@...ibm.com,
bharata@...ux.vnet.ibm.com, suresh.b.siddha@...el.com,
tglx@...utronix.de, mingo@...e.hu, svaidy@...ux.vnet.ibm.com,
nickpiggin@...oo.com.au
Subject: [tip:sched/balancing] sched: Fix indentations in find_busiest_group() using gotos
Commit-ID: 6dfdb0629019f307ab18864b1fd3e5dbb02f383c
Gitweb: http://git.kernel.org/tip/6dfdb0629019f307ab18864b1fd3e5dbb02f383c
Author: Gautham R Shenoy <ego@...ibm.com>
AuthorDate: Wed, 25 Mar 2009 14:43:40 +0530
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Wed, 25 Mar 2009 10:30:44 +0100
sched: Fix indentations in find_busiest_group() using gotos
Impact: cleanup
Some indentations in find_busiest_group() can minimized by using
early exits with the help of gotos. This improves readability in
a couple of cases.
Signed-off-by: Gautham R Shenoy <ego@...ibm.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Suresh Siddha <suresh.b.siddha@...el.com>
Cc: "Balbir Singh" <balbir@...ibm.com>
Cc: Nick Piggin <nickpiggin@...oo.com.au>
Cc: "Dhaval Giani" <dhaval@...ux.vnet.ibm.com>
Cc: Bharata B Rao <bharata@...ux.vnet.ibm.com>
Cc: "Vaidyanathan Srinivasan" <svaidy@...ux.vnet.ibm.com>
LKML-Reference: <20090325091340.13992.45062.stgit@...ia.in.ibm.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
kernel/sched.c | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 6aec1e7..f87adbe 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3403,14 +3403,14 @@ find_busiest_group(struct sched_domain *sd, int this_cpu,
* capacity but still has some space to pick up some load
* from other group and save more power
*/
- if (sum_nr_running <= group_capacity - 1) {
- if (sum_nr_running > leader_nr_running ||
- (sum_nr_running == leader_nr_running &&
- group_first_cpu(group) <
- group_first_cpu(group_leader))) {
- group_leader = group;
- leader_nr_running = sum_nr_running;
- }
+ if (sum_nr_running > group_capacity - 1)
+ goto group_next;
+
+ if (sum_nr_running > leader_nr_running ||
+ (sum_nr_running == leader_nr_running &&
+ group_first_cpu(group) < group_first_cpu(group_leader))) {
+ group_leader = group;
+ leader_nr_running = sum_nr_running;
}
group_next:
#endif
@@ -3531,14 +3531,16 @@ out_balanced:
if (idle == CPU_NOT_IDLE || !(sd->flags & SD_POWERSAVINGS_BALANCE))
goto ret;
- if (this == group_leader && group_leader != group_min) {
- *imbalance = min_load_per_task;
- if (sched_mc_power_savings >= POWERSAVINGS_BALANCE_WAKEUP) {
- cpu_rq(this_cpu)->rd->sched_mc_preferred_wakeup_cpu =
- group_first_cpu(group_leader);
- }
- return group_min;
+ if (this != group_leader || group_leader == group_min)
+ goto ret;
+
+ *imbalance = min_load_per_task;
+ if (sched_mc_power_savings >= POWERSAVINGS_BALANCE_WAKEUP) {
+ cpu_rq(this_cpu)->rd->sched_mc_preferred_wakeup_cpu =
+ group_first_cpu(group_leader);
}
+ return group_min;
+
#endif
ret:
*imbalance = 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists