From patchwork Mon Jul 17 18:11:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316219 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D9F5C001DC for ; Mon, 17 Jul 2023 18:11:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230481AbjGQSLn (ORCPT ); Mon, 17 Jul 2023 14:11:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230397AbjGQSLm (ORCPT ); Mon, 17 Jul 2023 14:11:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01E94E4C; Mon, 17 Jul 2023 11:11:40 -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 8CA41611DD; Mon, 17 Jul 2023 18:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE024C433CB; Mon, 17 Jul 2023 18:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689617500; bh=5A8xH+p0dUJfvye10KzRYh4lPe5RZ2TL4tDrfKR9vx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YR9mNJCGa0lEX1MzLzlunbCdKEny04LHyl33ZVfu9iRO9pZCmmCmnU10FIauKD17c AtzN4soQXUTe95wjeMRaMPYEV/S60XPyr6B9s56DgbpIoKFWqhxs66n1ahizdjbdZh GaN8eP4mQZxC77NlCVHCWQA9X4e4i1cXjCV0Np+epPYBxwNkZDPBXy3Uys0JE9xbFy KNCebj0ugbDIo/ddKrtLLaaNqe0r3Al6QFlocxTg6okZRC/YyckNdI+PQAAhdV4Lir u1xNATbnZV5cIUtEj/6UrpvQ20KTb+xGEF1ZUej7pK0S1d/M+FnHTBaXSxj6ZkKVMz x+RUyCjNqOkrQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id AD68BCE03F1; 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 01/13] rcuscale: Permit blocking delays between writers Date: Mon, 17 Jul 2023 11:11:26 -0700 Message-Id: <20230717181138.1098063-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org Some workloads do isolated RCU work, and this can affect operation latencies. This commit therefore adds a writer_holdoff_jiffies module parameter that causes writers to block for the specified number of jiffies between each pair of consecutive write-side operations. Signed-off-by: Paul E. McKenney --- Documentation/admin-guide/kernel-parameters.txt | 5 +++++ kernel/rcu/rcuscale.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a1457995fd41..5ba231b786f8 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4983,6 +4983,11 @@ in microseconds. The default of zero says no holdoff. + rcuscale.writer_holdoff_jiffies= [KNL] + Additional write-side holdoff between grace + periods, but in jiffies. The default of zero + says no holdoff. + rcutorture.fqs_duration= [KNL] Set duration of force_quiescent_state bursts in microseconds. diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index d1221731c7cf..4277037e0996 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -93,6 +93,7 @@ torture_param(bool, shutdown, RCUSCALE_SHUTDOWN, "Shutdown at end of scalability tests."); torture_param(int, verbose, 1, "Enable verbose debugging printk()s"); torture_param(int, writer_holdoff, 0, "Holdoff (us) between GPs, zero to disable"); +torture_param(int, writer_holdoff_jiffies, 0, "Holdoff (jiffies) between GPs, zero to disable"); torture_param(int, kfree_rcu_test, 0, "Do we run a kfree_rcu() scale test?"); torture_param(int, kfree_mult, 1, "Multiple of kfree_obj size to allocate."); torture_param(int, kfree_by_call_rcu, 0, "Use call_rcu() to emulate kfree_rcu()?"); @@ -414,6 +415,7 @@ rcu_scale_writer(void *arg) struct rcu_head *rhp = NULL; bool started = false, done = false, alldone = false; u64 t; + DEFINE_TORTURE_RANDOM(tr); u64 *wdp; u64 *wdpp = writer_durations[me]; @@ -448,6 +450,8 @@ rcu_scale_writer(void *arg) do { if (writer_holdoff) udelay(writer_holdoff); + if (writer_holdoff_jiffies) + schedule_timeout_idle(torture_random(&tr) % writer_holdoff_jiffies + 1); wdp = &wdpp[i]; *wdp = ktime_get_mono_fast_ns(); if (gp_async) { From patchwork Mon Jul 17 18:11:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316218 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA3FDEB64DC for ; Mon, 17 Jul 2023 18:11:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230131AbjGQSLm (ORCPT ); Mon, 17 Jul 2023 14:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230396AbjGQSLl (ORCPT ); Mon, 17 Jul 2023 14:11:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB323AF; Mon, 17 Jul 2023 11:11:40 -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 89F32611D5; Mon, 17 Jul 2023 18:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDFFFC433CA; Mon, 17 Jul 2023 18:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689617500; bh=EQjNoHdHschIUdiIu2na4lA90ImcxAEv7wrp3pUJoEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=laK/2XTo0opyRe2Eqgtq6c6ArDkndisgPzymG7df7z04eSMTbHVKa58r1K4bFirPa +3KJreo9dK1gM0pABVlnDnANLbo9s9lgwXyB7wyNnS/WZpsxZhEZUBCGSzSoLGbT8A AsXQd0oSiek5kaVb+1mGnhsgXg179RMlNAB4w1si1/nEEke+nGDKCn2muEvIGsgxg4 HEQXYHaWXLze2V4JXzugWDyo/ZBqJDQKUFm+uguU0qiGJ6vCGuVd5osTupah0gvt9u IIBGIiBtj4mnyIuDzQ5RxoNzJC1QqCmjgO0lvYi8nPVBOHZywXky6BVJS8JA1RL1Ce RqOkrm/1TQBSg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id AFFEACE04CD; 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 02/13] rcuscale: Fix gp_async_max typo: s/reader/writer/ Date: Mon, 17 Jul 2023 11:11:27 -0700 Message-Id: <20230717181138.1098063-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org Signed-off-by: Paul E. McKenney --- kernel/rcu/rcuscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index 4277037e0996..15edd8c82933 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -84,7 +84,7 @@ MODULE_AUTHOR("Paul E. McKenney "); #endif torture_param(bool, gp_async, false, "Use asynchronous GP wait primitives"); -torture_param(int, gp_async_max, 1000, "Max # outstanding waits per reader"); +torture_param(int, gp_async_max, 1000, "Max # outstanding waits per writer"); torture_param(bool, gp_exp, false, "Use expedited GP wait primitives"); torture_param(int, holdoff, 10, "Holdoff time before test start (s)"); torture_param(int, nreaders, -1, "Number of RCU reader threads"); From patchwork Mon Jul 17 18:11:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316222 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70422EB64DC for ; Mon, 17 Jul 2023 18:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231223AbjGQSLp (ORCPT ); Mon, 17 Jul 2023 14:11:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230376AbjGQSLn (ORCPT ); Mon, 17 Jul 2023 14:11:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01C9EB3; Mon, 17 Jul 2023 11:11:40 -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 8A41D611DC; Mon, 17 Jul 2023 18:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDFD4C433C7; Mon, 17 Jul 2023 18:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689617500; bh=KSPQm/Cmvrwm7nB28Q1Uzn4KOU2brchdwzrXtjJDO4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YZLvkrEZah3j+6IePfc6+sLQYSZW0DYR7tEycP5uAqBy1oLpb7FEKAW9bJXhXhvWq qARRbJgs88kzEspRRG8bRPSH8E7M6KXec/rpF3qDYzvite7r3nbGueVWZ/ShuTaOS4 r/ZFQErgANur1O0+qeN7HbK5iNja9M7tXuXMnZkPKYJMyxzTWJk0JUAfvajnye9At8 BzwfefHuqVEoSNRuZwLXybUNxWyBGx2/q1SkhP03KGkVkg2dNnNHXyQtE3LZpNBDfS 7ONTk2MkJT3nz2dfFYOdvrHPdRrN6uHESR4bwXuInQVO8kWhap5SZOhmM+MzxRv/Kd sitT1fFW326Bg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B291FCE0806; 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 03/13] rcuscale: Add minruntime module parameter Date: Mon, 17 Jul 2023 11:11:28 -0700 Message-Id: <20230717181138.1098063-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org By default, rcuscale collects only 100 points of data per writer, but arranging for all kthreads to be actively collecting (if not recording) data during the time that any kthread might be recording. This works well, but does not allow much time to bring external performance tools to bear. This commit therefore adds a minruntime module parameter that specifies a minimum data-collection interval in seconds. Signed-off-by: Paul E. McKenney --- Documentation/admin-guide/kernel-parameters.txt | 6 ++++++ kernel/rcu/rcuscale.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 5ba231b786f8..a6888e3dfc20 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4953,6 +4953,12 @@ Number of loops doing rcuscale.kfree_alloc_num number of allocations and frees. + rcuscale.minruntime= [KNL] + Set the minimum test run time in seconds. This + does not affect the data-collection interval, + but instead allows better measurement of things + like CPU consumption. + rcuscale.nreaders= [KNL] Set number of RCU readers. The value -1 selects N, where N is the number of CPUs. A value diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index 15edd8c82933..7c5bab5a4f19 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -87,6 +87,7 @@ torture_param(bool, gp_async, false, "Use asynchronous GP wait primitives"); torture_param(int, gp_async_max, 1000, "Max # outstanding waits per writer"); torture_param(bool, gp_exp, false, "Use expedited GP wait primitives"); torture_param(int, holdoff, 10, "Holdoff time before test start (s)"); +torture_param(int, minruntime, 0, "Minimum run time (s)"); torture_param(int, nreaders, -1, "Number of RCU reader threads"); torture_param(int, nwriters, -1, "Number of RCU updater threads"); torture_param(bool, shutdown, RCUSCALE_SHUTDOWN, @@ -411,6 +412,7 @@ rcu_scale_writer(void *arg) { int i = 0; int i_max; + unsigned long jdone; long me = (long)arg; struct rcu_head *rhp = NULL; bool started = false, done = false, alldone = false; @@ -447,6 +449,7 @@ rcu_scale_writer(void *arg) } } + jdone = jiffies + minruntime * HZ; do { if (writer_holdoff) udelay(writer_holdoff); @@ -479,7 +482,7 @@ rcu_scale_writer(void *arg) if (!started && atomic_read(&n_rcu_scale_writer_started) >= nrealwriters) started = true; - if (!done && i >= MIN_MEAS) { + if (!done && i >= MIN_MEAS && time_after(jiffies, jdone)) { done = true; sched_set_normal(current, 0); pr_alert("%s%s rcu_scale_writer %ld has %d measurements\n", From patchwork Mon Jul 17 18:11:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316221 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34EB2C0015E for ; Mon, 17 Jul 2023 18:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231208AbjGQSLo (ORCPT ); Mon, 17 Jul 2023 14:11:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230413AbjGQSLm (ORCPT ); Mon, 17 Jul 2023 14:11:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A7FEE55; Mon, 17 Jul 2023 11:11:41 -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 A7EAF611E2; Mon, 17 Jul 2023 18:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14647C433C9; 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=+0fBEhqmyuNH4//E14nuyQmDTxK/vKbTt5dtpbaWLmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C7C0h94+4Ry+wzdtHCk9hU2/NzV7+li6S/BI8OTa+o6I5A3O8KFUPp/YyHj8mb09s F+dAhHtSU/d9DFJbBWkqdlN0Jy3p/4uX8kD5zfNnqm5PZ3ZylyqP9GwiCbUhdhZSz1 736DZOggXFfFwi+bpCSGfqtPMKH7pbJq5yZ4uIAjlKYm1fRaROSh+qve9ju2bds6YK 0AvuLuQ6NvgYXm7P/bmcFBrFUJQye4UeVla7EFm7qbjTPEC3XXyPv/b8MHHotMtZiE uLCa2aQ21aqJ+2G6CbIkBnkAujmuOpljmGTuhopWJnks91WYmnaoe2yfDu61e/oV05 r+/Zyy4XxuO3A== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B4CC9CE0836; 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 04/13] rcuscale: Print out full set of module parameters Date: Mon, 17 Jul 2023 11:11:29 -0700 Message-Id: <20230717181138.1098063-4-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org Signed-off-by: Paul E. McKenney --- kernel/rcu/rcuscale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index 7c5bab5a4f19..18f1b0e13604 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -525,8 +525,8 @@ static void rcu_scale_print_module_parms(struct rcu_scale_ops *cur_ops, const char *tag) { pr_alert("%s" SCALE_FLAG - "--- %s: nreaders=%d nwriters=%d verbose=%d shutdown=%d\n", - scale_type, tag, nrealreaders, nrealwriters, verbose, shutdown); + "--- %s: gp_async=%d gp_async_max=%d gp_exp=%d holdoff=%d minruntime=%d nreaders=%d nwriters=%d writer_holdoff=%d writer_holdoff_jiffies=%d verbose=%d shutdown=%d\n", + scale_type, tag, gp_async, gp_async_max, gp_exp, holdoff, minruntime, nrealreaders, nrealwriters, writer_holdoff, writer_holdoff_jiffies, verbose, shutdown); } /* From patchwork Mon Jul 17 18:11:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316220 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D510AC001DF for ; Mon, 17 Jul 2023 18:11:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230490AbjGQSLn (ORCPT ); Mon, 17 Jul 2023 14:11:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbjGQSLm (ORCPT ); Mon, 17 Jul 2023 14:11:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E6F4E56; Mon, 17 Jul 2023 11:11:41 -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 BCD52611E3; Mon, 17 Jul 2023 18:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2272AC433CC; 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=iPtCMMiG5ZGO7GsFZLh6YccNSibZpzaW5K9xmTwhpgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QcXWYrGpMinTfmdViiWkd9mQysD+Go9tXJgs3XfLV5bLrSHz6SPrJMmHApgqRQGmG 6w9y72m2Nakf5y8KoQvVnncQJiRngN+zxTi9Olyzgf5nR7Sab57qmSL9G+JDQlQm/g zJVtaqxU0gnSTO1Q/QAbmjMZ9nIXrUUKHpIYCyT9lPPU5cKob9xOKvOkBeCgoxui9W Ks7epyA4TCqo1hcYcZgTDyygwQJg6horlLjLpY5RQqUcIRoOTcOC2hqdz9nWD2zcxp cmIBl/yX6f1SMagxkPEvLIFl4fOUa4TL9aSiDCwOs49aF9FdS4Lw0z5BmJRCgysFYX 3txmTNdZJ3LMA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B7244CE0902; 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" , Uladzislau Rezki Subject: [PATCH rcu 05/13] rcuscale: Print out full set of kfree_rcu parameters Date: Mon, 17 Jul 2023 11:11:30 -0700 Message-Id: <20230717181138.1098063-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org Signed-off-by: Paul E. McKenney Cc: Uladzislau Rezki (Sony) --- kernel/rcu/rcuscale.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index 18f1b0e13604..821a3e65c54a 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -708,6 +708,10 @@ kfree_scale_init(void) unsigned long jif_start; unsigned long orig_jif; + pr_alert("%s" SCALE_FLAG + "--- kfree_rcu_test: kfree_mult=%d kfree_by_call_rcu=%d kfree_nthreads=%d kfree_alloc_num=%d kfree_loops=%d kfree_rcu_test_double=%d kfree_rcu_test_single=%d\n", + scale_type, kfree_mult, kfree_by_call_rcu, kfree_nthreads, kfree_alloc_num, kfree_loops, kfree_rcu_test_double, kfree_rcu_test_single); + // Also, do a quick self-test to ensure laziness is as much as // expected. if (kfree_by_call_rcu && !IS_ENABLED(CONFIG_RCU_LAZY)) { From patchwork Mon Jul 17 18:11:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316224 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36019C001E0 for ; Mon, 17 Jul 2023 18:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231283AbjGQSLq (ORCPT ); Mon, 17 Jul 2023 14:11:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230505AbjGQSLn (ORCPT ); Mon, 17 Jul 2023 14:11:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 382DD8E; 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 2341B611E4; Mon, 17 Jul 2023 18:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D6EAC433AD; 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=MIhkeztsVEuhvwr2MszSXvW/fHdP74ZIBpgGzjKJOiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ESE4wom7KKaNW9leiHXoMJj7L0T+MzWGD5OkIzc64KKMmdDl2S8BaLZ0gkas26IWv LUY2EYq2hYp6TFC3lzbhVniZmDfAJ1iMCH4lOzBLurSnrX4Sj8Uv09PlOOhdu4vU/m EKUV5Mo+YKDz3ScEWvDirSmjJbpeNWraepE0TxU947n73KC2CcuMETZDbQIJwzMjHZ gvX8s9oKlHGvRjBVC+ZnTJbJEzTxBSJBTP85411UzR/b2cyx2UilK2t6jISodbky8D cvBtpcvCEhyGThcxpko2XfW4/AzE0xds15W184m/HtfVwY49BFtGhXMv1Cy6DR2yQA 9ox0Xw/6FW4gQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B9A28CE092F; 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" , Yujie Liu Subject: [PATCH rcu 06/13] rcuscale: Measure grace-period kthread CPU time Date: Mon, 17 Jul 2023 11:11:31 -0700 Message-Id: <20230717181138.1098063-6-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org This commit adds the ability to output the CPU time consumed by the grace-period kthread for the RCU variant under test. 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 feedback from Stephen Rothwell and kernel test robot. ] Signed-off-by: Paul E. McKenney Tested-by: Yujie Liu --- include/linux/rcupdate_trace.h | 1 + kernel/rcu/rcuscale.c | 21 +++++++++++++++++++++ kernel/rcu/tasks.h | 6 ++++++ 3 files changed, 28 insertions(+) diff --git a/include/linux/rcupdate_trace.h b/include/linux/rcupdate_trace.h index 9bc8cbb33340..eda493200663 100644 --- a/include/linux/rcupdate_trace.h +++ b/include/linux/rcupdate_trace.h @@ -87,6 +87,7 @@ static inline void rcu_read_unlock_trace(void) void call_rcu_tasks_trace(struct rcu_head *rhp, rcu_callback_t func); void synchronize_rcu_tasks_trace(void); void rcu_barrier_tasks_trace(void); +struct task_struct *get_rcu_tasks_trace_gp_kthread(void); #else /* * The BPF JIT forms these addresses even when it doesn't call these diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index 821a3e65c54a..7fba3ab66e35 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -141,6 +141,7 @@ struct rcu_scale_ops { void (*gp_barrier)(void); void (*sync)(void); void (*exp_sync)(void); + struct task_struct *(*rso_gp_kthread)(void); const char *name; }; @@ -336,6 +337,7 @@ static struct rcu_scale_ops tasks_tracing_ops = { .gp_barrier = rcu_barrier_tasks_trace, .sync = synchronize_rcu_tasks_trace, .exp_sync = synchronize_rcu_tasks_trace, + .rso_gp_kthread = get_rcu_tasks_trace_gp_kthread, .name = "tasks-tracing" }; @@ -563,6 +565,8 @@ static struct task_struct **kfree_reader_tasks; static int kfree_nrealthreads; static atomic_t n_kfree_scale_thread_started; static atomic_t n_kfree_scale_thread_ended; +static struct task_struct *kthread_tp; +static u64 kthread_stime; struct kfree_obj { char kfree_obj[8]; @@ -808,6 +812,18 @@ rcu_scale_cleanup(void) if (gp_exp && gp_async) SCALEOUT_ERRSTRING("No expedited async GPs, so went with async!"); + // If built-in, just report all of the GP kthread's CPU time. + if (IS_BUILTIN(CONFIG_RCU_SCALE_TEST) && !kthread_tp && cur_ops->rso_gp_kthread) + kthread_tp = cur_ops->rso_gp_kthread(); + if (kthread_tp) { + u32 ns; + u64 us; + + kthread_stime = kthread_tp->stime - kthread_stime; + us = div_u64_rem(kthread_stime, 1000, &ns); + pr_info("rcu_scale: Grace-period kthread CPU time: %llu.%03u us\n", us, ns); + show_rcu_gp_kthreads(); + } if (kfree_rcu_test) { kfree_scale_cleanup(); return; @@ -921,6 +937,11 @@ rcu_scale_init(void) if (cur_ops->init) cur_ops->init(); + if (cur_ops->rso_gp_kthread) { + kthread_tp = cur_ops->rso_gp_kthread(); + if (kthread_tp) + kthread_stime = kthread_tp->stime; + } if (kfree_rcu_test) return kfree_scale_init(); diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index b770add3f843..990a6cf5fa35 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -1830,6 +1830,12 @@ void show_rcu_tasks_trace_gp_kthread(void) EXPORT_SYMBOL_GPL(show_rcu_tasks_trace_gp_kthread); #endif // !defined(CONFIG_TINY_RCU) +struct task_struct *get_rcu_tasks_trace_gp_kthread(void) +{ + return rcu_tasks_trace.kthread_ptr; +} +EXPORT_SYMBOL_GPL(get_rcu_tasks_trace_gp_kthread); + #else /* #ifdef CONFIG_TASKS_TRACE_RCU */ static void exit_tasks_rcu_finish_trace(struct task_struct *t) { } #endif /* #else #ifdef CONFIG_TASKS_TRACE_RCU */ From patchwork Mon Jul 17 18:11:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316230 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 047BDEB64DC for ; Mon, 17 Jul 2023 18:11:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231330AbjGQSLv (ORCPT ); Mon, 17 Jul 2023 14:11:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231222AbjGQSLp (ORCPT ); Mon, 17 Jul 2023 14:11:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12D6BE76; 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 23FC9611E6; Mon, 17 Jul 2023 18:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D2B4C433AB; 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=y5uffG7fOu/TEaIPCaJCZFkXOa/V0l/2zCRZKeCBBW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s93362XbjDt0y86fgUncbBlGLqFyFbcWFytxSLBYFw9hy/yHVawRoA8uzCunf1q7p tPQpGyi6+YDM6LyDY1yWFgFuJ+2+qnofFEf527wein1w8ID9jpTThjGgbefxNWpvoL fll5l+LThX6QsgLZ0ukxBFprE+TOY5A02qSICXnv/IZETgQ3fAWsM+wOdm3sQ8RJ2q rvYAlyl0CHvMKS+kCqAgHFYLct605CTufn5vWXjEhD0raRtxLDGsrlm4QcAFS11+mT giSO8h/6SgLONX2OvjbLJbGIk/WiVvqxjgGrUoyjbhy0rx+btBBvQT0WKWU+2o2rlI GMi2In6+R0pKw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id BBBC9CE0930; 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" , Uladzislau Rezki Subject: [PATCH rcu 07/13] rcuscale: Add kfree_by_call_rcu and kfree_mult to documentation Date: Mon, 17 Jul 2023 11:11:32 -0700 Message-Id: <20230717181138.1098063-7-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org This commit adds the kfree_by_call_rcu and kfree_mult rcuscale module parameters to kernel-parameters.txt. While in the area, it updates to rcuscale.scale_type. Signed-off-by: Paul E. McKenney Cc: Uladzislau Rezki (Sony) --- Documentation/admin-guide/kernel-parameters.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a6888e3dfc20..3329dc22f53b 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4928,6 +4928,15 @@ test until boot completes in order to avoid interference. + rcuscale.kfree_by_call_rcu= [KNL] + In kernels built with CONFIG_RCU_LAZY=y, test + call_rcu() instead of kfree_rcu(). + + rcuscale.kfree_mult= [KNL] + Instead of allocating an object of size kfree_obj, + allocate one of kfree_mult * sizeof(kfree_obj). + Defaults to 1. + rcuscale.kfree_rcu_test= [KNL] Set to measure performance of kfree_rcu() flooding. @@ -4973,7 +4982,7 @@ the same as for rcuscale.nreaders. N, where N is the number of CPUs - rcuscale.perf_type= [KNL] + rcuscale.scale_type= [KNL] Specify the RCU implementation to test. rcuscale.shutdown= [KNL] From patchwork Mon Jul 17 18:11:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316223 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDBCDC001DC for ; Mon, 17 Jul 2023 18:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231261AbjGQSLp (ORCPT ); Mon, 17 Jul 2023 14:11:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230509AbjGQSLn (ORCPT ); Mon, 17 Jul 2023 14:11:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4097799; 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 207DE611E1; Mon, 17 Jul 2023 18:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CB43C433A9; 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=N9K+fD3EFCsSjTZTUsdzLJiPJxPM1QAGdJD0a23WnpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o7DsUuPadJm0BDm8NK9h1ln05KhLCAhlYqBXu/hQty300WAYdzBGEx2rG1p+0r29v xer+JPV5IGFeVJkJaoBr6vK8LjOXn99WhzbPIcfW5H4mCcR+fGY8fido2K2CYfu1gV m/+cHby9EP0HYX+W6S2tpbiC0lctt+ab19BKn/pT/THkFNBv0xW/5zJLeiLHfzJW5e H0rrNY1Epood0uZ/HUb44+YjzD5K8R85BOrQjOR5GczIK00mSArjD9EQO/alCarggU S4q8ekVvGcbYJc4F0xhlQgpBB3nb/qCw57puNgj+vdY9sZMQkh0gd+ELGzpOnDYFq6 l7OMtMu1lPAcQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id BE377CE093C; 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 08/13] rcuscale: Print grace-period kthread CPU time, if recorded Date: Mon, 17 Jul 2023 11:11:33 -0700 Message-Id: <20230717181138.1098063-8-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org This commit prints out the CPU time consumed by the grace-period kthread, if the specified RCU flavor supports this notion. Signed-off-by: Paul E. McKenney --- .../selftests/rcutorture/bin/kvm-recheck-rcuscale.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuscale.sh b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuscale.sh index b582113178ac..f683e424ddd5 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuscale.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuscale.sh @@ -40,6 +40,10 @@ awk ' sum += $5 / 1000.; } +/rcu_scale: Grace-period kthread CPU time/ { + cputime = $6; +} + END { newNR = asort(gptimes); if (newNR <= 0) { @@ -78,6 +82,8 @@ END { print "90th percentile grace-period duration: " gptimes[pct90]; print "99th percentile grace-period duration: " gptimes[pct99]; print "Maximum grace-period duration: " gptimes[newNR]; - print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches; + if (cputime != "") + cpustr = " CPU: " cputime; + print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches cpustr; print "Computed from rcuscale printk output."; }' From patchwork Mon Jul 17 18:11:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316225 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CC84C001DE for ; Mon, 17 Jul 2023 18:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231308AbjGQSLr (ORCPT ); Mon, 17 Jul 2023 14:11:47 -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 Precedence: bulk List-ID: X-Mailing-List: rcu@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 From patchwork Mon Jul 17 18:11:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316227 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FF89C001DC for ; Mon, 17 Jul 2023 18:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231321AbjGQSLs (ORCPT ); Mon, 17 Jul 2023 14:11:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231151AbjGQSLo (ORCPT ); Mon, 17 Jul 2023 14:11:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12BCBE6C; 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 324CF611F3; Mon, 17 Jul 2023 18:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FB60C433B8; 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=69vKKKzfGC7L050YBgFnUQUwQJCbn9lPzoOVI5TYOis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVBenQcQwciEEi4nOUmcwSTWJCl+76G9JTcvk7eW50gDhvG+pCZHN6i1q+i4LhGMd DoXwb5iZWAhKlTH0zF72oKkA/fHlGp88yJ7Xw0ti9qWjgKZkpByDPfuSLneOFG5kln Ovo7U0Ak1LOzLmGd8PNnjrH2dFU3QwDRSBVdrgFEv7Flm3yWutenNvOBGiXMj7UVb9 eP0dgm9HyptgyRwZW4bqN34OtyuCjpQQtQPnd4Utfn1LuKVQHNpbN1hkBt77hIFfAV h1iPYEGGDrRze58f9ra76iLfYYaM+vpT1g96yClf8B9JakXLG1ojz7frQ64bZW3tIC xf/zXFS/m88OQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id C28D6CE09E0; 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 10/13] rcuscale: Add RCU Tasks Rude testing Date: Mon, 17 Jul 2023 11:11:35 -0700 Message-Id: <20230717181138.1098063-10-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org Add a "tasks-rude" option to the rcuscale.scale_type module parameter. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcu.h | 3 ++ kernel/rcu/rcuscale.c | 31 ++++++++++++++++++- kernel/rcu/tasks.h | 7 +++++ .../rcutorture/configs/rcuscale/CFcommon | 2 ++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h index d58bc0e86769..9829d8161b21 100644 --- a/kernel/rcu/rcu.h +++ b/kernel/rcu/rcu.h @@ -508,6 +508,9 @@ 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 +# ifdef CONFIG_TASKS_RUDE_RCU +struct task_struct *get_rcu_tasks_rude_gp_kthread(void); +# endif // # ifdef CONFIG_TASKS_RUDE_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 35e06c86acc9..5ce3b4e7ce71 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -310,6 +310,35 @@ static struct rcu_scale_ops tasks_ops = { #endif // #else // #ifdef CONFIG_TASKS_RCU +#ifdef CONFIG_TASKS_RUDE_RCU + +/* + * Definitions for RCU-tasks-rude scalability testing. + */ + +static struct rcu_scale_ops tasks_rude_ops = { + .ptype = RCU_TASKS_RUDE_FLAVOR, + .init = rcu_sync_scale_init, + .readlock = tasks_scale_read_lock, + .readunlock = tasks_scale_read_unlock, + .get_gp_seq = rcu_no_completed, + .gp_diff = rcu_seq_diff, + .async = call_rcu_tasks_rude, + .gp_barrier = rcu_barrier_tasks_rude, + .sync = synchronize_rcu_tasks_rude, + .exp_sync = synchronize_rcu_tasks_rude, + .rso_gp_kthread = get_rcu_tasks_rude_gp_kthread, + .name = "tasks-rude" +}; + +#define TASKS_RUDE_OPS &tasks_rude_ops, + +#else // #ifdef CONFIG_TASKS_RUDE_RCU + +#define TASKS_RUDE_OPS + +#endif // #else // #ifdef CONFIG_TASKS_RUDE_RCU + #ifdef CONFIG_TASKS_TRACE_RCU /* @@ -913,7 +942,7 @@ rcu_scale_init(void) long i; int firsterr = 0; static struct rcu_scale_ops *scale_ops[] = { - &rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS TASKS_TRACING_OPS + &rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS }; if (!torture_init_begin(scale_type, verbose)) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 0f03de023097..0372c5cbc83b 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -1194,6 +1194,13 @@ void show_rcu_tasks_rude_gp_kthread(void) } EXPORT_SYMBOL_GPL(show_rcu_tasks_rude_gp_kthread); #endif // !defined(CONFIG_TINY_RCU) + +struct task_struct *get_rcu_tasks_rude_gp_kthread(void) +{ + return rcu_tasks_rude.kthread_ptr; +} +EXPORT_SYMBOL_GPL(get_rcu_tasks_rude_gp_kthread); + #endif /* #ifdef CONFIG_TASKS_RUDE_RCU */ //////////////////////////////////////////////////////////////////////// diff --git a/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon b/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon index 6a00157bee5b..b1ffd7c67604 100644 --- a/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon +++ b/tools/testing/selftests/rcutorture/configs/rcuscale/CFcommon @@ -2,5 +2,7 @@ CONFIG_RCU_SCALE_TEST=y CONFIG_PRINTK_TIME=y CONFIG_FORCE_TASKS_RCU=y #CHECK#CONFIG_TASKS_RCU=y +CONFIG_FORCE_TASKS_RUDE_RCU=y +#CHECK#CONFIG_TASKS_RUDE_RCU=y CONFIG_FORCE_TASKS_TRACE_RCU=y #CHECK#CONFIG_TASKS_TRACE_RCU=y From patchwork Mon Jul 17 18:11:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316228 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12494C001DF for ; Mon, 17 Jul 2023 18:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231377AbjGQSLu (ORCPT ); Mon, 17 Jul 2023 14:11:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231256AbjGQSLp (ORCPT ); Mon, 17 Jul 2023 14:11:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12B0FE4C; 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 2A011611EB; Mon, 17 Jul 2023 18:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FBBCC433BB; 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=Rgw6r2G/Sghz8SLefTEvi26Ln8tLe1JsOls+5spnAU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=swl4+cF8ZOBu9qBeR2UIsxtcu9ToDchVqaq4KI2M3TUdgla1CqDPiMfk7RfjCCML6 GaDFGFALZyXNFZ5zIv/bdk8G12L5lL5t/3ndgCj8bAyNKm8pDUQSaDPNJvRgU27ewm WMTKNnX/VLnP08S4tuCq2lD/UIMdevFLmgTydCtEnO+b1moMnww/cAcZZ40armK4sQ 9cBnr/bibEWwY/3tsV7hI1SZtSpZJl4WJ8Rmus9HxKFE/iUDCWZnUnI0fSyjGZaqMT e/hFsOeAabwkiEg2608kPND41rKpI8mo7jlVZeOcdq2ytKguXt0003hARG/0SPxDUQ 9DbUOpBPWTC+w== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id C4A7ECE0A0F; 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, Arnd Bergmann , "Paul E . McKenney" Subject: [PATCH rcu 11/13] rcuscale: fix building with RCU_TINY Date: Mon, 17 Jul 2023 11:11:36 -0700 Message-Id: <20230717181138.1098063-11-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org From: Arnd Bergmann Both the CONFIG_TASKS_RCU and CONFIG_TASKS_RUDE_RCU options are broken when RCU_TINY is enabled as well, as some functions are missing a declaration. In file included from kernel/rcu/update.c:649: kernel/rcu/tasks.h:1271:21: error: no previous prototype for 'get_rcu_tasks_rude_gp_kthread' [-Werror=missing-prototypes] 1271 | struct task_struct *get_rcu_tasks_rude_gp_kthread(void) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/rcu/rcuscale.c:330:27: error: 'get_rcu_tasks_rude_gp_kthread' undeclared here (not in a function); did you mean 'get_rcu_tasks_trace_gp_kthread'? 330 | .rso_gp_kthread = get_rcu_tasks_rude_gp_kthread, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | get_rcu_tasks_trace_gp_kthread In file included from /home/arnd/arm-soc/kernel/rcu/update.c:649: kernel/rcu/tasks.h:1113:21: error: no previous prototype for 'get_rcu_tasks_gp_kthread' [-Werror=missing-prototypes] 1113 | struct task_struct *get_rcu_tasks_gp_kthread(void) | ^~~~~~~~~~~~~~~~~~~~~~~~ Also, building with CONFIG_TASKS_RUDE_RCU but not CONFIG_TASKS_RCU is broken because of some missing stub functions: kernel/rcu/rcuscale.c:322:27: error: 'tasks_scale_read_lock' undeclared here (not in a function); did you mean 'srcu_scale_read_lock'? 322 | .readlock = tasks_scale_read_lock, | ^~~~~~~~~~~~~~~~~~~~~ | srcu_scale_read_lock kernel/rcu/rcuscale.c:323:27: error: 'tasks_scale_read_unlock' undeclared here (not in a function); did you mean 'srcu_scale_read_unlock'? 323 | .readunlock = tasks_scale_read_unlock, | ^~~~~~~~~~~~~~~~~~~~~~~ | srcu_scale_read_unlock Move the declarations outside of the RCU_TINY #ifdef and duplicate the shared stub functions to address all of the above. Fixes: 88d7ff818f0ce ("rcuscale: Add RCU Tasks Rude testing") Fixes: 755f1c5eb416b ("rcuscale: Measure RCU Tasks Trace grace-period kthread CPU time") Signed-off-by: Arnd Bergmann Signed-off-by: Paul E. McKenney --- kernel/rcu/rcu.h | 14 ++++++++------ kernel/rcu/rcuscale.c | 13 +++++++++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h index 9829d8161b21..5befd8780dcd 100644 --- a/kernel/rcu/rcu.h +++ b/kernel/rcu/rcu.h @@ -505,18 +505,20 @@ 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 -# ifdef CONFIG_TASKS_RUDE_RCU -struct task_struct *get_rcu_tasks_rude_gp_kthread(void); -# endif // # ifdef CONFIG_TASKS_RUDE_RCU #else /* #ifdef CONFIG_TASKS_RCU_GENERIC */ static inline void show_rcu_tasks_gp_kthreads(void) {} #endif /* #else #ifdef CONFIG_TASKS_RCU_GENERIC */ void rcu_request_urgent_qs_task(struct task_struct *t); #endif /* #else #ifdef CONFIG_TINY_RCU */ +#ifdef CONFIG_TASKS_RCU +struct task_struct *get_rcu_tasks_gp_kthread(void); +#endif // # ifdef CONFIG_TASKS_RCU + +#ifdef CONFIG_TASKS_RUDE_RCU +struct task_struct *get_rcu_tasks_rude_gp_kthread(void); +#endif // # ifdef CONFIG_TASKS_RUDE_RCU + #define RCU_SCHEDULER_INACTIVE 0 #define RCU_SCHEDULER_INIT 1 #define RCU_SCHEDULER_RUNNING 2 diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index 5ce3b4e7ce71..a0eae1900708 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -316,11 +316,20 @@ static struct rcu_scale_ops tasks_ops = { * Definitions for RCU-tasks-rude scalability testing. */ +static int tasks_rude_scale_read_lock(void) +{ + return 0; +} + +static void tasks_rude_scale_read_unlock(int idx) +{ +} + static struct rcu_scale_ops tasks_rude_ops = { .ptype = RCU_TASKS_RUDE_FLAVOR, .init = rcu_sync_scale_init, - .readlock = tasks_scale_read_lock, - .readunlock = tasks_scale_read_unlock, + .readlock = tasks_rude_scale_read_lock, + .readunlock = tasks_rude_scale_read_unlock, .get_gp_seq = rcu_no_completed, .gp_diff = rcu_seq_diff, .async = call_rcu_tasks_rude, From patchwork Mon Jul 17 18:11:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316229 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43C71C001E0 for ; Mon, 17 Jul 2023 18:11:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231348AbjGQSLu (ORCPT ); Mon, 17 Jul 2023 14:11:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231250AbjGQSLp (ORCPT ); Mon, 17 Jul 2023 14:11:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12A1EAF; 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 45E28611F4; Mon, 17 Jul 2023 18:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 786EDC433BC; 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=vix7h77GWNfJdMQzOHlK9PUbzIuAVD8zltRARIbDHYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FUHfGjun/+k6Z0PmRI8KVShnl9DhjSU7tH1B+TDkDpLdUve8i5qTejS/0nPDc1N78 cOTpC01MxYPlQkN3xlmysiTVlOc25XtpnkYVE29bgEQJ9xmUuE0vrh3l0AHsWc4qO7 MaVNyc/cGX44aqIyORtRoDsXEhFEk8/KOCZZMubTWu3lc4xKDo3kqbVcaMzCXz+hqH EjPgjruyq1Na8UN6joQy+8ZgDe2oa7NG3sRp7asYoInUoF9Em9Fh+ko1v1Ar7Y243k FiYE3KYwDOZ0QEk9kIKvn1ovcKiHLtEtbKofd/ED7EMdvCESnchVzVmpiXBXZ/D0Jj +Ggr0QWUDHlsQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id C6D12CE0A10; 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, Zqiang , "Paul E . McKenney" Subject: [PATCH rcu 12/13] rcuscale: Move rcu_scale_writer() schedule_timeout_uninterruptible() to _idle() Date: Mon, 17 Jul 2023 11:11:37 -0700 Message-Id: <20230717181138.1098063-12-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org From: Zqiang The rcuscale.holdoff module parameter can be used to delay the start of rcu_scale_writer() kthread. However, the hung-task timeout will trigger when the timeout specified by rcuscale.holdoff is greater than hung_task_timeout_secs: runqemu kvm nographic slirp qemuparams="-smp 4 -m 2048M" bootparams="rcuscale.shutdown=0 rcuscale.holdoff=300" [ 247.071753] INFO: task rcu_scale_write:59 blocked for more than 122 seconds. [ 247.072529] Not tainted 6.4.0-rc1-00134-gb9ed6de8d4ff #7 [ 247.073400] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 247.074331] task:rcu_scale_write state:D stack:30144 pid:59 ppid:2 flags:0x00004000 [ 247.075346] Call Trace: [ 247.075660] [ 247.075965] __schedule+0x635/0x1280 [ 247.076448] ? __pfx___schedule+0x10/0x10 [ 247.076967] ? schedule_timeout+0x2dc/0x4d0 [ 247.077471] ? __pfx_lock_release+0x10/0x10 [ 247.078018] ? enqueue_timer+0xe2/0x220 [ 247.078522] schedule+0x84/0x120 [ 247.078957] schedule_timeout+0x2e1/0x4d0 [ 247.079447] ? __pfx_schedule_timeout+0x10/0x10 [ 247.080032] ? __pfx_rcu_scale_writer+0x10/0x10 [ 247.080591] ? __pfx_process_timeout+0x10/0x10 [ 247.081163] ? __pfx_sched_set_fifo_low+0x10/0x10 [ 247.081760] ? __pfx_rcu_scale_writer+0x10/0x10 [ 247.082287] rcu_scale_writer+0x6b1/0x7f0 [ 247.082773] ? mark_held_locks+0x29/0xa0 [ 247.083252] ? __pfx_rcu_scale_writer+0x10/0x10 [ 247.083865] ? __pfx_rcu_scale_writer+0x10/0x10 [ 247.084412] kthread+0x179/0x1c0 [ 247.084759] ? __pfx_kthread+0x10/0x10 [ 247.085098] ret_from_fork+0x2c/0x50 [ 247.085433] This commit therefore replaces schedule_timeout_uninterruptible() with schedule_timeout_idle(). Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney --- kernel/rcu/rcuscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index a0eae1900708..ffdb30495e3c 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -469,7 +469,7 @@ rcu_scale_writer(void *arg) sched_set_fifo_low(current); if (holdoff) - schedule_timeout_uninterruptible(holdoff * HZ); + schedule_timeout_idle(holdoff * HZ); /* * Wait until rcu_end_inkernel_boot() is called for normal GP tests From patchwork Mon Jul 17 18:11:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316226 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70B3AEB64DC for ; Mon, 17 Jul 2023 18:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231374AbjGQSLt (ORCPT ); Mon, 17 Jul 2023 14:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231217AbjGQSLo (ORCPT ); Mon, 17 Jul 2023 14:11:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12E5FE7F; 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 46473611F5; Mon, 17 Jul 2023 18:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 829E6C433BF; 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=1idW3qeMxeR/pQhpNzqDLOrZBK/BHCj+UCLTJY852f4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MoJLg8xuXNwGHpVNV1qzauZ71fIsFOh0jKQChIYHxZSM1WVf6Xk8tngWps4HXo9wl z5P51FfAZ+uBQMShS7/hMnooBscEB0s/vAlBvQ26yWhTPlr0Ax49opu+8WNcDLuEA0 nQFO8T8J8clIdadcRqCfdsAyJ+DPsh/DN+l6W9PfcBCgVa9CDBmPs05xD9orHk2OfZ i8eTwk7kJrePNe0BIQhYysCWFV+2y+kUSeD9QC8P1zPXWAHu1EaxPx2CS6cNX/LDJ8 pLFxADrYHZZTd3JNYVuHxl/iR0yQkpjVUxCk2waPrmBu/a6x5VUL0t4zDSOZRK593J G4/+x6FwPSj/g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id C8EC7CE0A11; 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 13/13] rcuscale: Add CONFIG_PREEMPT_DYNAMIC=n to TRACE01 scenario Date: Mon, 17 Jul 2023 11:11:38 -0700 Message-Id: <20230717181138.1098063-13-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org It is no longer possible to build a kernel with a preemption-disabled RCU without use of CONFIG_PREEMPT_DYNAMIC=n. This commit therefore adds CONFIG_PREEMPT_DYNAMIC=n to the rcuscale torture type's TRACE01 scenario file. Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/configs/rcuscale/TRACE01 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/rcutorture/configs/rcuscale/TRACE01 b/tools/testing/selftests/rcutorture/configs/rcuscale/TRACE01 index 227aba7783af..0059592c7408 100644 --- a/tools/testing/selftests/rcutorture/configs/rcuscale/TRACE01 +++ b/tools/testing/selftests/rcutorture/configs/rcuscale/TRACE01 @@ -2,6 +2,8 @@ CONFIG_SMP=y CONFIG_PREEMPT_NONE=y CONFIG_PREEMPT_VOLUNTARY=n CONFIG_PREEMPT=n +CONFIG_PREEMPT_DYNAMIC=n +#CHECK#CONFIG_TREE_RCU=y CONFIG_HZ_PERIODIC=n CONFIG_NO_HZ_IDLE=y CONFIG_NO_HZ_FULL=n