Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp78284rdg; Tue, 10 Oct 2023 05:00:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJN9tvbef9axs8IK/1X0MRrHkCRctXbK9FXqcXpXRaOkwy7e/Lor8JjXbrRzwVnORa3zYT X-Received: by 2002:a17:902:a411:b0:1bc:4415:3c1 with SMTP id p17-20020a170902a41100b001bc441503c1mr17499583plq.7.1696939255526; Tue, 10 Oct 2023 05:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696939255; cv=none; d=google.com; s=arc-20160816; b=0JoAhtNhriKCteF8wK95OWiJ0/rCqc+8eFt0tBj7pQKDLtU8zduhVyMZMTyPPDXdde 73FVZKT8vg0sW4UkcZyR2NpnJoKvP6/21lLd5gVPQKZFK1R6zobDXrkMXfNOs8CKS5/v qmjoWsFx7N32omq2OqwnCVxyF3SaswsLdHPs56zLZ3ZQSl4LdHS+IL3lAOD0svAgroE5 J+oXDwttVPpoYAzPxEz+OWGrPetIfvTk9yI2/vS5pnTUx50ZjbeAVCuyZL9PNGkbJAlM 9CMj0eumnUXGRt8/wxVwSvKcbQRNesmuEGgZRNGCBLbp9rPheTGyO2PJQkBAw52BF0pl YYSQ== 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=TqOCSGL5shGjevVJ6CujF740KOM6vHgj4w5Df4h1TAk=; fh=9o1vzmbQvXEiiOZAoGEKGHmVR4Ieb6r+octdNZgYFWA=; b=FvnJlsjGCx4kvW5a/HrTrJgl9ksqugVmuFmeHBwdQxQbnLiNsJRQczbph+vBKNCpaE 7JFFSPZEad/lDzD2DJctWwjd+nIwwcPSW1z69ZMh/ir7tPZLyStQhZky+FJ8uh/Uo2GT D5Xa0ocwFQyyOmwQFaVjvBNoFxo366o3oXZYi56rSnAazZCfduF2CSZHUBp487kuiDih 2yb5OXciWA/ZX8Il8XWvpmYUZ5W8EVPiW9mYArLyb5irj5B6GApW1pOCzoOqnOoWazcd BscsFAKJ0wLvAyJ+UmBhZBBlXQByGY4hSHUXzHiUEUXiFn3o1MrtJvX1V1yMWMa+agSi UOWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mCRcrQA3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id j16-20020a170902da9000b001c9b0be1391si1733903plx.614.2023.10.10.05.00.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 05:00:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mCRcrQA3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id EA5CC80FF028; Tue, 10 Oct 2023 05:00:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231565AbjJJMAk (ORCPT + 99 others); Tue, 10 Oct 2023 08:00:40 -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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 10 Oct 2023 05:00:51 -0700 (PDT) X-Spam-Level: ** 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); -- 2.34.1