Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp884777ybl; Thu, 23 Jan 2020 09:29:36 -0800 (PST) X-Google-Smtp-Source: APXvYqyOYDznmgOd00myvgU2HFdh8OINV9DMZzlNynyECuaE5lTTG9w42ROyBgx1CP3telTPa4X9 X-Received: by 2002:a05:6808:1c6:: with SMTP id x6mr11296184oic.49.1579800576821; Thu, 23 Jan 2020 09:29:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579800576; cv=none; d=google.com; s=arc-20160816; b=f2kY3yP6/XwEPYqM6KyfceVKPIU5FGnMq2ronjPexmjmrhxULY5XYBj3SV5WnJNnIG Ae6dw2SrDa5GrPjPrA/tm0DrdMWk+S9QBJxPuV5yoQS0axm+1qATTfgKBDX21TldWhRy 0J4vI8udnzlWH6LZaKgWsnYd04aZfvQ8pJyMN/YiBy/hJ5R0SrjsSeZtztJxxQUs8Gud fpsiFxUE/NAu1jh2HWpOrH/3LQ2NGCHBTFHAVej3oJFzlfJFfNpiH9HzF4+bG25/9kky SRBkLiIGjlDvXkE7N5ALKc4Z9lmYH/MueUgefBKGrl02bwKmxmaVGqAyJ4u1rCNQD6du xuVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Jw+eagM0K1bvOotDJTZKffhuPUCxcEq79YwXL829XQc=; b=Uif//Os9jlLBwuFIy444FEDlHDwVc/VcQgdwgo9bY4iziYzWoR08swsvXeMGfLfRjI /9IR7Gax4HQePat0eaWqrQ2XKFFNZcPYES3ynwCMacP6CIBiwLiL6RkhU6RHETPSYnPy MSX4hTJ1lALBvsIcxcAH9i75Ri5AqmUYRhobbkwRdDKqVneA0sZv4PPpm96nUnaveGly 9I+VigauOdv72o5tV3H1UEqfnowQKzGdDAOX4cf6lWPlvQptahYZQ5uuMR/S8fKKkL4Z 1dYwT6ERcab+uZk1i+SQT+3SD7E7Xw6NWDL46lWes4wwdn5N13eY4oD8NyLYyjidicnh 8YKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AW0ZTo3E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h28si1664413otg.63.2020.01.23.09.29.24; Thu, 23 Jan 2020 09:29:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AW0ZTo3E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729092AbgAWR1I (ORCPT + 99 others); Thu, 23 Jan 2020 12:27:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:46376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727022AbgAWR1I (ORCPT ); Thu, 23 Jan 2020 12:27:08 -0500 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93AD521569; Thu, 23 Jan 2020 17:27:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579800427; bh=GSo5r3TWjpardWgDCzGMqZYl5XSsfkEFRtnZtAa6WCc=; h=Date:From:To:Cc:Subject:Reply-To:From; b=AW0ZTo3ER/ioiD9u1ciduDzGBqLu2/pThLU/IrA7YWmM8jmQ08YzdRdlEUsHM5Ms9 uL8sQroxU6wOI+/oAJv14TCP9nY5uoGNjr2sYnIH8yPPlcr9yFeyXFeJrcxJGhWgkL HXztwLsC27xk/4bJmEU8rQ0YYDqfgECakun3Emv0= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 6BA923520C31; Thu, 23 Jan 2020 09:27:07 -0800 (PST) Date: Thu, 23 Jan 2020 09:27:07 -0800 From: "Paul E. McKenney" To: dave@stgolabs.net, josh@joshtriplett.org Cc: linux-kernel@vger.kernel.org, will@kernel.org, peterz@infradead.org Subject: [PATCH RFC locktorture] Print ratio of acquisitions, not failures Message-ID: <20200123172707.GA24441@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The __torture_print_stats() function in locktorture.c carefully initializes local variable "min" to statp[0].n_lock_acquired, but then compares it to statp[i].n_lock_fail. Given that the .n_lock_fail field should normally be zero, and given the initialization, it seems reasonable to display the maximum and minimum number acquisitions instead of miscomputing the maximum and minimum number of failures. This commit therefore switches from failures to acquisitions. Reported-by: Will Deacon Signed-off-by: Paul E. McKenney Cc: Davidlohr Bueso Cc: Josh Triplett Cc: Peter Zijlstra diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index 99475a6..687c1d8 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -696,10 +696,10 @@ static void __torture_print_stats(char *page, if (statp[i].n_lock_fail) fail = true; sum += statp[i].n_lock_acquired; - if (max < statp[i].n_lock_fail) - max = statp[i].n_lock_fail; - if (min > statp[i].n_lock_fail) - min = statp[i].n_lock_fail; + if (max < statp[i].n_lock_acquired) + max = statp[i].n_lock_acquired; + if (min > statp[i].n_lock_acquired) + min = statp[i].n_lock_acquired; } page += sprintf(page, "%s: Total: %lld Max/Min: %ld/%ld %s Fail: %d %s\n",