Why is there e_drain_sx and e_drain_mtx?
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Dec 29 10:50:05 UTC 2020
Hello,
in the epoch based reclamation implementation we have
struct epoch {
struct ck_epoch e_epoch __aligned(EPOCH_ALIGN);
epoch_record_t e_pcpu_record;
int e_in_use;
int e_flags;
struct sx e_drain_sx;
struct mtx e_drain_mtx;
volatile int e_drain_count;
const char *e_name;
};
The e_drain_sx and e_drain_mtx are only used in
void
epoch_drain_callbacks(epoch_t epoch)
{
...
DROP_GIANT();
sx_xlock(&epoch->e_drain_sx);
mtx_lock(&epoch->e_drain_mtx);
...
mtx_unlock(&epoch->e_drain_mtx);
sx_xunlock(&epoch->e_drain_sx);
PICKUP_GIANT();
}
Why is there a combination of a shared/exclusive lock and a mutex used
like this? Why is a single mutex insufficient?
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
More information about the freebsd-hackers
mailing list