SMP - trully idle APs
- any cpu can use smp_schedule() to tell another cpu to reschedule - if an AP is idle, it turns off timer as there is nothing to preempt, no need to wakeup just to go back to sleep again - if a cpu makes a process runnable on an idle cpu, it must wake it up to reschedule
This commit is contained in:
19
kernel/smp.c
19
kernel/smp.c
@@ -1,4 +1,5 @@
|
||||
#include "smp.h"
|
||||
#include "interrupt.h"
|
||||
|
||||
unsigned ncpus;
|
||||
unsigned ht_per_core;
|
||||
@@ -28,7 +29,25 @@ PUBLIC void ap_boot_finished(unsigned cpu)
|
||||
|
||||
PUBLIC void smp_ipi_halt_handler(void)
|
||||
{
|
||||
ipi_ack();
|
||||
arch_stop_local_timer();
|
||||
arch_smp_halt_cpu();
|
||||
}
|
||||
|
||||
PUBLIC void smp_schedule(unsigned cpu)
|
||||
{
|
||||
arch_send_smp_schedule_ipi(cpu);
|
||||
}
|
||||
|
||||
PUBLIC void smp_ipi_sched_handler(void)
|
||||
{
|
||||
struct proc * p;
|
||||
|
||||
ipi_ack();
|
||||
|
||||
p = get_cpulocal_var(proc_ptr);
|
||||
|
||||
if (p->p_endpoint != IDLE)
|
||||
RTS_SET(p, RTS_PREEMPTED); /* calls dequeue() */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user