From patchwork Tue Oct 10 11:59:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Weisbecker X-Patchwork-Id: 13415271 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 2FDE9CD80B0 for ; Tue, 10 Oct 2023 12:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231574AbjJJMAf (ORCPT ); Tue, 10 Oct 2023 08:00:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231781AbjJJMAK (ORCPT ); Tue, 10 Oct 2023 08:00:10 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7917196; Tue, 10 Oct 2023 05:00:02 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14DBDC43391; Tue, 10 Oct 2023 11:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696939202; bh=qaLq/eyHDpze8WBnz65vaRdkOfmOKpB2MmuvHIFiCik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mCRcrQA39pefD1wQ9xLbtVmaVJUEJy45H047G1h/1RMkw+yLxG4KzZQeRFgCHnbEd ky3IoQ1F7i7RImJHGK7BV884RMAcbHPgZx6qMaljCRpoPTVFg/8AEqEVcA5Ev+rmpd y5NT1d/CNDVWqgi/OCxzEvS78qa5CNK3DvcJW4Ckhon5Wg9UG9vxxkGyperQTypHYL tY/6MG0W4ZOp7dHVwEGIwO6MhLvHKa4ZdHNRgqw0NCYl2I2SHBImD4klxXUAytQBGO oRGuvzkmfle7wDK5sbwypvwPO5KZEZifV0FVifbrIONdO8fO4+nIfGsbWocdtsqnjl G/JaOUhMzekhw== From: Frederic Weisbecker To: LKML Cc: "Paul E. McKenney" , Boqun Feng , Joel Fernandes , Josh Triplett , Mathieu Desnoyers , Neeraj Upadhyay , Steven Rostedt , Uladzislau Rezki , rcu , Frederic Weisbecker Subject: [PATCH 10/23] locktorture: Consolidate "if" statements in lock_torture_writer() Date: Tue, 10 Oct 2023 13:59:08 +0200 Message-Id: <20231010115921.988766-11-frederic@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010115921.988766-1-frederic@kernel.org> References: <20231010115921.988766-1-frederic@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org From: "Paul E. McKenney" There is a pair of adjacent "if" statements with identical conditions in the lock_torture_writer() function. This commit therefore combines them. Signed-off-by: Paul E. McKenney Signed-off-by: Frederic Weisbecker --- kernel/locking/locktorture.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index 57ee16cf879d..c8c322e69a90 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -889,11 +889,10 @@ static int lock_torture_writer(void *arg) lock_is_write_held = true; if (WARN_ON_ONCE(atomic_read(&lock_is_read_held))) lwsp->n_lock_fail++; /* rare, but... */ - lwsp->n_lock_acquired++; - } - if (!skip_main_lock) { + cxt.cur_ops->write_delay(&rand); + lock_is_write_held = false; WRITE_ONCE(last_lock_release, jiffies); cxt.cur_ops->writeunlock(tid);