[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-a021dc03376707c55a3483e32c16b8986d4414cc@git.kernel.org>
Date: Wed, 25 Mar 2009 09:47:01 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: Optimize the !power_savings_balance during fbg()
Commit-ID: a021dc03376707c55a3483e32c16b8986d4414cc
Gitweb: http://git.kernel.org/tip/a021dc03376707c55a3483e32c16b8986d4414cc
Author: Gautham R Shenoy <ego@...ibm.com>
AuthorDate: Wed, 25 Mar 2009 14:44:17 +0530
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Wed, 25 Mar 2009 10:30:48 +0100
sched: Optimize the !power_savings_balance during fbg()
Impact: cleanup, micro-optimization
We don't need to perform power_savings balance if either the
cpu is NOT_IDLE or if the sched_domain doesn't contain the
SD_POWERSAVINGS_BALANCE flag set.
Currently, we check for these conditions multiple number of
times, even though these variables don't change over the scope
of find_busiest_group().
Check once, and store the value in the already exiting
"power_savings_balance" variable.
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: <20090325091417.13992.2657.stgit@...ia.in.ibm.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
kernel/sched.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 934f615..71e8dca 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3386,8 +3386,17 @@ static inline void update_sd_lb_stats(struct sched_domain *sd, int this_cpu,
int load_idx;
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
- sds->power_savings_balance = 1;
- sds->min_nr_running = ULONG_MAX;
+ /*
+ * Busy processors will not participate in power savings
+ * balance.
+ */
+ if (idle == CPU_NOT_IDLE || !(sd->flags & SD_POWERSAVINGS_BALANCE))
+ sds->power_savings_balance = 0;
+ else {
+ sds->power_savings_balance = 1;
+ sds->min_nr_running = ULONG_MAX;
+ sds->leader_nr_running = 0;
+ }
#endif
load_idx = get_sd_load_idx(sd, idle);
@@ -3422,12 +3431,8 @@ static inline void update_sd_lb_stats(struct sched_domain *sd, int this_cpu,
}
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
- /*
- * Busy processors will not participate in power savings
- * balance.
- */
- if (idle == CPU_NOT_IDLE ||
- !(sd->flags & SD_POWERSAVINGS_BALANCE))
+
+ if (!sds->power_savings_balance)
goto group_next;
/*
@@ -3651,7 +3656,7 @@ find_busiest_group(struct sched_domain *sd, int this_cpu,
out_balanced:
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
- if (idle == CPU_NOT_IDLE || !(sd->flags & SD_POWERSAVINGS_BALANCE))
+ if (!sds.power_savings_balance)
goto ret;
if (sds.this != sds.group_leader || sds.group_leader == sds.group_min)
--
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