From patchwork Fri Aug 19 20:43:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Muckle X-Patchwork-Id: 74335 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp489169qga; Fri, 19 Aug 2016 13:43:55 -0700 (PDT) X-Received: by 10.66.43.164 with SMTP id x4mr17055708pal.11.1471639435727; Fri, 19 Aug 2016 13:43:55 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14si6700962pfk.155.2016.08.19.13.43.55; Fri, 19 Aug 2016 13:43:55 -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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755566AbcHSUnx (ORCPT + 27 others); Fri, 19 Aug 2016 16:43:53 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:36551 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754127AbcHSUnv (ORCPT ); Fri, 19 Aug 2016 16:43:51 -0400 Received: by mail-pa0-f43.google.com with SMTP id pp5so19111959pac.3 for ; Fri, 19 Aug 2016 13:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=jjSFDmXPMTulbXsLSFHSEQ4P82W1uSfo6lEAZ64675Y=; b=g841+Ga1FPogjMihojdcR/8WBspHwsTLqsjVG2/kR22z4H6Wj43TYGWZmOs9SdKRlr eFgEFkHaCBrioyRAKp1+wWBKMlQcVjEeFI0ABo9IVM+nGcvEVbQF61OHbwIXwnIv66AC mIHS1Pc4FYhhtFqPBVaNv0gbIXx78pkyRb0GQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jjSFDmXPMTulbXsLSFHSEQ4P82W1uSfo6lEAZ64675Y=; b=VUrpP8WiQtKWEXU2l4qdiS3h/9zeVsXDASffWVC76p9P2aw+NTr8KM8Jkptn40gluK YugCXpXsI+wY2TY+RQby7v5vq2oFEuyRcQIQtMH3s9qAvougP6MJfqcB1IiLMgshNFdx gqiXHyCOYs6DcLVU0VEbxJunKp61tSKCYR8OwV4eUWIvx83A9EwDtK5AxI4FTCGnhVRi WMWXZ81IHEg9ewCPld1rz8HoZepLcfh78PPIEAj5T0zPELpl7xOo/+fffWd6W9Y6ujrd tXeHpp8l7LhGtUUuOQ/++blmsTT49uwxUNKSTa7s5eGidUsp7llPgmw6nncd6CiNGgxH W0cQ== X-Gm-Message-State: AEkooutn3nJHPX0ByQT1v3eu791MC4J7Wwv0m4fM0OTZmnHqLhwfaKPh+kRL+LWxpRCwcCi+ X-Received: by 10.66.219.105 with SMTP id pn9mr17180913pac.25.1471639431053; Fri, 19 Aug 2016 13:43:51 -0700 (PDT) Received: from graphite.smuckle.net (cpe-76-167-105-107.san.res.rr.com. [76.167.105.107]) by smtp.gmail.com with ESMTPSA id 9sm8608933pfo.74.2016.08.19.13.43.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Aug 2016 13:43:50 -0700 (PDT) From: Steve Muckle X-Google-Original-From: Steve Muckle To: Peter Zijlstra , Ingo Molnar , "Rafael J . Wysocki" Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Juri Lelli , Patrick Bellasi , Steve Muckle Subject: [PATCH] sched: cpufreq: ignore SMT when determining max cpu capacity Date: Fri, 19 Aug 2016 13:43:47 -0700 Message-Id: <1471639427-16006-1-git-send-email-smuckle@linaro.org> X-Mailer: git-send-email 2.7.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PELT does not consider SMT when scaling its utilization values via arch_scale_cpu_capacity(). The value in rq->cpu_capacity_orig does take SMT into consideration though and therefore may be smaller than the utilization reported by PELT. On an Intel i7-3630QM for example rq->cpu_capacity_orig is 589 but util_avg scales up to 1024. This means that a 50% utilized CPU will show up in schedutil as ~86% busy. Fix this by using the same CPU scaling value in schedutil as that which is used by PELT. Signed-off-by: Steve Muckle --- kernel/sched/cpufreq_schedutil.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.7.3 diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 60d985f4dc47..cb8a77b1ef1b 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -147,7 +147,9 @@ static unsigned int get_next_freq(struct sugov_cpu *sg_cpu, unsigned long util, static void sugov_get_util(unsigned long *util, unsigned long *max) { struct rq *rq = this_rq(); - unsigned long cfs_max = rq->cpu_capacity_orig; + unsigned long cfs_max; + + cfs_max = arch_scale_cpu_capacity(NULL, smp_processor_id()); *util = min(rq->cfs.avg.util_avg, cfs_max); *max = cfs_max;