lib: Add epoch-based SMR
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user