MCPcopy Create free account
hub / github.com/F-Stack/f-stack / smr_lazy_enter

Function smr_lazy_enter

freebsd/sys/smr.h:168–187  ·  view source on GitHub ↗

* Enter a lazy smr section. This is used for read-mostly state that * can tolerate a high free latency. */

Source from the content-addressed store, hash-verified

166 * can tolerate a high free latency.
167 */
168static inline void
169smr_lazy_enter(smr_t smr)
170{
171
172 critical_enter();
173 smr = zpcpu_get(smr);
174 KASSERT((smr->c_flags & SMR_LAZY) != 0,
175 ("smr_lazy_enter(%s) non-lazy smr.", smr->c_shared->s_name));
176 KASSERT(smr->c_seq == 0,
177 ("smr_lazy_enter(%s) does not support recursion.",
178 smr->c_shared->s_name));
179
180 /*
181 * This needs no serialization. If an interrupt occurs before we
182 * assign sr_seq to c_seq any speculative loads will be discarded.
183 * If we assign a stale wr_seq value due to interrupt we use the
184 * same algorithm that renders smr_enter() safe.
185 */
186 atomic_store_int(&smr->c_seq, smr_shared_current(smr->c_shared));
187}
188
189/*
190 * Exit a lazy smr section. This is used for read-mostly state that

Callers

nothing calls this directly

Calls 2

smr_shared_currentFunction · 0.85
critical_enterFunction · 0.70

Tested by

no test coverage detected