Date: Thu, 26 Nov 2020 18:00:26 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368073 - in head/sys: kern sys Message-ID: <202011261800.0AQI0Qgq025291@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/msgbuf.h> #include <sys/sysctl.h> #include <sys/proc.h> +#include <sys/vnode.h> #include <vm/vm.h> #include <vm/vm_param.h> @@ -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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011261800.0AQI0Qgq025291>