Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3473198ybc; Thu, 21 Nov 2019 08:50:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxoDU5/CZB9EGC0TqbxDm2mfpZhrTp34G4Ipi53GBD8EQtisRgPZKi+mIRTFMR3v7rTC9Ca X-Received: by 2002:a17:906:c41:: with SMTP id t1mr14815887ejf.282.1574355024896; Thu, 21 Nov 2019 08:50:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574355024; cv=none; d=google.com; s=arc-20160816; b=C3ozNWVmradb0I7yLh2ondU2UexMy1Iz88mPTnF2y6W421iTsKBRxKxhjKklS/6IVn 7GwH7UEFKRLT30y+dpJsUE2AKeI87yM5WBeADO8xXm9xA1UjZHEFr6uM3udk+/ttyWuI Gk5O8ih0tHEGuudF31/ku/8qf8wCiK5v1gFwXuuX28AjGhmvVv4qmpQwlV03tn/fPmjs 2cZZg3QCbyMeBDnp3Ik8yqBl7n0c1vaKCnS3wF08iZZXFicbRPowlJ7TGtlMC5sf4Ej7 u58JngoL6ErUlBDnotLDNZcK/lSGYssaJ1xOcmngDw97qpEia7hnbjHQ3uDJkMZr0Bre 2wew== 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=eQ16KGtSnRp1ygwNOuU7ufL6cvy4NSeg5xhEKI1UhcU=; b=Jm0jfvIMgzR9D0NfvMPsqX8oU7hrrPlTBSzxIY1u2odLMYngich38Ummhaj1PiIRPQ IMp8G8WBaJz2ji456KB5NXS4DmmLZNVIc0Ay0X62bAU7p9v1/pG7658mUqZEvRUsaCRP 4eSaypWFUP0zgb9LRe2fE78gtlJccZCOTQh9ciMk4og4f37+F0K91zz4oBBxvA7PGQKf 4xdcBEq9derwnPqWKtbx2p4JOHM4iDgR9L0W2PXJCPNC39BcrlWs6Arh20YPmMd3HLq0 L7JTifG3QWy3INSurdX86dKWz0y33R5iKzixcqSdhicUJfwdSV43zIrEmyg7kmfL3eIt U0uw== 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 gq14si2023801ejb.190.2019.11.21.08.49.56; Thu, 21 Nov 2019 08:50:24 -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 S1727171AbfKUQsT (ORCPT + 99 others); Thu, 21 Nov 2019 11:48:19 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:32914 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727109AbfKUQsS (ORCPT ); Thu, 21 Nov 2019 11:48:18 -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-0000Z1-8W; 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 EABCB1C1A3B; 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] procfs: Use all-in-one vtime aware kcpustat accessor Cc: Yauheni Kaliuta , Frederic Weisbecker , Al Viro , Peter Zijlstra , Wanpeng Li , Ingo Molnar , x86 , LKML In-Reply-To: <20191121024430.19938-4-frederic@kernel.org> References: <20191121024430.19938-4-frederic@kernel.org> MIME-Version: 1.0 Message-ID: <157435488789.21853.3157956857911322483.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: 26dae145a76c3615588f263885904c6e567ff116 Gitweb: https://git.kernel.org/tip/26dae145a76c3615588f263885904c6e567ff116 Author: Frederic Weisbecker AuthorDate: Thu, 21 Nov 2019 03:44:27 +01:00 Committer: Ingo Molnar CommitterDate: Thu, 21 Nov 2019 07:33:24 +01:00 procfs: Use all-in-one vtime aware kcpustat accessor Now that we can read also user and guest time safely under vtime, use the relevant accessor to fix frozen kcpustat values on nohz_full CPUs. Reported-by: Yauheni Kaliuta Signed-off-by: Frederic Weisbecker Cc: Al Viro Cc: Peter Zijlstra Cc: Wanpeng Li Link: https://lkml.kernel.org/r/20191121024430.19938-4-frederic@kernel.org Signed-off-by: Ingo Molnar --- fs/proc/stat.c | 56 +++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 5c6bd0a..37bdbec 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c @@ -120,20 +120,23 @@ static int show_stat(struct seq_file *p, void *v) getboottime64(&boottime); for_each_possible_cpu(i) { - struct kernel_cpustat *kcs = &kcpustat_cpu(i); - - user += kcs->cpustat[CPUTIME_USER]; - nice += kcs->cpustat[CPUTIME_NICE]; - system += kcpustat_field(kcs, CPUTIME_SYSTEM, i); - idle += get_idle_time(kcs, i); - iowait += get_iowait_time(kcs, i); - irq += kcs->cpustat[CPUTIME_IRQ]; - softirq += kcs->cpustat[CPUTIME_SOFTIRQ]; - steal += kcs->cpustat[CPUTIME_STEAL]; - guest += kcs->cpustat[CPUTIME_GUEST]; - guest_nice += kcs->cpustat[CPUTIME_GUEST_NICE]; - sum += kstat_cpu_irqs_sum(i); - sum += arch_irq_stat_cpu(i); + struct kernel_cpustat kcpustat; + u64 *cpustat = kcpustat.cpustat; + + kcpustat_cpu_fetch(&kcpustat, i); + + user += cpustat[CPUTIME_USER]; + nice += cpustat[CPUTIME_NICE]; + system += cpustat[CPUTIME_SYSTEM]; + idle += get_idle_time(&kcpustat, i); + iowait += get_iowait_time(&kcpustat, i); + irq += cpustat[CPUTIME_IRQ]; + softirq += cpustat[CPUTIME_SOFTIRQ]; + steal += cpustat[CPUTIME_STEAL]; + guest += cpustat[CPUTIME_GUEST]; + guest_nice += cpustat[CPUTIME_USER]; + sum += kstat_cpu_irqs_sum(i); + sum += arch_irq_stat_cpu(i); for (j = 0; j < NR_SOFTIRQS; j++) { unsigned int softirq_stat = kstat_softirqs_cpu(j, i); @@ -157,19 +160,22 @@ static int show_stat(struct seq_file *p, void *v) seq_putc(p, '\n'); for_each_online_cpu(i) { - struct kernel_cpustat *kcs = &kcpustat_cpu(i); + struct kernel_cpustat kcpustat; + u64 *cpustat = kcpustat.cpustat; + + kcpustat_cpu_fetch(&kcpustat, i); /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ - user = kcs->cpustat[CPUTIME_USER]; - nice = kcs->cpustat[CPUTIME_NICE]; - system = kcpustat_field(kcs, CPUTIME_SYSTEM, i); - idle = get_idle_time(kcs, i); - iowait = get_iowait_time(kcs, i); - irq = kcs->cpustat[CPUTIME_IRQ]; - softirq = kcs->cpustat[CPUTIME_SOFTIRQ]; - steal = kcs->cpustat[CPUTIME_STEAL]; - guest = kcs->cpustat[CPUTIME_GUEST]; - guest_nice = kcs->cpustat[CPUTIME_GUEST_NICE]; + user = cpustat[CPUTIME_USER]; + nice = cpustat[CPUTIME_NICE]; + system = cpustat[CPUTIME_SYSTEM]; + idle = get_idle_time(&kcpustat, i); + iowait = get_iowait_time(&kcpustat, i); + irq = cpustat[CPUTIME_IRQ]; + softirq = cpustat[CPUTIME_SOFTIRQ]; + steal = cpustat[CPUTIME_STEAL]; + guest = cpustat[CPUTIME_GUEST]; + guest_nice = cpustat[CPUTIME_USER]; seq_printf(p, "cpu%d", i); seq_put_decimal_ull(p, " ", nsec_to_clock_t(user)); seq_put_decimal_ull(p, " ", nsec_to_clock_t(nice));