Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1369048rwl; Thu, 5 Jan 2023 12:32:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXufor1Maqwy2y+QR62+rE4KrydnNRtknpG4GqdpZ70imc/XkeiYvBdAj85vOvnrt25RVzqO X-Received: by 2002:a05:6a20:2aa1:b0:9d:efbf:48bf with SMTP id v33-20020a056a202aa100b0009defbf48bfmr85729087pzh.3.1672950766583; Thu, 05 Jan 2023 12:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672950766; cv=none; d=google.com; s=arc-20160816; b=YUPMMbjg4hUDwVhIj3tRuuYl5QxAMjbbUlww9bIFmbF2QzR7uZ+5kcpcTmSO9l1zqv /CH6OIQ5ucTJIOav0kN+tgTlE1i7dimDHs87Q33wVjNwiDCQsu4JuBGB2fXtSwKytAWU dr2z+Ud7zVI0pYvqBt73Q5OKX+lDA8N+9xQmH8/CtCmJAs8mHf3LkZDIbX0T/KnMr/LU UmgYYaFFTLB7IheAm6FWB2LzdUQOKXicjBcXTREsFrysb5eT+ujMcY/1G6DaPkM5tGPL qdq32jqvmfTZAvoxJpGIYq5qtt0DDA4L5C7iGoCZoC79V9chijbYIZ6dLODFSwWErBOP 9nDg== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=/mUM4M2MvjRiQSPysH3ZckVnT6GDdl+gZRZivm8ermI=; b=uw+15kVBdWRapwiHW+28YRppbmQ7Ax4WDRKMFQCRhjh5OhLO3xHY0bbHIyz/7SboS+ iKugCdxerjP1fMal0u04TFxtTw+HDHl3mtuCSAAruSHNqzCd7y1Yab6dOboO0AalkpsN +Z5YwJAuFY+cuRhoi1pUbt/t4z1O5xFPopC8ZGetc2DqfgD4mBO5L+zK2jazaCAEGQ2B jdHL50eIhJyem8wmXFWJy/RAIf7ZA9P0LmEvjzy26C2tFq2gJgdoS36oppiTnyI61emC uTuzQ64V9rmak5948/SOcwxxfXtisILluuAflrkv4hBSwwgvaMhxVRHI1FBm/997YN0B 65OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=qyVNOhiX; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020a6541cd000000b004a7490f17fdsi3341303pgq.743.2023.01.05.12.32.38; Thu, 05 Jan 2023 12:32:46 -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=@joelfernandes.org header.s=google header.b=qyVNOhiX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235281AbjAEUTH (ORCPT + 57 others); Thu, 5 Jan 2023 15:19:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229852AbjAEUTE (ORCPT ); Thu, 5 Jan 2023 15:19:04 -0500 Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CB2BDFB2 for ; Thu, 5 Jan 2023 12:19:03 -0800 (PST) Received: by mail-qv1-xf36.google.com with SMTP id y8so2226739qvn.11 for ; Thu, 05 Jan 2023 12:19:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/mUM4M2MvjRiQSPysH3ZckVnT6GDdl+gZRZivm8ermI=; b=qyVNOhiXVlaouGiq6hKclBzIXX6T4t1eHtrr5dO5KtBq/yhz8eXGZtmMSj9MOEBtOO tWH9SRGdIIy7XVLLsnkzKw/zQ04XSB08ghLf1STvhukidwq1Vi1UXzTVecBEr8dVan20 MLK7Wxyu/0caFxUtg+aI06cO0BZoPIeMWzBxI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/mUM4M2MvjRiQSPysH3ZckVnT6GDdl+gZRZivm8ermI=; b=KBoXv2UF8DlHWalWleqdx8q+JKAQw15nirctZzgNDut1KycgFKAj9dpUjjDSssYjr9 MELFEAxNBE2zuokhWr+5X8FOkWTKzvtGDVgq5CLRx9RkMmq2MZIjRydVqGuy8NSclbG7 NZEdeFfGNaj1IaO68FyWGhHrLTtlmCgo6AqMFGXtNqvM0y4rVVF80q5lTSGIaAEHDqK3 0QfPfALZCw83Rf3qhZtG13MeGNZl78vRzWyaVq64GeVkpaieFxX9pPNsU5Sw3vGRowyy 0mpOnlwIdNHWTT45gToW36lwgOcI0ay+awLObnVA39pGM7yhbX4rPDD1GPV4WeeMWZgM mueQ== X-Gm-Message-State: AFqh2krhJIm+zGjj9N7yc0Ok248CtJsKGBmmfh4WrP4RIWkxjX8Po3aN AT85T5EuVkQ/h0dVgjP3xR7Dew== X-Received: by 2002:a05:6214:1543:b0:524:91d7:5729 with SMTP id t3-20020a056214154300b0052491d75729mr54979346qvw.20.1672949942178; Thu, 05 Jan 2023 12:19:02 -0800 (PST) Received: from localhost (228.221.150.34.bc.googleusercontent.com. [34.150.221.228]) by smtp.gmail.com with ESMTPSA id c7-20020a05620a268700b006fca1691425sm10880053qkp.63.2023.01.05.12.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 12:19:00 -0800 (PST) Date: Thu, 5 Jan 2023 20:19:00 +0000 From: Joel Fernandes To: "Paul E. McKenney" Cc: Chen Yu , 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 , 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: References: <20221123012104.3317665-1-joel@joelfernandes.org> <20221123012104.3317665-4-joel@joelfernandes.org> <20230105182718.GG4028633@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230105182718.GG4028633@paulmck-ThinkPad-P17-Gen-1> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Thu, Jan 05, 2023 at 10:27:18AM -0800, Paul E. McKenney wrote: > 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? > > May I know where the 10 comes from? The comment in existing code was 500k ops. Yes, Chen is right, the comment can be improved to mention the actual equation. I was just going by the initial comment of ~500K ops. Since factor now defaults to 50k, this translates to 500k (10 times the factor) ops which it does for a 4-5 CPU system. But I am Ok with the comment changing to what Chen suggested though! thanks, - Joel