Kernel: Store SchedulerThreadNode directly in Thread

Having the pointer indirection was weird and forced allocations when
adding/binding a new thread :P
This commit is contained in:
2026-08-23 14:21:27 +03:00
parent cce6e417df
commit 17813f3fcf
19 changed files with 103 additions and 144 deletions
+2 -3
View File
@@ -22,7 +22,6 @@ namespace Kernel
class GDT;
class IDT;
class Scheduler;
class SchedulerThreadNode;
class Thread;
#if ARCH(x86_64) || ARCH(i686)
@@ -54,8 +53,8 @@ namespace Kernel
union
{
TLBEntry flush_tlb;
SchedulerThreadNode* new_thread;
SchedulerThreadNode* unblock_thread;
Thread* new_thread;
Thread* unblock_thread;
bool dummy;
};
};
+2 -6
View File
@@ -41,9 +41,8 @@ namespace Kernel
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
BAN::ErrorOr<void> add_thread(Thread*);
static void bind_thread_to_processor(Thread*, ProcessorID);
void add_thread(Thread*);
void block_current_thread(ThreadBlocker* thread_blocker, uint64_t wake_time_ns, BaseMutex* mutex);
void unblock_thread(Thread*);
@@ -68,9 +67,6 @@ namespace Kernel
class ProcessorID find_least_loaded_processor() const;
void add_thread(SchedulerThreadNode*);
void unblock_thread(SchedulerThreadNode*);
private:
SchedulerQueue m_run_list;
SchedulerHeap m_block_list;
+2 -1
View File
@@ -7,6 +7,7 @@
#include <kernel/InterruptStack.h>
#include <kernel/Lock/Mutex.h>
#include <kernel/Memory/VirtualRange.h>
#include <kernel/SchedulerThreadNode.h>
#include <LibELF/AuxiliaryVector.h>
@@ -192,7 +193,7 @@ namespace Kernel
vaddr_t m_fsbase { 0 };
vaddr_t m_gsbase { 0 };
SchedulerThreadNode* m_scheduler_node { nullptr };
SchedulerThreadNode m_scheduler_node;
YieldRegisters m_yield_registers { };