Compare commits
No commits in common. "1f03d23daec075e3da90c13b2fcd5cc7bbecf1a1" and "ed82a18e2aab203e80bce433d74e07a63c6db58b" have entirely different histories.
1f03d23dae
...
ed82a18e2a
|
|
@ -223,8 +223,7 @@ namespace Kernel
|
||||||
{
|
{
|
||||||
case Thread::State::Terminated:
|
case Thread::State::Terminated:
|
||||||
remove_node_from_most_loaded(m_current);
|
remove_node_from_most_loaded(m_current);
|
||||||
if (&PageTable::current() != &PageTable::kernel())
|
PageTable::kernel().load();
|
||||||
PageTable::kernel().load();
|
|
||||||
delete m_current->thread;
|
delete m_current->thread;
|
||||||
delete m_current;
|
delete m_current;
|
||||||
m_thread_count--;
|
m_thread_count--;
|
||||||
|
|
@ -256,8 +255,7 @@ namespace Kernel
|
||||||
if (m_current->thread->state() != Thread::State::Terminated)
|
if (m_current->thread->state() != Thread::State::Terminated)
|
||||||
break;
|
break;
|
||||||
remove_node_from_most_loaded(m_current);
|
remove_node_from_most_loaded(m_current);
|
||||||
if (&PageTable::current() != &PageTable::kernel())
|
PageTable::kernel().load();
|
||||||
PageTable::kernel().load();
|
|
||||||
delete m_current->thread;
|
delete m_current->thread;
|
||||||
delete m_current;
|
delete m_current;
|
||||||
m_thread_count--;
|
m_thread_count--;
|
||||||
|
|
@ -265,8 +263,7 @@ namespace Kernel
|
||||||
|
|
||||||
if (m_current == nullptr)
|
if (m_current == nullptr)
|
||||||
{
|
{
|
||||||
if (&PageTable::current() != &PageTable::kernel())
|
PageTable::kernel().load();
|
||||||
PageTable::kernel().load();
|
|
||||||
*interrupt_stack = m_idle_thread->interrupt_stack();
|
*interrupt_stack = m_idle_thread->interrupt_stack();
|
||||||
*interrupt_registers = m_idle_thread->interrupt_registers();
|
*interrupt_registers = m_idle_thread->interrupt_registers();
|
||||||
m_idle_thread->m_state = Thread::State::Executing;
|
m_idle_thread->m_state = Thread::State::Executing;
|
||||||
|
|
@ -279,8 +276,7 @@ namespace Kernel
|
||||||
auto* thread = m_current->thread;
|
auto* thread = m_current->thread;
|
||||||
|
|
||||||
auto& page_table = thread->has_process() ? thread->process().page_table() : PageTable::kernel();
|
auto& page_table = thread->has_process() ? thread->process().page_table() : PageTable::kernel();
|
||||||
if (&PageTable::current() != &page_table)
|
page_table.load();
|
||||||
page_table.load();
|
|
||||||
|
|
||||||
if (thread->state() == Thread::State::NotStarted)
|
if (thread->state() == Thread::State::NotStarted)
|
||||||
{
|
{
|
||||||
|
|
@ -411,10 +407,10 @@ namespace Kernel
|
||||||
uint32_t least_max_load_threads = static_cast<uint32_t>(-1);
|
uint32_t least_max_load_threads = static_cast<uint32_t>(-1);
|
||||||
for (uint8_t i = 0; i < Processor::count(); i++)
|
for (uint8_t i = 0; i < Processor::count(); i++)
|
||||||
{
|
{
|
||||||
const auto processor_id = Processor::id_from_index(i);
|
auto processor_id = Processor::id_from_index(i);
|
||||||
if (processor_id == Processor::current_id())
|
if (processor_id == Processor::current_id())
|
||||||
continue;
|
continue;
|
||||||
const auto& info = s_processor_infos[processor_id.as_u32()];
|
const auto& info = s_processor_infos[i];
|
||||||
if (info.idle_time_ns < most_idle_ns || info.max_load_threads > least_max_load_threads)
|
if (info.idle_time_ns < most_idle_ns || info.max_load_threads > least_max_load_threads)
|
||||||
continue;
|
continue;
|
||||||
least_loaded_id = processor_id;
|
least_loaded_id = processor_id;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue