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
This commit is contained in:
parent
50696a6e8c
commit
3b1f974bfb
@ -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>
|
||||
@ -184,6 +185,10 @@ init_param1(void)
|
||||
*/
|
||||
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;
|
||||
#endif
|
||||
|
@ -3332,11 +3332,16 @@ SYSCTL_ULONG(_debug, OID_AUTO, vn_lock_pair_pause, CTLFLAG_RD,
|
||||
&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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -448,6 +448,8 @@ extern u_long desiredvnodes; /* number of vnodes desired */
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user