使用Rust重构CFS调度器 (#131)

* 新建调度器的文件

* 把softirq vector移动到c文件中(原来在.h)

* 将进程切换方式改为“中断返回时切换”

* new:使用rust重构CFS

* 删除已经在smp中废弃的HPET中断转发函数

* 代码格式化

* 删除多余的dunce依赖
This commit is contained in:
login
2022-12-31 17:26:12 +08:00
committed by GitHub
parent 156949680c
commit d4f3de93a2
37 changed files with 464 additions and 1027 deletions

View File

@ -403,7 +403,7 @@ static bool ahci_read(HBA_PORT *port, uint32_t startl, uint32_t starth, uint32_t
port->ci = 1 << slot; // Issue command
current_pcb->flags |= PF_NEED_SCHED;
sched();
int retval = AHCI_SUCCESS;
// Wait for completion
while (1)
@ -483,7 +483,6 @@ static bool ahci_write(HBA_PORT *port, uint32_t startl, uint32_t starth, uint32_
port->ci = 1; // Issue command
current_pcb->flags |= PF_NEED_SCHED;
sched();
int retval = AHCI_SUCCESS;
while (1)

View File

@ -1,4 +1,5 @@
#include "apic.h"
#include "apic_timer.h"
#include <common/kprint.h>
#include <common/printk.h>
#include <common/cpu.h>
@ -458,7 +459,7 @@ void do_IRQ(struct pt_regs *rsp, ul number)
kBUG("current_pcb->preempt_count<0! pid=%d", current_pcb->pid); // should not be here
// 检测当前进程是否可被调度
if (current_pcb->flags & PF_NEED_SCHED)
if (current_pcb->flags & PF_NEED_SCHED && number == APIC_TIMER_IRQ_NUM)
{
io_mfence();
sched();

View File

@ -70,7 +70,8 @@ int video_refresh_daemon(void *unused)
}
video_refresh_expire_jiffies = cal_next_n_ms_jiffies(REFRESH_INTERVAL << 1);
}
video_daemon_pcb->flags &= ~PROC_RUNNING;
video_daemon_pcb->state &= ~PROC_RUNNING;
video_daemon_pcb->flags |= PF_NEED_SCHED;
sched();
}