locks: add default delay struct
Use it for all primitives. This makes everything fit in 8 bytes.
This commit is contained in:
parent
6b8dd26e7c
commit
2e77cad11d
@ -763,8 +763,7 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, invl_max_qlen, CTLFLAG_RD,
|
||||
"");
|
||||
#endif
|
||||
|
||||
static struct lock_delay_config __read_frequently di_delay;
|
||||
LOCK_DELAY_SYSINIT_DEFAULT(di_delay);
|
||||
#define di_delay locks_delay
|
||||
|
||||
static void
|
||||
pmap_delayed_invl_start_u(void)
|
||||
|
@ -140,6 +140,7 @@ struct lock_class lock_class_mtx_spin = {
|
||||
};
|
||||
|
||||
#ifdef ADAPTIVE_MUTEXES
|
||||
#ifdef MUTEX_CUSTOM_BACKOFF
|
||||
static SYSCTL_NODE(_debug, OID_AUTO, mtx, CTLFLAG_RD, NULL, "mtx debugging");
|
||||
|
||||
static struct lock_delay_config __read_frequently mtx_delay;
|
||||
@ -150,8 +151,12 @@ SYSCTL_U16(_debug_mtx, OID_AUTO, delay_max, CTLFLAG_RW, &mtx_delay.max,
|
||||
0, "");
|
||||
|
||||
LOCK_DELAY_SYSINIT_DEFAULT(mtx_delay);
|
||||
#else
|
||||
#define mtx_delay locks_delay
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MUTEX_SPIN_CUSTOM_BACKOFF
|
||||
static SYSCTL_NODE(_debug, OID_AUTO, mtx_spin, CTLFLAG_RD, NULL,
|
||||
"mtx spin debugging");
|
||||
|
||||
@ -163,6 +168,9 @@ SYSCTL_INT(_debug_mtx_spin, OID_AUTO, delay_max, CTLFLAG_RW,
|
||||
&mtx_spin_delay.max, 0, "");
|
||||
|
||||
LOCK_DELAY_SYSINIT_DEFAULT(mtx_spin_delay);
|
||||
#else
|
||||
#define mtx_spin_delay locks_delay
|
||||
#endif
|
||||
|
||||
/*
|
||||
* System-wide mutexes
|
||||
|
@ -94,6 +94,7 @@ struct lock_class lock_class_rw = {
|
||||
};
|
||||
|
||||
#ifdef ADAPTIVE_RWLOCKS
|
||||
#ifdef RWLOCK_CUSTOM_BACKOFF
|
||||
static u_short __read_frequently rowner_retries;
|
||||
static u_short __read_frequently rowner_loops;
|
||||
static SYSCTL_NODE(_debug, OID_AUTO, rwlock, CTLFLAG_RD, NULL,
|
||||
@ -117,6 +118,11 @@ rw_lock_delay_init(void *arg __unused)
|
||||
rowner_loops = max(10000, rw_delay.max);
|
||||
}
|
||||
LOCK_DELAY_SYSINIT(rw_lock_delay_init);
|
||||
#else
|
||||
#define rw_delay locks_delay
|
||||
#define rowner_retries locks_delay_retries
|
||||
#define rowner_loops locks_delay_loops
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -143,6 +143,7 @@ struct lock_class lock_class_sx = {
|
||||
#endif
|
||||
|
||||
#ifdef ADAPTIVE_SX
|
||||
#ifdef SX_CUSTOM_BACKOFF
|
||||
static u_short __read_frequently asx_retries;
|
||||
static u_short __read_frequently asx_loops;
|
||||
static SYSCTL_NODE(_debug, OID_AUTO, sx, CTLFLAG_RD, NULL, "sxlock debugging");
|
||||
@ -165,6 +166,11 @@ sx_lock_delay_init(void *arg __unused)
|
||||
asx_loops = max(10000, sx_delay.max);
|
||||
}
|
||||
LOCK_DELAY_SYSINIT(sx_lock_delay_init);
|
||||
#else
|
||||
#define sx_delay locks_delay
|
||||
#define asx_retries locks_delay_retries
|
||||
#define asx_loops locks_delay_loops
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void
|
||||
|
@ -161,6 +161,29 @@ lock_delay_default_init(struct lock_delay_config *lc)
|
||||
lc->max = 32678;
|
||||
}
|
||||
|
||||
struct lock_delay_config __read_frequently locks_delay;
|
||||
u_short __read_frequently locks_delay_retries;
|
||||
u_short __read_frequently locks_delay_loops;
|
||||
|
||||
SYSCTL_U16(_debug_lock, OID_AUTO, delay_base, CTLFLAG_RW, &locks_delay.base,
|
||||
0, "");
|
||||
SYSCTL_U16(_debug_lock, OID_AUTO, delay_max, CTLFLAG_RW, &locks_delay.max,
|
||||
0, "");
|
||||
SYSCTL_U16(_debug_lock, OID_AUTO, delay_retries, CTLFLAG_RW, &locks_delay_retries,
|
||||
0, "");
|
||||
SYSCTL_U16(_debug_lock, OID_AUTO, delay_loops, CTLFLAG_RW, &locks_delay_loops,
|
||||
0, "");
|
||||
|
||||
static void
|
||||
locks_delay_init(void *arg __unused)
|
||||
{
|
||||
|
||||
lock_delay_default_init(&locks_delay);
|
||||
locks_delay_retries = 10;
|
||||
locks_delay_loops = max(10000, locks_delay.max);
|
||||
}
|
||||
LOCK_DELAY_SYSINIT(locks_delay_init);
|
||||
|
||||
#ifdef DDB
|
||||
DB_SHOW_COMMAND(lock, db_show_lock)
|
||||
{
|
||||
|
@ -187,6 +187,10 @@ struct lock_delay_config {
|
||||
u_short max;
|
||||
};
|
||||
|
||||
extern struct lock_delay_config locks_delay;
|
||||
extern u_short locks_delay_retries;
|
||||
extern u_short locks_delay_loops;
|
||||
|
||||
struct lock_delay_arg {
|
||||
struct lock_delay_config *config;
|
||||
u_short delay;
|
||||
|
Loading…
Reference in New Issue
Block a user