lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081009120934.27010.45896.stgit@drishya.in.ibm.com>
Date:	Thu, 09 Oct 2008 17:39:34 +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 v2 2/5] sched: 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 |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index ab77937..cfd83d9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3178,6 +3178,57 @@ 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; /* Total decay load */
+	unsigned long cpu_power; /* Total cpu_power */
+	unsigned long max_load; /* load of busiest group */
+	unsigned long load_per_cpu; /* Decay load per cpu in this sd
+				     * (load/cpu_power)
+				     */
+	struct group_loads local; /* this_cpu's group,
+				   * need to pull from busiest
+				   */
+	struct group_loads busiest; /* Candidate group to pull */
+	/* sched_mc power_save balance groups */
+	struct group_loads min_load_group; /* Group that is least loaded and
+					    * can fit the tasks into the
+					    * leader group
+					    */
+	struct group_loads power_save_leader_group; /* Group that is almost
+						     * full but can still pull
+						     * tasks from
+						     * min_load_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;
+	sdl->max_load = 0;
+
+	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->max_load &&
+			(gl->nr_running > group_capacity ||
+			 gl->group_imbalance)) {
+
+			sdl->max_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

Powered by Openwall GNU/*/Linux Powered by OpenVZ