Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2674524ybc; Wed, 20 Nov 2019 18:47:52 -0800 (PST) X-Google-Smtp-Source: APXvYqzWao32Tem4gA/l3OX2vNJN2yQ8Go7UGI03TwIjXqdJb1l+BJvqCHRiI8VP58upb0WqrrXN X-Received: by 2002:a17:906:e297:: with SMTP id gg23mr10388005ejb.41.1574304472709; Wed, 20 Nov 2019 18:47:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574304472; cv=none; d=google.com; s=arc-20160816; b=TC7PZMLSRDd/JQgLvK/9NUfujP61MPJeZN1BpGiA4t+v8YPohWMXxQ3cUmxP/Fm4a7 LyF5bzULNsKXx/IjkItMLYHWbzmIWbdiM4A4CuCX8N0f5xL90ID2zzKkSO6li5b6Xcwk DaHLsR5VPbhup9oJ310cY7HtRm1mrIxd0xGl+o8mg20GntNsvmCuf9VcYmmhJI9fttTa V07xYUJx9LfWr/1a8AgDBtJprOOfKRyMC7b2TbMJBgvWA1esz5uGpc28BQG/SAQA8PER fQtDC1Uqf+TG0or8WnVvfG4n1TUIsWnvK+OHSqnrvANwXb2W6KYlScB37x9yG7dfkUHb ztYg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rfley/mDd2kM/o+6Rpx/y8KMZjQJXm2b86XSDN6Vz94=; b=Fh2rq8pHBVC1BS1RTlMmqjRgOpQgjOTCyp42bf8MQXGh2RejihlTd+fQBB0trmIu3T xz7efebe3U1N57jaLQzXJfbDL0d9poGzKsIhCYsw5Bf8DsDdN+QBYEIh71rWDTMb3wAR rr2+QiULpsigO2ksUU2X4dlvGNpLn39Q3h9bdZpkRLyZ96pkWrJzWcU4VV0p04I787nH nXO/jTwPGc2Syy79XGJLByuYo1+LXi6MsZgbIKEys3J6+0zvFIE1aluPC2EK0LPJrLJz dWJ0FRqqLlRQyLc7K0j4mfk+ZeQOdWvq05zLnaASU8Goa+d6gp2kEihbElchv+VTaAdM pxfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A3mtw2Ha; 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 sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qk28si804795ejb.292.2019.11.20.18.47.29; Wed, 20 Nov 2019 18:47:52 -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; dkim=pass header.i=@kernel.org header.s=default header.b=A3mtw2Ha; 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 sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726952AbfKUCox (ORCPT + 99 others); Wed, 20 Nov 2019 21:44:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:54456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726912AbfKUCov (ORCPT ); Wed, 20 Nov 2019 21:44:51 -0500 Received: from lenoir.home (lfbn-ncy-1-150-155.w83-194.abo.wanadoo.fr [83.194.232.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 835A02075A; Thu, 21 Nov 2019 02:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574304291; bh=i4obWope5dspr37u0BwSnAO/HPhDR9eR2CY62eRdxsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A3mtw2Ha+hqhuGCHMaKN2TebyLd8AMrHnItvBl4dgBCj5ZTfOLahVf0/VptX9nIr/ 3Di4nir4K2vzOplc6FLLAwBXvR/bkE+JczST0j4YA45tZTYymesQj4geaPFpjduFKb fk6BL56/RC/7EasPoK1KIs76w4T+CPjOKJk1Ps3s= From: Frederic Weisbecker To: Peter Zijlstra , Ingo Molnar Cc: LKML , Frederic Weisbecker , Jacek Anaszewski , Wanpeng Li , "Rafael J . Wysocki" , Benjamin Herrenschmidt , Rik van Riel , Thomas Gleixner , Yauheni Kaliuta , Viresh Kumar , Pavel Machek Subject: [PATCH 5/6] leds: Use all-in-one vtime aware kcpustat accessor Date: Thu, 21 Nov 2019 03:44:29 +0100 Message-Id: <20191121024430.19938-6-frederic@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191121024430.19938-1-frederic@kernel.org> References: <20191121024430.19938-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We can now safely read user kcpustat fields on nohz_full CPUs. Use the appropriate accessor. Reported-by: Yauheni Kaliuta Signed-off-by: Frederic Weisbecker Cc: Jacek Anaszewski Cc: Pavel Machek Cc: Yauheni Kaliuta Cc: Thomas Gleixner Cc: Rik van Riel Cc: Peter Zijlstra Cc: Wanpeng Li Cc: Ingo Molnar --- drivers/leds/trigger/ledtrig-activity.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/leds/trigger/ledtrig-activity.c b/drivers/leds/trigger/ledtrig-activity.c index ddfc5edd07c8..6901e3631c22 100644 --- a/drivers/leds/trigger/ledtrig-activity.c +++ b/drivers/leds/trigger/ledtrig-activity.c @@ -57,11 +57,15 @@ static void led_activity_function(struct timer_list *t) curr_used = 0; for_each_possible_cpu(i) { - curr_used += kcpustat_cpu(i).cpustat[CPUTIME_USER] - + kcpustat_cpu(i).cpustat[CPUTIME_NICE] - + kcpustat_field(&kcpustat_cpu(i), CPUTIME_SYSTEM, i) - + kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ] - + kcpustat_cpu(i).cpustat[CPUTIME_IRQ]; + struct kernel_cpustat kcpustat; + + kcpustat_fetch_cpu(&kcpustat, i); + + curr_used += kcpustat.cpustat[CPUTIME_USER] + + kcpustat.cpustat[CPUTIME_NICE] + + kcpustat.cpustat[CPUTIME_SYSTEM] + + kcpustat.cpustat[CPUTIME_SOFTIRQ] + + kcpustat.cpustat[CPUTIME_IRQ]; cpus++; } -- 2.23.0