Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5912104rwp; Mon, 17 Jul 2023 11:24:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlFTwjqWeF3SbUWnTXDa0US/3KFe9NoscFL6jzxyVhIhd1it9uRGkyhcT4SR7NaIfZ2ib9OH X-Received: by 2002:a05:6402:42cc:b0:51f:e0f0:f2cd with SMTP id i12-20020a05640242cc00b0051fe0f0f2cdmr12252692edc.3.1689618255003; Mon, 17 Jul 2023 11:24:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689618254; cv=none; d=google.com; s=arc-20160816; b=SxuKU9SMU1xcGuAXmPfGndEAcJWkiYdfaA+gx1prckD1s3Bg/8B8+9AcTatO7bkujh Y9phM6Ks16IHFzLTf5I5kQ5nPTpT60cg+PA/sRz9IKRyWJbvW7u3HqHCVfEtgZ336xGQ CJDRwjTbPjCzxpMeApHBzYXulvYFSvzbPsQ8h0OTPKtUW6bj9tk/EtK0G4pytkXdZzZp 4ZTnpPLZLxa8EJH6I47Q6jxXCJsg6QN9CU6n+0BEn4c8C02hsyQ3yfcc34rYfAQTVOW4 X/cjfiXYF5V9+gkqHIhWrPeUCGy5p4zn68iPu7FoY3qMnuWLvpawwheG0HdfqN1AjytF acGg== 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=TPUnfwbymys2rmI4SMpdtxUFVh4/2XCpBFBCuAEaMh4=; fh=Ag0RbRk3LxdpQ9OdMLAf8hbnmFe6FOAHRGAvgVTwgEc=; b=U/0hhuWa9yURE4ywZLvYWdbbU3+IEq1bY/o8/s1eL4zIooNUv4ewVUcW13AOradR3f qZPMkuBG/my9u3ASQTCx8WCaGywuS6plgCr6HKT7yyJrec4ljJG2FmLkFQPC/NohQZ+L S4eedghX1DE7D/4jk1f1LGdm/tD+0aqoqSJ3GXJL1DjWJfU2dXgn6OxQehfVD4c0+bbj 8bvPhfO0wnGi/052rWzKhgEm+DE8oWkM4rO1hU8Z9FeHXF1E+ffHeJTrcXg7LKGAKOgl f8kLasXm1ZQ9dxebxnSuMlMwALM9dMqhnMxX7HjsOotW8AJpacCsGW8l0J830lcp9pvc 7IJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qYVZQXwY; 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 i4-20020aa7c704000000b0051e06613b93si15270988edq.164.2023.07.17.11.23.50; Mon, 17 Jul 2023 11:24:14 -0700 (PDT) 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=qYVZQXwY; 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 S231608AbjGQSMA (ORCPT + 99 others); Mon, 17 Jul 2023 14:12:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231142AbjGQSLo (ORCPT ); Mon, 17 Jul 2023 14:11:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12CA3E6F; Mon, 17 Jul 2023 11:11:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 28082611E8; Mon, 17 Jul 2023 18:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64B34C4339A; Mon, 17 Jul 2023 18:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689617500; bh=WXMDNs0NKjgJYxezPeNZXXRf2T8Uz/q0zB/XGeUalEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qYVZQXwY1x+p2SFAg3b1Yi2EeSpc9tdtf1QRvIbUgJj5SfFvEALvdNSaswcUGc7tq aMYc2cK2zzcoAjCTMJdEL6xwLnPOc89KURa0OlTbv1fJGXRaAlMRH2xOW1CyZ53O/9 JWtYVrqtq9ZuMrM/7W4RVig3+e3yNrbhi/g856QBdqcnE1hxWUA+yhTvEjJTcvmggM A35Oh0mJPKeW1u8NoVFW53qGVRN5Z3tg7X2aPtdu550UM9l7SuSQLoM0h5v03NguO6 R1+F3WXzINVmVibHJeWZZNamiy1oBKcdue10uaYVrBJ7LWEzcj8rpW3sB29cxbiaHv +re2b2aT20CVg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id C04EFCE097F; Mon, 17 Jul 2023 11:11:39 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH rcu 09/13] rcuscale: Measure RCU Tasks Trace grace-period kthread CPU time Date: Mon, 17 Jul 2023 11:11:34 -0700 Message-Id: <20230717181138.1098063-9-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: 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,T_SCC_BODY_TEXT_LINE 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 This commit causes RCU Tasks Trace to output the CPU time consumed by its grace-period kthread. The CPU time is whatever is in the designated task's current->stime field, and thus is controlled by whatever CPU-time accounting scheme is in effect. This output appears in microseconds as follows on the console: rcu_scale: Grace-period kthread CPU time: 42367.037 [ paulmck: Apply Willy Tarreau feedback. ] Signed-off-by: Paul E. McKenney --- kernel/rcu/rcu.h | 3 +++ kernel/rcu/rcuscale.c | 1 + kernel/rcu/tasks.h | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h index 98c1544cf572..d58bc0e86769 100644 --- a/kernel/rcu/rcu.h +++ b/kernel/rcu/rcu.h @@ -505,6 +505,9 @@ void rcu_async_relax(void); void rcupdate_announce_bootup_oddness(void); #ifdef CONFIG_TASKS_RCU_GENERIC void show_rcu_tasks_gp_kthreads(void); +# ifdef CONFIG_TASKS_RCU +struct task_struct *get_rcu_tasks_gp_kthread(void); +# endif // # ifdef CONFIG_TASKS_RCU #else /* #ifdef CONFIG_TASKS_RCU_GENERIC */ static inline void show_rcu_tasks_gp_kthreads(void) {} #endif /* #else #ifdef CONFIG_TASKS_RCU_GENERIC */ diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index 7fba3ab66e35..35e06c86acc9 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -298,6 +298,7 @@ static struct rcu_scale_ops tasks_ops = { .gp_barrier = rcu_barrier_tasks, .sync = synchronize_rcu_tasks, .exp_sync = synchronize_rcu_tasks, + .rso_gp_kthread = get_rcu_tasks_gp_kthread, .name = "tasks" }; diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 990a6cf5fa35..0f03de023097 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -1042,6 +1042,12 @@ void show_rcu_tasks_classic_gp_kthread(void) EXPORT_SYMBOL_GPL(show_rcu_tasks_classic_gp_kthread); #endif // !defined(CONFIG_TINY_RCU) +struct task_struct *get_rcu_tasks_gp_kthread(void) +{ + return rcu_tasks.kthread_ptr; +} +EXPORT_SYMBOL_GPL(get_rcu_tasks_gp_kthread); + /* * Contribute to protect against tasklist scan blind spot while the * task is exiting and may be removed from the tasklist. See -- 2.40.1