From patchwork Wed May 13 20:38:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 48465 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE07C214A1 for ; Wed, 13 May 2015 20:40:41 +0000 (UTC) Received: by wivs14 with SMTP id s14sf14477372wiv.1 for ; Wed, 13 May 2015 13:40:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=z/yjcdyWSzGXGhKKPP55AwLeYnDcn6yaolb5IMqa4Cw=; b=V4BZtJbums718itnSs68UZbMaBA7++Huwz/mpMUsMfrluS7QWxPbUpmC+AE8XU3BVQ 6nPhD0OSr/pa1/+8FjG9heTZGh3yF/BUjZGZwyM4AAur9nMFdLDJgvTpeThBCrx/3CZ6 +MsMZO2nMnTZhoDasgMCVFcBLnqv7EyiLE85ucvfTtwqDqk0q2/4XhQEY4otHCYd2Zxn D7OHJVE2vh3xfnU0nIktqw8bmDZ8atm0SxDJMAZRXuvV0rLSr+qqmRzbrzXwuU9DOGk4 7JnDRNV3nUKGQo6z3EZlM044jfiGknHCG0ZJHc51eIzvIAlLyCHU3znYpkSJ6Cm4DRU5 c6fg== X-Gm-Message-State: ALoCoQmshUR330FXx+ZpE3BRfwN0B9tZDEcKVaVaNL5Ul3XekdGo/CQKCRLwu7lfvj2G3zLx6L/C X-Received: by 10.180.211.168 with SMTP id nd8mr6593637wic.4.1431549641245; Wed, 13 May 2015 13:40:41 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.129 with SMTP id w1ls352373lal.32.gmail; Wed, 13 May 2015 13:40:41 -0700 (PDT) X-Received: by 10.152.88.80 with SMTP id be16mr525653lab.39.1431549641020; Wed, 13 May 2015 13:40:41 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id ln2si13071044lac.106.2015.05.13.13.40.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2015 13:40:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lagv1 with SMTP id v1so39926309lag.3 for ; Wed, 13 May 2015 13:40:40 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr547480lab.35.1431549640859; Wed, 13 May 2015 13:40:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp761797lbb; Wed, 13 May 2015 13:40:39 -0700 (PDT) X-Received: by 10.68.68.170 with SMTP id x10mr1225046pbt.141.1431549639016; Wed, 13 May 2015 13:40:39 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id a4si28732570pdm.121.2015.05.13.13.40.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2015 13:40:39 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YsdQk-0002cC-NZ; Wed, 13 May 2015 20:39:02 +0000 Received: from mail-qk0-f173.google.com ([209.85.220.173]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YsdQd-0002Rn-33 for linux-arm-kernel@lists.infradead.org; Wed, 13 May 2015 20:38:55 +0000 Received: by qkgx75 with SMTP id x75so36873221qkg.1 for ; Wed, 13 May 2015 13:38:30 -0700 (PDT) X-Received: by 10.55.21.224 with SMTP id 93mr1654937qkv.89.1431549510800; Wed, 13 May 2015 13:38:30 -0700 (PDT) Received: from calypso.3dsystems.internal (cpe-67-247-86-207.rochester.res.rr.com. [67.247.86.207]) by mx.google.com with ESMTPSA id r2sm16336091qkr.42.2015.05.13.13.38.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 May 2015 13:38:29 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, khilman@linaro.org, catalin.marinas@arm.com, broonie@linaro.org, vincent.guittot@linaro.org Subject: [PATCH] arm: topology: fix capacity calculation on SMP SoCs Date: Wed, 13 May 2015 16:38:23 -0400 Message-Id: <1431549503-11799-1-git-send-email-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150513_133855_251844_2E0EA1C3 X-CRM114-Status: GOOD ( 11.86 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.173 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.173 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: tixy@linaro.org, will.deacon@arm.com, linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: jorge.ramirez-ortiz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This commit sets the capacity of the average CPU in SMP systems to SCHED_CAPACITY_SCALE. Ignoring the condition "min_capacity==max_capacity" causes the function update_cpu_capacity( .. ) to generate out of range values [1]. This is because the default value of middle_capacity is used in the final calculation instead of a valid scaling factor. Incidentally, when out of range values are generated and if SCHED_FEAT(ARCH_POWER, true), the load balancing algorithm makes the wrong decisions typically overallocating work on one of the cores while leaving the others unused. [1] val > SCHED_CAPACITY_SCALE Signed-off-by: Jorge Ramirez-Ortiz --- arch/arm/kernel/topology.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 08b7847..509bc9b 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -137,14 +137,14 @@ static void __init parse_dt_topology(void) cpu_capacity(cpu) = capacity; } - /* If min and max capacities are equals, we bypass the update of the - * cpu_scale because all CPUs have the same capacity. Otherwise, we - * compute a middle_capacity factor that will ensure that the capacity + /* Compute a middle_capacity factor that will ensure that the capacity * of an 'average' CPU of the system will be as close as possible to * SCHED_CAPACITY_SCALE, which is the default value, but with the * constraint explained near table_efficiency[]. */ - if (4*max_capacity < (3*(max_capacity + min_capacity))) + if (min_capacity == max_capacity) + middle_capacity = min_capacity >> SCHED_CAPACITY_SHIFT; + else if (4*max_capacity < (3*(max_capacity + min_capacity))) middle_capacity = (min_capacity + max_capacity) >> (SCHED_CAPACITY_SHIFT+1); else