Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3476510ybc; Thu, 21 Nov 2019 08:53:47 -0800 (PST) X-Google-Smtp-Source: APXvYqzfBaLWRsXsL9Rk2mBIBu82umvLVCEZ96o+mLR1i/oj1EWXGnTAk/NTHSsYp8yDAaRItFPL X-Received: by 2002:a17:906:f18b:: with SMTP id gs11mr15319586ejb.2.1574355227880; Thu, 21 Nov 2019 08:53:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574355227; cv=none; d=google.com; s=arc-20160816; b=XNhluVqHokRpF4w5h1Re7VOq3mTYoXnoerTIiUQD4RQxmAYYb4Bx4vyC15hYZZwPNq ietLiieUWvwo+luWGrvEffmUfPqXhG0yCaXfw0Ep7Tol8lPMy3G8yANGNQYtufhYREWZ N4jJwkffQi19pufqhdtCuyp+MsfYjWw6kqPpDoN2iz2SPKDZUtwBoP2+sGt9v1tjaDeB zxRN6nEiOEJrUZOPsUHS/udbIh24/RYCf2q/EbHPVwtkrzSIfndgprWipkgLOrY2G6vH gzncfsRI10lz5LCKr2cL6r8P9Gz0kjkObjfC53jr5sBnwxGjcZCZTmuPbIruHotp2Eyv +Yhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=egH9PNK4e5KX3qLK0y4dHOZIozEq/Hewy+ECDbeOcDg=; b=N6BHPJv5SRPEX0TALBzzdD2/DDMUs6Gq0Ity9D+pBAWcu16osBanSlrM8vC3n8LUhh hoU2iQw1bDws+XkyZOfM2n8LJ2F2O/WYAGZBeiCpAnJIz5bBaxJolefHYJZXCw7fjSAP IDdOwwZNuTrnsyenFsq07wxvTSfuBwi7aqI/VgFSxEVGG1YYmLPuImBzM985vY5e5Ant 9CNU3ZwkvFo35m06uqrUmhpUke0pSlXuT0HYLQh4tTSCbLnNwtaXnD+R6Y4ewIQQ3PXo QMp3TIOpNRRyw1h4Ou6TJP0I64wwe/UQ0U0I0LSM9QXvoMozgwRs0WD+6HA/qn3llbTy KnKA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si2270073ejz.434.2019.11.21.08.53.23; Thu, 21 Nov 2019 08:53:47 -0800 (PST) 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 S1727116AbfKUQsQ (ORCPT + 99 others); Thu, 21 Nov 2019 11:48:16 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:32908 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726714AbfKUQsQ (ORCPT ); Thu, 21 Nov 2019 11:48:16 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iXpcm-0000Yx-64; Thu, 21 Nov 2019 17:48:08 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id C971B1C1A3E; Thu, 21 Nov 2019 17:48:07 +0100 (CET) Date: Thu, 21 Nov 2019 16:48:07 -0000 From: "tip-bot2 for Frederic Weisbecker" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] cpufreq: Use vtime aware kcpustat accessors for user time Cc: Yauheni Kaliuta , Frederic Weisbecker , "Rafael J. Wysocki" , Viresh Kumar , Peter Zijlstra , Wanpeng Li , Ingo Molnar , x86 , LKML In-Reply-To: <20191121024430.19938-5-frederic@kernel.org> References: <20191121024430.19938-5-frederic@kernel.org> MIME-Version: 1.0 Message-ID: <157435488775.21853.13702570973874298046.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 5720821ba1d845f0b91a9278137e9005c5f6931d Gitweb: https://git.kernel.org/tip/5720821ba1d845f0b91a9278137e9005c5f6931d Author: Frederic Weisbecker AuthorDate: Thu, 21 Nov 2019 03:44:28 +01:00 Committer: Ingo Molnar CommitterDate: Thu, 21 Nov 2019 07:33:25 +01:00 cpufreq: Use vtime aware kcpustat accessors for user time We can now safely read user and guest kcpustat fields on nohz_full CPUs. Use the appropriate accessors. Reported-by: Yauheni Kaliuta Signed-off-by: Frederic Weisbecker Cc: Rafael J. Wysocki Cc: Viresh Kumar Cc: Peter Zijlstra Cc: Wanpeng Li Link: https://lkml.kernel.org/r/20191121024430.19938-5-frederic@kernel.org Signed-off-by: Ingo Molnar --- drivers/cpufreq/cpufreq.c | 17 ++++++++++------- drivers/cpufreq/cpufreq_governor.c | 6 +++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 527fd06..ee23eaf 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -113,18 +113,21 @@ EXPORT_SYMBOL_GPL(get_governor_parent_kobj); static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) { - u64 idle_time; + struct kernel_cpustat kcpustat; u64 cur_wall_time; + u64 idle_time; u64 busy_time; cur_wall_time = jiffies64_to_nsecs(get_jiffies_64()); - busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER]; - busy_time += kcpustat_field(&kcpustat_cpu(cpu), CPUTIME_SYSTEM, cpu); - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_IRQ]; - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SOFTIRQ]; - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL]; - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE]; + kcpustat_cpu_fetch(&kcpustat, cpu); + + busy_time = kcpustat.cpustat[CPUTIME_USER]; + busy_time += kcpustat.cpustat[CPUTIME_SYSTEM]; + busy_time += kcpustat.cpustat[CPUTIME_IRQ]; + busy_time += kcpustat.cpustat[CPUTIME_SOFTIRQ]; + busy_time += kcpustat.cpustat[CPUTIME_STEAL]; + busy_time += kcpustat.cpustat[CPUTIME_NICE]; idle_time = cur_wall_time - busy_time; if (wall) diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 4bb054d..f99ae45 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -105,7 +105,7 @@ void gov_update_cpu_data(struct dbs_data *dbs_data) j_cdbs->prev_cpu_idle = get_cpu_idle_time(j, &j_cdbs->prev_update_time, dbs_data->io_is_busy); if (dbs_data->ignore_nice_load) - j_cdbs->prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; + j_cdbs->prev_cpu_nice = kcpustat_field(&kcpustat_cpu(j), CPUTIME_NICE, j); } } } @@ -149,7 +149,7 @@ unsigned int dbs_update(struct cpufreq_policy *policy) j_cdbs->prev_cpu_idle = cur_idle_time; if (ignore_nice) { - u64 cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; + u64 cur_nice = kcpustat_field(&kcpustat_cpu(j), CPUTIME_NICE, j); idle_time += div_u64(cur_nice - j_cdbs->prev_cpu_nice, NSEC_PER_USEC); j_cdbs->prev_cpu_nice = cur_nice; @@ -530,7 +530,7 @@ int cpufreq_dbs_governor_start(struct cpufreq_policy *policy) j_cdbs->prev_load = 0; if (ignore_nice) - j_cdbs->prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; + j_cdbs->prev_cpu_nice = kcpustat_field(&kcpustat_cpu(j), CPUTIME_NICE, j); } gov->start(policy);