Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6684469rwb; Tue, 22 Nov 2022 17:32:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ztcI7YggI2mXw2hFvawVrIKM9xqk/4U9jKXJJ1cRnMfGQBE+OsyXZnAD+xz4YOoIYD+Ar X-Received: by 2002:a63:4755:0:b0:477:1bf6:8b1c with SMTP id w21-20020a634755000000b004771bf68b1cmr5789060pgk.25.1669167155422; Tue, 22 Nov 2022 17:32:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669167155; cv=none; d=google.com; s=arc-20160816; b=qZGFygPd5X4mQ/w8+/4g7ABhr+rRFsd6+eU/EpVdlKStlt0+ELJpVxLi8JqNbIwVCU vOBni5C3gg/2ig5G3q9+1aVMR0m5nkS1FoXPjKF3/UzSzc6ExrrxqNABZuArdG5H3e2K w4/vgrEpVHaydLcVXUVLoMoy8B9rlRDwaJz7l4iKkq6Lm1LZHUPsjlshGyrtI76JBYGw M5eu1Z1zrTFGk3kNPQcyt+zVlJlt7zmrWJaxaqzf9PHn8oSIw0QeBkd8WVBAYGM9C0uD orrt1kbFyBW6t38/Poy5E1/8QL64t8lqBJiEbTIJqgzEUWfhyqABjGqnxzaICNC8/P9S +WrA== 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=3Xn44YesMZuZ8Y4WLRq4kq1k9pek4ng6uS2E49EtvTo=; b=Ao7zxiObQge8krs/ptXGe2D3yKdjL4dFcUmnn+7/QniG/6JHQCO5LtxGvN5HG1w8rx iwKlaTUqIEy5hnpIM8ItlatIA26sFM0wZ7ntg/7p/yZZMmaGGxBnqCcT+KVhLtcQVaH3 gCGLxq0ChLe5RLdNHoh8fw/h/uUb6mZDWyQd8vxaZ5gZpzokgxb2eNwAIKOS8ZiYmmJ3 UWDlCH9M+paMxA8KVWyXxnvWLpQZp95oZaNLzGI8XCWKTPohe+wgDSHYjRZRkpmyv0uK vgQnt2qp4meYsyB27ix5CHK2r3+MdofkO96QsfS6B4YSVU9zOF6dvIU6ANj0CNluxpN/ eJbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=X1sloOlg; 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 k9-20020a170902d58900b00181dc40f516si16535708plh.146.2022.11.22.17.32.23; Tue, 22 Nov 2022 17:32:35 -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=X1sloOlg; 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 S233459AbiKWBVh (ORCPT + 90 others); Tue, 22 Nov 2022 20:21:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234575AbiKWBVU (ORCPT ); Tue, 22 Nov 2022 20:21:20 -0500 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E821623B for ; Tue, 22 Nov 2022 17:21:19 -0800 (PST) Received: by mail-qk1-x72e.google.com with SMTP id x18so11567196qki.4 for ; Tue, 22 Nov 2022 17:21:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3Xn44YesMZuZ8Y4WLRq4kq1k9pek4ng6uS2E49EtvTo=; b=X1sloOlgGllcTjloaNOVgImsa3WWDB0rKo/V4rhEpZ6lwZVuZCGd5Ry70nxVZf3tCD Kwd1kV+FCfUtXRqFb5UhftZHXOx2NDkiV9j1kNON7jw4FxVtyzI+o3GjiYcP57lxHRyX l5PuyYEojNSISBrTYWZMPdiOMOxz/AtOwfM3s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3Xn44YesMZuZ8Y4WLRq4kq1k9pek4ng6uS2E49EtvTo=; b=Qn1ox2QKolfF/711kQpySiRanXZEX4Ukqq3tHAlpaQy/NoaKIikZszxo3zo33DR8sR vj22dr9gzgCkLnKywOjBeG8MBU9BWSFYZ+dw2cVK0hhWKi4+aqQS+lLPUEBNM7PibWOl wDz7JaaV3dJdFOwVhD34fCbvUyN7qOlZASVNXDqC3QSUSIqdh4ntc/QwC68udPRPtv7D 9SZajbQu4xRVdCaskciQv/xxq+loditdyZZKhFhl+GekiEm4PDDGPqe+2cGIZieuo2ho +JhKILfkgKKTxbGdDNhoA4NseHaHJEORK764vYjqtjj5olJJAj8Jn/bZfavFNd+OfkvB kd+w== X-Gm-Message-State: ANoB5pnwavNiEUlmT5Vsse9UlxGD80Vd5MCMY8guUxdv+g1OzC456ssU AKCf4PYkmetrX3J6tQrOhJ6hilNUanmH1g== X-Received: by 2002:a37:cd7:0:b0:6fa:1e59:4b72 with SMTP id 206-20020a370cd7000000b006fa1e594b72mr22925074qkm.247.1669166478871; Tue, 22 Nov 2022 17:21:18 -0800 (PST) Received: from joelboxx.c.googlers.com.com (228.221.150.34.bc.googleusercontent.com. [34.150.221.228]) by smtp.gmail.com with ESMTPSA id gc7-20020a05622a59c700b0035ce8965045sm9096026qtb.42.2022.11.22.17.21.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 17:21:18 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , Ben Segall , Daniel Bristot de Oliveira , Davidlohr Bueso , Dietmar Eggemann , Ingo Molnar , Josh Triplett , Juri Lelli , Mel Gorman , "Paul E. McKenney" , 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: [PATCH RFC 3/3] locktorture: Make the rt_boost factor a tunable Date: Wed, 23 Nov 2022 01:21:04 +0000 Message-Id: <20221123012104.3317665-4-joel@joelfernandes.org> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog In-Reply-To: <20221123012104.3317665-1-joel@joelfernandes.org> References: <20221123012104.3317665-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 + * operations, then restored back to its original prio, and so + * forth. * * When @trsp is nil, we want to force-reset the task for * stopping the kthread. -- 2.38.1.584.g0f3c55d4c2-goog