lib: Add epoch-based SMR

This commit is contained in:
2026-11-01 21:06:48 +01:00
parent 3ff068e944
commit 7c04530681
24 changed files with 1059 additions and 84 deletions
+9
View File
@@ -29,6 +29,15 @@ void page_hold(struct page* page) {
atomic_fetch_add(&page->holds, 1, ATOMIC_RELAXED);
}
bool page_try_hold(struct page* page) {
size_t holds = atomic_load(&page->holds, ATOMIC_RELAXED);
while (holds) {
if (atomic_compare_exchange_weak(&page->holds, &holds, holds + 1, ATOMIC_ACQUIRE, ATOMIC_RELAXED))
return true;
}
return false;
}
void page_unhold(struct page* page) {
if (atomic_fetch_sub(&page->holds, 1, ATOMIC_RELEASE) != 1)
return;