Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/subr_smr.c
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | |||||
* sequence may not be advanced on write for lazy or deferred SMRs. In this | * sequence may not be advanced on write for lazy or deferred SMRs. In this | ||||
* case poll needs to attempt to forward the sequence number if the goal is | * case poll needs to attempt to forward the sequence number if the goal is | ||||
* within wr_seq + SMR_SEQ_ADVANCE. | * within wr_seq + SMR_SEQ_ADVANCE. | ||||
*/ | */ | ||||
#define SMR_SEQ_ADVANCE SMR_LAZY_INCR | #define SMR_SEQ_ADVANCE SMR_LAZY_INCR | ||||
static SYSCTL_NODE(_debug, OID_AUTO, smr, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, | static SYSCTL_NODE(_debug, OID_AUTO, smr, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, | ||||
"SMR Stats"); | "SMR Stats"); | ||||
static counter_u64_t advance = EARLY_COUNTER; | static COUNTER_U64_DEFINE_EARLY(advance); | ||||
SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, advance, CTLFLAG_RW, &advance, ""); | SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, advance, CTLFLAG_RW, &advance, ""); | ||||
static counter_u64_t advance_wait = EARLY_COUNTER; | static COUNTER_U64_DEFINE_EARLY(advance_wait); | ||||
SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, advance_wait, CTLFLAG_RW, &advance_wait, ""); | SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, advance_wait, CTLFLAG_RW, &advance_wait, ""); | ||||
static counter_u64_t poll = EARLY_COUNTER; | static COUNTER_U64_DEFINE_EARLY(poll); | ||||
SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, poll, CTLFLAG_RW, &poll, ""); | SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, poll, CTLFLAG_RW, &poll, ""); | ||||
static counter_u64_t poll_scan = EARLY_COUNTER; | static COUNTER_U64_DEFINE_EARLY(poll_scan); | ||||
SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, poll_scan, CTLFLAG_RW, &poll_scan, ""); | SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, poll_scan, CTLFLAG_RW, &poll_scan, ""); | ||||
static counter_u64_t poll_fail = EARLY_COUNTER; | static COUNTER_U64_DEFINE_EARLY(poll_fail); | ||||
SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, poll_fail, CTLFLAG_RW, &poll_fail, ""); | SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, poll_fail, CTLFLAG_RW, &poll_fail, ""); | ||||
/* | /* | ||||
* Advance a lazy write sequence number. These move forward at the rate of | * Advance a lazy write sequence number. These move forward at the rate of | ||||
* ticks. Grace is SMR_LAZY_INCR (2 ticks) in the future. | * ticks. Grace is SMR_LAZY_INCR (2 ticks) in the future. | ||||
* | * | ||||
* This returns the goal write sequence number. | * This returns the goal write sequence number. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 408 Lines • ▼ Show 20 Lines | |||||
smr_init(void) | smr_init(void) | ||||
{ | { | ||||
smr_shared_zone = uma_zcreate("SMR SHARED", sizeof(struct smr_shared), | smr_shared_zone = uma_zcreate("SMR SHARED", sizeof(struct smr_shared), | ||||
NULL, NULL, NULL, NULL, (CACHE_LINE_SIZE * 2) - 1, 0); | NULL, NULL, NULL, NULL, (CACHE_LINE_SIZE * 2) - 1, 0); | ||||
smr_zone = uma_zcreate("SMR CPU", sizeof(struct smr), | smr_zone = uma_zcreate("SMR CPU", sizeof(struct smr), | ||||
NULL, NULL, NULL, NULL, (CACHE_LINE_SIZE * 2) - 1, UMA_ZONE_PCPU); | NULL, NULL, NULL, NULL, (CACHE_LINE_SIZE * 2) - 1, UMA_ZONE_PCPU); | ||||
} | } | ||||
static void | |||||
smr_init_counters(void *unused) | |||||
{ | |||||
advance = counter_u64_alloc(M_WAITOK); | |||||
advance_wait = counter_u64_alloc(M_WAITOK); | |||||
poll = counter_u64_alloc(M_WAITOK); | |||||
poll_scan = counter_u64_alloc(M_WAITOK); | |||||
poll_fail = counter_u64_alloc(M_WAITOK); | |||||
} | |||||
SYSINIT(smr_counters, SI_SUB_CPU, SI_ORDER_ANY, smr_init_counters, NULL); |