Changeset View
Changeset View
Standalone View
Standalone View
head/sys/sys/smr.h
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | struct smr_shared { | ||||
smr_seq_t s_rd_seq; /* Minimum observed read sequence. */ | smr_seq_t s_rd_seq; /* Minimum observed read sequence. */ | ||||
}; | }; | ||||
typedef struct smr_shared *smr_shared_t; | typedef struct smr_shared *smr_shared_t; | ||||
/* Per-cpu SMR state. */ | /* Per-cpu SMR state. */ | ||||
struct smr { | struct smr { | ||||
smr_seq_t c_seq; /* Current observed sequence. */ | smr_seq_t c_seq; /* Current observed sequence. */ | ||||
smr_shared_t c_shared; /* Shared SMR state. */ | smr_shared_t c_shared; /* Shared SMR state. */ | ||||
int c_deferred; /* Deferred advance counter. */ | |||||
}; | }; | ||||
/* | /* | ||||
* Return the current write sequence number. | * Return the current write sequence number. | ||||
*/ | */ | ||||
static inline smr_seq_t | static inline smr_seq_t | ||||
smr_shared_current(smr_shared_t s) | smr_shared_current(smr_shared_t s) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | smr_exit(smr_t smr) | ||||
critical_exit(); | critical_exit(); | ||||
} | } | ||||
/* | /* | ||||
* Advances the write sequence number. Returns the sequence number | * Advances the write sequence number. Returns the sequence number | ||||
* required to ensure that all modifications are visible to readers. | * required to ensure that all modifications are visible to readers. | ||||
*/ | */ | ||||
smr_seq_t smr_advance(smr_t smr); | smr_seq_t smr_advance(smr_t smr); | ||||
/* | |||||
* Advances the write sequence number only after N calls. Returns | |||||
* the correct goal for a wr_seq that has not yet occurred. Used to | |||||
* minimize shared cacheline invalidations for frequent writers. | |||||
*/ | |||||
smr_seq_t smr_advance_deferred(smr_t smr, int limit); | |||||
/* | /* | ||||
* Returns true if a goal sequence has been reached. If | * Returns true if a goal sequence has been reached. If | ||||
* wait is true this will busy loop until success. | * wait is true this will busy loop until success. | ||||
*/ | */ | ||||
bool smr_poll(smr_t smr, smr_seq_t goal, bool wait); | bool smr_poll(smr_t smr, smr_seq_t goal, bool wait); | ||||
/* Create a new SMR context. */ | /* Create a new SMR context. */ | ||||
Show All 32 Lines |