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

Function epoch_free

freebsd/kern/subr_epoch.c:383–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383void
384epoch_free(epoch_t epoch)
385{
386#ifdef INVARIANTS
387 int cpu;
388#endif
389
390 EPOCH_LOCK();
391
392 MPASS(epoch->e_in_use != 0);
393
394 epoch_drain_callbacks(epoch);
395
396 atomic_store_rel_int(&epoch->e_in_use, 0);
397 /*
398 * Make sure the epoch_call_task() function see e_in_use equal
399 * to zero, by calling epoch_wait() on the global_epoch:
400 */
401 epoch_wait(global_epoch);
402#ifdef INVARIANTS
403 CPU_FOREACH(cpu) {
404 epoch_record_t er;
405
406 er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu);
407
408 /*
409 * Sanity check: none of the records should be in use anymore.
410 * We drained callbacks above and freeing the pcpu records is
411 * imminent.
412 */
413 MPASS(er->er_td == NULL);
414 MPASS(TAILQ_EMPTY(&er->er_tdlist));
415 }
416#endif
417 uma_zfree_pcpu(pcpu_zone_record, epoch->e_pcpu_record);
418 mtx_destroy(&epoch->e_drain_mtx);
419 sx_destroy(&epoch->e_drain_sx);
420 memset(epoch, 0, sizeof(*epoch));
421
422 EPOCH_UNLOCK();
423}
424
425static epoch_record_t
426epoch_currecord(epoch_t epoch)

Callers

nothing calls this directly

Calls 5

epoch_waitFunction · 0.85
memsetFunction · 0.85
epoch_drain_callbacksFunction · 0.70
sx_destroyFunction · 0.70
uma_zfree_pcpuFunction · 0.50

Tested by

no test coverage detected