From owner-svn-src-head@freebsd.org Thu Nov 26 18:00:27 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 5F76046ADDC; Thu, 26 Nov 2020 18:00:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Chlsl2D5Nz4pSr; Thu, 26 Nov 2020 18:00:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F0F22770A; Thu, 26 Nov 2020 18:00:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AQI0RuH025294; Thu, 26 Nov 2020 18:00:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AQI0Qgq025291; Thu, 26 Nov 2020 18:00:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011261800.0AQI0Qgq025291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Nov 2020 18:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368073 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 368073 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Thu, 26 Nov 2020 18:00:27 -0000 Author: kib Date: Thu Nov 26 18:00:26 2020 New Revision: 368073 URL: https://svnweb.freebsd.org/changeset/base/368073 Log: Make max ticks for pause in vn_lock_pair() adjustable at runtime. Reduce default value from hz / 10 to hz / 100. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/subr_param.c head/sys/kern/vfs_vnops.c head/sys/sys/vnode.h Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Thu Nov 26 17:39:51 2020 (r368072) +++ head/sys/kern/subr_param.c Thu Nov 26 18:00:26 2020 (r368073) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -183,6 +184,10 @@ init_param1(void) * sign problems sooner. */ ticks = INT_MAX - (hz * 10 * 60); + + vn_lock_pair_pause_max = hz / 100; + if (vn_lock_pair_pause_max == 0) + vn_lock_pair_pause_max = 1; #ifdef VM_SWZONE_SIZE_MAX maxswzone = VM_SWZONE_SIZE_MAX; Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Thu Nov 26 17:39:51 2020 (r368072) +++ head/sys/kern/vfs_vnops.c Thu Nov 26 18:00:26 2020 (r368073) @@ -3332,11 +3332,16 @@ SYSCTL_ULONG(_debug, OID_AUTO, vn_lock_pair_pause, CTL &vn_lock_pair_pause_cnt, 0, "Count of vn_lock_pair deadlocks"); +u_int vn_lock_pair_pause_max; +SYSCTL_UINT(_debug, OID_AUTO, vn_lock_pair_pause_max, CTLFLAG_RW, + &vn_lock_pair_pause_max, 0, + "Max ticks for vn_lock_pair deadlock avoidance sleep"); + static void vn_lock_pair_pause(const char *wmesg) { atomic_add_long(&vn_lock_pair_pause_cnt, 1); - pause(wmesg, prng32_bounded(hz / 10)); + pause(wmesg, prng32_bounded(vn_lock_pair_pause_max)); } /* Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Thu Nov 26 17:39:51 2020 (r368072) +++ head/sys/sys/vnode.h Thu Nov 26 18:00:26 2020 (r368073) @@ -448,6 +448,8 @@ extern u_long desiredvnodes; /* number of vnodes desi extern struct uma_zone *namei_zone; extern struct vattr va_null; /* predefined null vattr structure */ +extern u_int vn_lock_pair_pause_max; + #define VI_LOCK(vp) mtx_lock(&(vp)->v_interlock) #define VI_LOCK_FLAGS(vp, flags) mtx_lock_flags(&(vp)->v_interlock, (flags)) #define VI_TRYLOCK(vp) mtx_trylock(&(vp)->v_interlock)