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
+15
View File
@@ -4,7 +4,9 @@
#include <zinnia/assert.h>
#include <zinnia/atomic.h>
#include <zinnia/errno.h>
#include <zinnia/irq.h>
#include <zinnia/park.h>
#include <zinnia/percpu.h>
#include <zinnia/process.h>
#include <zinnia/sched.h>
#include <zinnia/spin.h>
@@ -163,3 +165,16 @@ void sched_sleep_until(uint64_t deadline_ns) {
const uint8_t key = 0;
park_timeout(&key, nullptr, nullptr, nullptr, 0, &deadline_ns);
}
void sched_preempt_disable() {
arch_sched_preempt_disable();
}
void sched_preempt_enable() {
if (!arch_sched_preempt_enable())
return;
struct scheduler* sched = &percpu_get()->sched;
if ((sched->owe_preempt || sched->need_resched) && percpu_ref(irq_data)->depth == 0 && irq_get_state() &&
sched->current)
sched_reschedule(sched);
}