Kernel: Don't use peridic interrupts for scheduling
Scheduler will now set a timer interrupt deadline for when it should get interrupted next. This fixes a big issue I've had for a long time where sleeping on an idle core would have to wait for the next periodic interrupt to wake up. This could cause 1 ms sleeps to be close to 10 ms. This currently only supports lapic timers and will still fallback to periodic interrupts when running with PIC. I should add deadline support to PIT/HPET but why would you run with APIC disabled ;)
This commit is contained in:
@@ -26,6 +26,7 @@ namespace Kernel
|
||||
BAN::ErrorOr<uint8_t> reserve_gsi(uint32_t gsi);
|
||||
|
||||
void initialize_timer();
|
||||
void set_timer_dealine(uint64_t ns);
|
||||
|
||||
private:
|
||||
uint32_t read_from_local_apic(ptrdiff_t);
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Kernel
|
||||
|
||||
public:
|
||||
void add_thread_to_back(Node*);
|
||||
void add_thread_with_wake_time(Node*);
|
||||
bool add_thread_with_wake_time(Node*); // return true if node was inserted as the first element
|
||||
template<typename F>
|
||||
Node* remove_with_condition(F callback);
|
||||
void remove_node(Node*);
|
||||
@@ -60,7 +60,8 @@ namespace Kernel
|
||||
void reschedule(YieldRegisters*);
|
||||
void reschedule_if_idle();
|
||||
|
||||
void timer_interrupt();
|
||||
void on_timer_interrupt();
|
||||
void on_yield(YieldRegisters*);
|
||||
|
||||
static BAN::ErrorOr<void> bind_thread_to_processor(Thread*, ProcessorID);
|
||||
// if thread is already bound, this will never fail
|
||||
@@ -82,6 +83,7 @@ namespace Kernel
|
||||
void update_most_loaded_node_queue(SchedulerQueue::Node*, SchedulerQueue* target_queue);
|
||||
void remove_node_from_most_loaded(SchedulerQueue::Node*);
|
||||
|
||||
void update_wake_up_deadline();
|
||||
void wake_up_sleeping_threads();
|
||||
|
||||
void do_load_balancing();
|
||||
|
||||
Reference in New Issue
Block a user