From patchwork Thu Oct 25 10:24:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: preeti X-Patchwork-Id: 1643021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id BE86EDF2AB for ; Thu, 25 Oct 2012 10:30:50 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TRKeW-0001Sg-Mi; Thu, 25 Oct 2012 10:27:05 +0000 Received: from e23smtp09.au.ibm.com ([202.81.31.142]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TRKdV-0000pc-Vc for linux-arm-kernel@lists.infradead.org; Thu, 25 Oct 2012 10:26:12 +0000 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Oct 2012 20:22:10 +1000 Received: from d23relay03.au.ibm.com (202.81.31.245) by e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 25 Oct 2012 20:22:07 +1000 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9PAPJrj39911624 for ; Thu, 25 Oct 2012 21:25:19 +1100 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9PAPGnO032567 for ; Thu, 25 Oct 2012 21:25:19 +1100 Received: from preeti.in.ibm.com (preeti.in.ibm.com [9.124.35.56]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q9PAPBLP032331; Thu, 25 Oct 2012 21:25:12 +1100 Subject: [RFC PATCH 01/13] sched:Prevent movement of short running tasks during load balancing To: svaidy@linux.vnet.ibm.com, linux-kernel@vger.kernel.org From: Preeti U Murthy Date: Thu, 25 Oct 2012 15:54:52 +0530 Message-ID: <20121025102452.21022.70635.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-3568-0000-0000-000002A7149E 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 [202.81.31.142 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 Prevent sched groups with low load as tracked by PJT's metrics from being candidates of the load balance routine.This metric is chosen to be 1024+15%*1024.But using PJT's metrics it has been observed that even when three 10% tasks are running,the load sometimes does not exceed this threshold.The call should be taken if the tasks can afford to be throttled. This is why an additional metric has been included,which can determine how long we can tolerate tasks not being moved even if the load is low. Signed-off-by: Preeti U Murthy --- kernel/sched/fair.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index dbddcf6..e02dad4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4188,6 +4188,7 @@ struct sd_lb_stats { */ struct sg_lb_stats { unsigned long avg_load; /*Avg load across the CPUs of the group */ + u64 avg_cfs_runnable_load; /* Equivalent of avg_load but calculated using PJT's metric */ unsigned long group_load; /* Total load over the CPUs of the group */ unsigned long sum_nr_running; /* Nr tasks running in the group */ unsigned long sum_weighted_load; /* Weighted load of group's tasks */ @@ -4504,6 +4505,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, unsigned long load, max_cpu_load, min_cpu_load; unsigned int balance_cpu = -1, first_idle_cpu = 0; unsigned long avg_load_per_task = 0; + u64 group_load = 0; /* computed using PJT's metric */ int i; if (local_group) @@ -4548,6 +4550,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, if (idle_cpu(i)) sgs->idle_cpus++; + group_load += cpu_rq(i)->cfs.runnable_load_avg; update_sg_numa_stats(sgs, rq); } @@ -4572,6 +4575,19 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->avg_load = (sgs->group_load*SCHED_POWER_SCALE) / group->sgp->power; /* + * Check if the sched group has not crossed the threshold. + * + * Also check if the sched_group although being within the threshold,is not + * queueing too many tasks.If yes to both,then make it an + * invalid candidate for load balancing + * + * The below condition is included as a tunable to meet performance and power needs + */ + sgs->avg_cfs_runnable_load = (group_load * SCHED_POWER_SCALE) / group->sgp->power; + if (sgs->avg_cfs_runnable_load <= 1178 && sgs->sum_nr_running <= 2) + sgs->avg_cfs_runnable_load = 0; + + /* * Consider the group unbalanced when the imbalance is larger * than the average weight of a task. *