Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1241846rwl; Thu, 5 Jan 2023 10:34:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXu7h7nGPJUAul/s9zSSL7QVekn/fYTgGDotmSpWNl2KscG6QP3UObmfwjb6/B0fLI545n6X X-Received: by 2002:a17:906:6a0a:b0:7c9:6e0e:1427 with SMTP id qw10-20020a1709066a0a00b007c96e0e1427mr51012644ejc.6.1672943691407; Thu, 05 Jan 2023 10:34:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672943691; cv=none; d=google.com; s=arc-20160816; b=hW2zqMgtHbWhJjhDkIodDtQSdODh8aZiU32QB6BHTLXP+/PR1gCacm5ofyoDU4i7RB kYJQeqzE/jnVaqRk6ABu/2hhpTIUgYCOdpuZrcQSc9b+/sUQ6gqz/mIfphJqJNjTX121 CCAcQ3y5o7tcM9Xqmv5NEOrHjLWk0tvXcZP9K/SyJohOVrAIbtpoRqdFz9qD8abMFa4j 2Q1vTTafeXMTr81bJmwCqFo25VdLU9yQvS+/gY5XTWpa83lFyijLQnopYwT69zzQp38X 5wVO3mKgLTXc70EHvceme3adP5/vev/4hktUIS/D2P5wE30zt3LU+SX8eiCX4qLSkIln 4sxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=+Au1osN2untPPPCLASb7at9fcgV5fSmAcVw388b1TKA=; b=yDcV0H/ZUwuARBcfHwTM5b6yUITbwMqzhk4lUW6yh8116CmO4tTOTwO8gUwPfEKWZe ayxNiVPNc/mbZnit7w/0wLOBiyqtCFV4K3xJPv8rYh4cliUOJtd+/aXLBO8HwzbZJJX2 9f7WvPxWX+fN+mvh/fajDXClvVb2KPKPY+wb38Fo1XH49MhfkVvRrpyjwlNlN6yor+tJ Gndh65hPI8CqQM/4IEFNGplKrR3JeqPPp3IsWh1qBgasNJQwJR7cbrutLRENsXfFf0Fg Ow2P5ZTEJirae5UmMGQllvJzzvjEXVuu1Cus4rH+CUWsZ3NU/xVmfWf9HNGPqXg7tzTt sxTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ACc1Jt2d; 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 l6-20020a170906794600b0084cb98e14e2si14958374ejo.621.2023.01.05.10.34.38; Thu, 05 Jan 2023 10:34:51 -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=ACc1Jt2d; 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 S234545AbjAES1X (ORCPT + 55 others); Thu, 5 Jan 2023 13:27:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234420AbjAES1V (ORCPT ); Thu, 5 Jan 2023 13:27:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A3C2564D0 for ; Thu, 5 Jan 2023 10:27:20 -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 dfw.source.kernel.org (Postfix) with ESMTPS id F379461BB9 for ; Thu, 5 Jan 2023 18:27:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53174C433D2; Thu, 5 Jan 2023 18:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672943239; bh=X8zK08hDplMZOU9jNyg+F3MZ/14qYeZGvlD1yFz4DyQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=ACc1Jt2dlYN3tAmOCPwR7zcsL5VWc1OECpbI+cdHkc9ERiRUdbGhoczy0WX3uLu7n BYazAd6MrTPDrcOwHf+QvRGOqO8nnnp4FerjYlEfaYqB4YZBzSxSdqti4ozdUHjw/M xX5et0ATPUyA8N8R9RnTK6FjK//nm0oP/EX4vF/Me0WfKV7g0+50DOjVOpz/UxfxUH yOrH6pSfP+JwZb80dDrtqsueLxJ6KOAkg56ANftyENK4dVeo7tPu83dFdA84PocTKN 0EbD9EHxCe0dyitzZSXFeszoxi6AdYDh5hGECBpY0FJXYFAvmWmliN4o6XfaA10lMx 9oEFr99d2AQpQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E7A115C0544; Thu, 5 Jan 2023 10:27:18 -0800 (PST) Date: Thu, 5 Jan 2023 10:27:18 -0800 From: "Paul E. McKenney" To: Chen Yu Cc: "Joel Fernandes (Google)" , linux-kernel@vger.kernel.org, Ben Segall , Daniel Bristot de Oliveira , Davidlohr Bueso , Dietmar Eggemann , Ingo Molnar , Josh Triplett , Juri Lelli , Mel Gorman , Peter Zijlstra , Steven Rostedt , Valentin Schneider , Vincent Guittot , kernel-team@android.com, John Stultz , Joel Fernandes , Qais Yousef , Will Deacon , Waiman Long , Boqun Feng , Connor O'Brien Subject: Re: [PATCH RFC 3/3] locktorture: Make the rt_boost factor a tunable Message-ID: <20230105182718.GG4028633@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20221123012104.3317665-1-joel@joelfernandes.org> <20221123012104.3317665-4-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Wed, Dec 21, 2022 at 12:28:39PM +0800, Chen Yu wrote: > On 2022-11-23 at 01:21:04 +0000, Joel Fernandes (Google) wrote: > > The rt boosting in locktorture has a factor variable large enough that > > boosting only happens once every minute or so. Add a tunable to educe > > the factor so that boosting happens more often, to test paths and arrive > > at failure modes earlier. With this change, I can set the factor to > > like 50 and have the boosting happens every 10 seconds or so. > > > > Tested with boot parameters: > > locktorture.torture_type=mutex_lock > > locktorture.onoff_interval=1 > > locktorture.nwriters_stress=8 > > locktorture.stutter=0 > > locktorture.rt_boost=1 > > locktorture.rt_boost_factor=50 > > locktorture.nlocks=3 > > > > Signed-off-by: Joel Fernandes (Google) > > --- > > kernel/locking/locktorture.c | 12 +++++++----- > > 1 file changed, 7 insertions(+), 5 deletions(-) > > > > diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c > > index 5a388ac96a9b..e4529c2166e9 100644 > > --- a/kernel/locking/locktorture.c > > +++ b/kernel/locking/locktorture.c > > @@ -47,6 +47,7 @@ torture_param(int, stat_interval, 60, > > "Number of seconds between stats printk()s"); > > torture_param(int, stutter, 5, "Number of jiffies to run/halt test, 0=disable"); > > torture_param(int, rt_boost, 0, "Perform an rt-boost from the writer, always 1 for rtmutex_lock"); > > +torture_param(int, rt_boost_factor, 50000, "A factor determining how often rt-boost happens"); > > torture_param(int, verbose, 1, > > "Enable verbose debugging printk()s"); > > torture_param(int, nlocks, 1, > > @@ -132,15 +133,15 @@ static void torture_lock_busted_write_unlock(int tid __maybe_unused) > > > > static void torture_rt_boost(struct torture_random_state *trsp) > > { > > - const unsigned int factor = 50000; /* yes, quite arbitrary */ > > + const unsigned int factor = rt_boost_factor; /* yes, quite arbitrary */ > > > > if (!rt_boost) > > return; > > > > if (!rt_task(current)) { > > /* > > - * Boost priority once every ~50k operations. When the > > - * task tries to take the lock, the rtmutex it will account > > + * Boost priority once every rt_boost_factor operations. When > > + * the task tries to take the lock, the rtmutex it will account > > * for the new priority, and do any corresponding pi-dance. > > */ > > if (trsp && !(torture_random(trsp) % > > @@ -150,8 +151,9 @@ static void torture_rt_boost(struct torture_random_state *trsp) > > return; > > } else { > > /* > > - * The task will remain boosted for another ~500k operations, > > - * then restored back to its original prio, and so forth. > > + * The task will remain boosted for another 10*rt_boost_factor > Maybe I understand incorrectly, the code is > cxt.nrealwriters_stress * factor * 2, should it be 2 rather than 10? It looks that way to me, but I might be missing something. Joel? Thanx, Paul > May I know where the 10 comes from? > > thanks, > Chenyu