From patchwork Fri Apr 29 19:32:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 66972 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp969583qge; Fri, 29 Apr 2016 12:34:28 -0700 (PDT) X-Received: by 10.66.78.73 with SMTP id z9mr31346596paw.4.1461958468503; Fri, 29 Apr 2016 12:34:28 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si3762158pat.170.2016.04.29.12.34.28; Fri, 29 Apr 2016 12:34:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752918AbcD2Te0 (ORCPT + 29 others); Fri, 29 Apr 2016 15:34:26 -0400 Received: from foss.arm.com ([217.140.101.70]:53137 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752603AbcD2TdU (ORCPT ); Fri, 29 Apr 2016 15:33:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 48553435; Fri, 29 Apr 2016 12:33:22 -0700 (PDT) Received: from e107985-lin.cambridge.arm.com (e107985-lin.cambridge.arm.com [10.1.207.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2EABE3F25F; Fri, 29 Apr 2016 12:33:19 -0700 (PDT) From: Dietmar Eggemann To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Morten Rasmussen Subject: [PATCH 3/7] sched/fair: Correct unit of load_above_capacity Date: Fri, 29 Apr 2016 20:32:40 +0100 Message-Id: <1461958364-675-4-git-send-email-dietmar.eggemann@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461958364-675-1-git-send-email-dietmar.eggemann@arm.com> References: <1461958364-675-1-git-send-email-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Morten Rasmussen In calculate_imbalance() load_above_capacity currently has the unit [load] while it is used as being [load/capacity]. Not only is it wrong it also makes it unlikely that load_above_capacity is ever used as the subsequent code picks the smaller of load_above_capacity and the avg_load difference between the local and the busiest sched_groups. This patch ensures that load_above_capacity has the right unit [load/capacity]. Signed-off-by: Morten Rasmussen --- kernel/sched/fair.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 1.9.1 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index bc19fee94f39..c066574cff04 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7016,9 +7016,11 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s local->group_type == group_overloaded) { load_above_capacity = busiest->sum_nr_running * SCHED_LOAD_SCALE; - if (load_above_capacity > busiest->group_capacity) + if (load_above_capacity > busiest->group_capacity) { load_above_capacity -= busiest->group_capacity; - else + load_above_capacity *= SCHED_LOAD_SCALE; + load_above_capacity /= busiest->group_capacity; + } else load_above_capacity = ~0UL; }