From patchwork Thu Oct 25 10:25:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: preeti X-Patchwork-Id: 1643011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id EFBFE3FE1C for ; Thu, 25 Oct 2012 10:30:08 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TRKdr-0001AW-UB; Thu, 25 Oct 2012 10:26:24 +0000 Received: from e28smtp01.in.ibm.com ([122.248.162.1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TRKdZ-00012d-My for linux-arm-kernel@lists.infradead.org; Thu, 25 Oct 2012 10:26:07 +0000 Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Oct 2012 15:56:00 +0530 Received: from d28relay02.in.ibm.com (9.184.220.59) by e28smtp01.in.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 25 Oct 2012 15:55:59 +0530 Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9PAPwJn37880056 for ; Thu, 25 Oct 2012 15:55:58 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9PFsqQa019570 for ; Fri, 26 Oct 2012 02:54:57 +1100 Received: from preeti.in.ibm.com (preeti.in.ibm.com [9.124.35.56]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q9PFspHC019561; Fri, 26 Oct 2012 02:54:52 +1100 Subject: [RFC PATCH 05/13] sched:Calculate imbalance using PJT's metric To: svaidy@linux.vnet.ibm.com, linux-kernel@vger.kernel.org From: Preeti U Murthy Date: Thu, 25 Oct 2012 15:55:32 +0530 Message-ID: <20121025102532.21022.18051.stgit@preeti.in.ibm.com> In-Reply-To: <20121025102045.21022.92489.stgit@preeti.in.ibm.com> References: <20121025102045.21022.92489.stgit@preeti.in.ibm.com> User-Agent: StGit/0.16-38-g167d MIME-Version: 1.0 x-cbid: 12102510-4790-0000-0000-0000053C9453 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [122.248.162.1 listed in list.dnswl.org] 3.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Morten.Rasmussen@arm.com, venki@google.com, robin.randhawa@arm.com, linaro-dev@lists.linaro.org, a.p.zijlstra@chello.nl, mjg59@srcf.ucam.org, viresh.kumar@linaro.org, amit.kucheria@linaro.org, deepthi@linux.vnet.ibm.com, Arvind.Chauhan@arm.com, paul.mckenney@linaro.org, suresh.b.siddha@intel.com, tglx@linutronix.de, srivatsa.bhat@linux.vnet.ibm.com, vincent.guittot@linaro.org, akpm@linux-foundation.org, paulmck@linux.vnet.ibm.com, arjan@linux.intel.com, mingo@kernel.org, linux-arm-kernel@lists.infradead.org, pjt@google.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Additional parameters which decide the amount of imbalance in the sched domain calculated using PJT's metric are used. Signed-off-by: Preeti U Murthy --- kernel/sched/fair.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 77363c6..fca6606 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4892,12 +4892,14 @@ void fix_small_imbalance(struct lb_env *env, struct sd_lb_stats *sds) */ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *sds) { - unsigned long max_pull, load_above_capacity = ~0UL; + /* Additional parameters introduced to use PJT's metric */ + u64 max_load_pull, load_above_busiest_capacity = ~0ULL; - sds->busiest_load_per_task /= sds->busiest_nr_running; + /* Calculation using PJT's metric */ + sds->busiest_sg_load_per_task /= sds->busiest_nr_running; if (sds->group_imb) { - sds->busiest_load_per_task = - min(sds->busiest_load_per_task, sds->avg_load); + sds->busiest_sg_load_per_task = + min(sds->busiest_sg_load_per_task, sds->avg_sgs_load); } /* @@ -4905,21 +4907,24 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s * max load less than avg load(as we skip the groups at or below * its cpu_power, while calculating max_load..) */ - if (sds->max_load < sds->avg_load) { + if (sds->max_sg_load < sds->avg_sgs_load) { env->imbalance = 0; + env->load_imbalance = 0; return fix_small_imbalance(env, sds); } if (!sds->group_imb) { /* * Don't want to pull so many tasks that a group would go idle. + * Also the below change due to the integration with PJT's + * metric */ - load_above_capacity = (sds->busiest_nr_running - + load_above_busiest_capacity = (sds->busiest_nr_running - sds->busiest_group_capacity); - load_above_capacity *= (SCHED_LOAD_SCALE * SCHED_POWER_SCALE); + load_above_busiest_capacity *= (SCHED_LOAD_SCALE * SCHED_POWER_SCALE); - load_above_capacity /= sds->busiest->sgp->power; + load_above_busiest_capacity /= sds->busiest->sgp->power; } /* @@ -4932,11 +4937,16 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s * Be careful of negative numbers as they'll appear as very large values * with unsigned longs. */ - max_pull = min(sds->max_load - sds->avg_load, load_above_capacity); + /* + * The below maximum load to be pulled is based on the PJT's metric + */ + max_load_pull = min(sds->max_sg_load - sds->avg_sgs_load, load_above_busiest_capacity); - /* How much load to actually move to equalise the imbalance */ - env->imbalance = min(max_pull * sds->busiest->sgp->power, - (sds->avg_load - sds->this_load) * sds->this->sgp->power) + /* How much load to actually move to equalise the imbalance + * Calculated using PJT's metric + */ + env->load_imbalance = min(max_load_pull * sds->busiest->sgp->power, + (sds->avg_sgs_load - sds->this_sg_load) * sds->this->sgp->power) / SCHED_POWER_SCALE; /* @@ -4945,7 +4955,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s * a think about bumping its value to force at least one task to be * moved */ - if (env->imbalance < sds->busiest_load_per_task) + if (env->load_imbalance < sds->busiest_sg_load_per_task) return fix_small_imbalance(env, sds); }