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: 9290883 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 34E876077B for ; Fri, 19 Aug 2016 20:44:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26F822958E for ; Fri, 19 Aug 2016 20:44:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B12D29591; Fri, 19 Aug 2016 20:44:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6C172958E for ; Fri, 19 Aug 2016 20:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755247AbcHSUnw (ORCPT ); Fri, 19 Aug 2016 16:43:52 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:33975 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755201AbcHSUnv (ORCPT ); Fri, 19 Aug 2016 16:43:51 -0400 Received: by mail-pa0-f53.google.com with SMTP id fi15so19150191pac.1 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=eEuONNe68IoaTsmRMv9R4UVnWUKrxAsmKPqkmSvM1Jj2iHDQ+oc6XHAXq/jhlyeuUZ CQH4glVSTVPPmgEnRO542KPvX8BMatogLEmVnOJJEKxsOCgK/ItrxjeuW5Oqji7JTS4T 8/lYNQ89IVveg6BwsAgpP01hpwBCeSGu3168fSM8fA6Vjsl1sD71pUL1NW8yCUMM4y9W o7Z9JolbgGYafp95qjgGC2ToBhkgETife4K05fS4OE66pq/cBfdkI39jILbdg1cPduPu ZWWys6G1CUoj921Wi37D82WwdPuKInz5qKlQTX/f3RjNE4SgoxFzco2u8f3X8O+KAz4N t3tg== X-Gm-Message-State: AEkoousJw0CvXOGJZqf0oXdsNRmsedwZzr9H2v1vXifkM7TpdCALa5IVhoPOkxr/7Yrue+pv 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;