Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp169849rwl; Wed, 4 Jan 2023 17:10:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXssewUBdlhGC4L/MHbgQ/lb1rd5HPi1FQ49Cq86S2KKo4T87ki7Ebdik28Eaed0KxHtSHLc X-Received: by 2002:a17:902:850c:b0:192:bbe9:4cab with SMTP id bj12-20020a170902850c00b00192bbe94cabmr15457615plb.24.1672881059722; Wed, 04 Jan 2023 17:10:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672881059; cv=none; d=google.com; s=arc-20160816; b=M02WsCPFisYyL6nNX7CPoF1g4iAn6SkNRCAQYEFX8aoV2zBn7puaQvUDJkVr3WEQnI SO5AH5vmXnOGeBR0fQUQcXha3n42jEK1eI57ozp9qiMq862xCiCK1zFaGVLcyWspuSpw TXsUaxwpi/9fuSj4NS3FtKNlbPVPiGUALk3R+4o1hiYEQoKodvFPr+BdLikKkdsfTF1+ Fv7Ff2jkUTU6Iokx3VgYX+sLxCHFadcVhj/irITyKNH3WBF/zIAJHDJ58FEzJXAth5GW O9mJ0sDNg6IUEm+NFiOhva4jNggpIl65UTikI6h7k4QLjnUm0E6Pa3Aka+dljm2eFK3p QT/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DQDI700c7Miuy+9tAR0UGxDZimYbDFTQxTjABoPDgEA=; b=J7U+x4uk8RVcCy7JBGN4S/21MAfKyrt6+C6FK0Efr6C4hLjklvqCGPN4gYREWoyhT0 cIMcaWdKp39TzQM+/22EIJu79BaOBUBRVn4rGvBWvmlYJAYp7O/RJCdzi+NY4ACYot1f WQ/PL8zcPyMlfVQ25Za+SDo3atMc0sMP79JONsL354AojbSUGAg33192/3Sk4MRbq1w3 oVYBbd5MNdXl1jjwmQrgEfU23lBsLeRBdNM1WJ5ix6YdR0e61Fjlq4zh2k5ValREUFpK XMZ4jl7cA62gwmjBpvoPL0JmefdU5wSPjhIe48/mtUs01F7gsUVSO03t4N9X0s+TaBhS a/Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XzYY8NJb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w7-20020a170902904700b0017123d2abd5si34460967plz.457.2023.01.04.17.10.52; Wed, 04 Jan 2023 17:10:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XzYY8NJb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230073AbjAEAzw (ORCPT + 56 others); Wed, 4 Jan 2023 19:55:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbjAEAyo (ORCPT ); Wed, 4 Jan 2023 19:54:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6D054D730; Wed, 4 Jan 2023 16:51:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F2DCB81983; Thu, 5 Jan 2023 00:51:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B930C433F2; Thu, 5 Jan 2023 00:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672879887; bh=a9j2iXVLoC1TD3lQ/10Gw2Pvt/B4K6hHFOFLrRwW1Dc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XzYY8NJbzzoB8B0ZzIvvzNz+KpyoRzc2GqLb2niUTABfa/LQsT+r65gP22WcxsbGM z8gt+860oprHMixmLDBNlW+qYTVAW6ITC0ZMfGzAd5KAfxXjQQKTG2bIGpdBgWRn/+ UjTzjWOR/SntEOgajwvN+hmAaBXIVPZtW03pxWPgAwZJnq8hQ5+mFc89geOGyHYEHm yG9heL833MlrxE3ACZ8eKlGEufE34O2MQXGifrm4yFdNE7Ou1cYSnfVyaCslke8Bn0 SQqM7rO5DpVcFG2IzevyK2SVx2H2X1KuQPrH8yMkeU07PDcCs/0IcZr0gFsTWpfyQK hTaJXjLr9mkhQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 513905C086D; Wed, 4 Jan 2023 16:51:27 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Zhen Lei , Josh Don , Tejun Heo , Peter Zijlstra , Frederic Weisbecker , "Paul E . McKenney" Subject: [PATCH rcu 2/6] sched: Add helper kstat_cpu_softirqs_sum() Date: Wed, 4 Jan 2023 16:51:22 -0800 Message-Id: <20230105005126.1772294-2-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20230105005105.GA1772125@paulmck-ThinkPad-P17-Gen-1> References: <20230105005105.GA1772125@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhen Lei Add a kstat_cpu_softirqs_sum() function that is similar to kstat_cpu_irqs_sum(), but which counts software interrupts since boot on the specified CPU. Signed-off-by: Zhen Lei Cc: Josh Don Cc: Tejun Heo Cc: Peter Zijlstra Reviewed-by: Frederic Weisbecker Signed-off-by: Paul E. McKenney --- include/linux/kernel_stat.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 90e2fdc17d79f..898076e173a92 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h @@ -67,6 +67,17 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu) return kstat_cpu(cpu).softirqs[irq]; } +static inline unsigned int kstat_cpu_softirqs_sum(int cpu) +{ + int i; + unsigned int sum = 0; + + for (i = 0; i < NR_SOFTIRQS; i++) + sum += kstat_softirqs_cpu(i, cpu); + + return sum; +} + /* * Number of interrupts per specific IRQ source, since bootup */ -- 2.31.1.189.g2e36527f23