From owner-svn-src-head@freebsd.org Fri Nov 13 19:13:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2CAD2EB1F8; Fri, 13 Nov 2020 19:13:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CXp5S2PJdz4mvh; Fri, 13 Nov 2020 19:12:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 0ADJCqWQ026795 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 13 Nov 2020 21:12:55 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0ADJCqWQ026795 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 0ADJCq8T026794; Fri, 13 Nov 2020 21:12:52 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 13 Nov 2020 21:12:52 +0200 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r367631 - in head/sys: kern sys Message-ID: References: <202011130931.0AD9VwBL082843@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CXp5S2PJdz4mvh X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 19:13:00 -0000 On Fri, Nov 13, 2020 at 08:24:30AM -0800, Conrad Meyer wrote: > Hi Konstantin, > > On Fri, Nov 13, 2020 at 1:32 AM Konstantin Belousov wrote: > > > > Author: kib > > Date: Fri Nov 13 09:31:57 2020 > > New Revision: 367631 > > URL: https://svnweb.freebsd.org/changeset/base/367631 > > > > Log: > > Implement vn_lock_pair(). > > > > Modified: head/sys/kern/vfs_vnops.c > > ============================================================================== > > --- head/sys/kern/vfs_vnops.c Fri Nov 13 02:05:45 2020 (r367630) > > +++ head/sys/kern/vfs_vnops.c Fri Nov 13 09:31:57 2020 (r367631) > > @@ -3317,4 +3325,92 @@ vn_fallocate(struct file *fp, off_t offset, off_t len, > > ... > > + > > +static void > > +vn_lock_pair_pause(const char *wmesg) > > +{ > > + atomic_add_long(&vn_lock_pair_pause_cnt, 1); > > + pause(wmesg, prng32_bounded(hz / 10)); > > +} > > This function is called when the try-lock of the second lock in the > pair (either order) fails. The back-off period is up to 100ms, > expected average 50ms. That seems really high? It is called only in deadlock avoidance case, where we already have to drop to slow path for other reasons (this is coming in the patch that I hope to commit today). My selection of numbers were driven by more or less realistic estimates of the vnode lock ownership time for sync io on very busy HDD, there was a short discussion of it with Mark in review. > > Separately: prng32_bounded() may return 0, which is transparently > converted to the equivalent of 1 by pause_sbt(9). This means a 1 tick > pause is marginally more likely than any other possible duration. It > probably doesn't matter. I do not quite understand the point. Do you want the 0->1 conversion be explicit there ? Or something else ?