[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080924161739.31581.70726.stgit@drishya.in.ibm.com>
Date: Wed, 24 Sep 2008 21:47:39 +0530
From: Vaidyanathan Srinivasan <svaidy@...ux.vnet.ibm.com>
To: Linux Kernel <linux-kernel@...r.kernel.org>,
Suresh B Siddha <suresh.b.siddha@...el.com>,
Venkatesh Pallipadi <venkatesh.pallipadi@...el.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Ingo Molnar <mingo@...e.hu>, Dipankar Sarma <dipankar@...ibm.com>,
Balbir Singh <balbir@...ux.vnet.ibm.com>,
Vatsa <vatsa@...ux.vnet.ibm.com>,
Gautham R Shenoy <ego@...ibm.com>,
Andi Kleen <andi@...stfloor.org>,
David Collier-Brown <davecb@....com>,
Tim Connors <tconnors@...ro.swin.edu.au>,
Max Krasnyansky <maxk@...lcomm.com>,
Vaidyanathan Srinivasan <svaidy@...ux.vnet.ibm.com>
Subject: [RFC PATCH v1 2/5] Calculate statistics for current load balance
domain
Add data structures and function to collect per sched domain
statistics required for load balance decision.
Signed-off-by: Vaidyanathan Srinivasan <svaidy@...ux.vnet.ibm.com>
---
kernel/sched.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index abf60ea..8c394a4 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3178,6 +3178,47 @@ int get_group_loads(struct sched_group *group, int this_cpu,
return need_balance;
}
+/* Struct to hold sched domain level loads */
+
+struct sd_loads {
+ struct sched_domain *sd;
+ unsigned long load;
+ unsigned long cpu_power;
+ unsigned long max_load;
+ unsigned long avg_load;
+ struct group_loads local;
+ struct group_loads busiest;
+ /* sched_mc balance groups */
+ struct group_loads min_load_group;
+ struct group_loads power_save_leader_group;
+};
+
+/* Function to aggregate per group loads to sched domain loads */
+
+void update_sd_loads(struct sd_loads *sdl, struct group_loads *gl)
+{
+ int group_capacity = gl->group->__cpu_power / SCHED_LOAD_SCALE;
+
+ if (gl->local_group)
+ sdl->local = *gl;
+ else {
+ sdl->load += gl->load;
+ sdl->cpu_power += gl->group->__cpu_power;
+
+
+ /* Find the busiest */
+ if (gl->load > sdl->load &&
+ (gl->nr_running > group_capacity ||
+ gl->group_imbalance)) {
+
+ sdl->load = gl->load;
+ sdl->busiest = *gl;
+ }
+ }
+
+
+}
+
/*
* find_busiest_group finds and returns the busiest CPU group within the
* domain. It calculates and returns the amount of weighted load which
--
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