重写调度模块 (#679)

## PR:重写调度模块
--- 
### 完成的部分
- 实现cfs调度策略
- 搭建框架,后续功能可以迭代开发
- 目前能跑,未测试性能

### 需要后续接力的部分
- 实现组内调度(task_group)
- 实现跨核负载均衡(pelt算法)
- 接入sysfs,实现参数动态调节(sched_stat等)
- nice值以及priority等参数的设置及调优
This commit is contained in:
GnoCiYeH
2024-04-05 17:54:48 +08:00
committed by GitHub
parent e8eab1ac82
commit f0c87a897f
44 changed files with 3733 additions and 1066 deletions

View File

@ -11,7 +11,6 @@ use alloc::{
use system_error::SystemError;
use crate::{
arch::sched::sched,
filesystem::vfs::{
file::{File, FileMode},
FilePrivateData, IndexNode, Metadata,
@ -24,6 +23,7 @@ use crate::{
wait_queue::WaitQueue,
},
process::ProcessManager,
sched::{schedule, SchedMode},
time::{
timer::{next_n_us_timer_jiffies, Timer, WakeUpHelper},
TimeSpec,
@ -489,7 +489,7 @@ impl EventPoll {
let guard = epoll.0.lock_irqsave();
unsafe { guard.epoll_wq.sleep_without_schedule() };
drop(guard);
sched();
schedule(SchedMode::SM_NONE);
// 被唤醒后,检查是否有事件可读
available = epoll.0.lock_irqsave().ep_events_available();
if let Some(timer) = timer {

View File

@ -15,7 +15,7 @@ use smoltcp::{
use system_error::SystemError;
use crate::{
arch::{rand::rand, sched::sched},
arch::rand::rand,
filesystem::vfs::{
file::FileMode, syscall::ModeType, FilePrivateData, FileSystem, FileType, IndexNode,
Metadata,
@ -25,6 +25,7 @@ use crate::{
spinlock::{SpinLock, SpinLockGuard},
wait_queue::EventWaitQueue,
},
sched::{schedule, SchedMode},
};
use self::{
@ -337,8 +338,9 @@ impl IndexNode for SocketInode {
_offset: usize,
len: usize,
buf: &mut [u8],
_data: SpinLockGuard<FilePrivateData>,
data: SpinLockGuard<FilePrivateData>,
) -> Result<usize, SystemError> {
drop(data);
self.0.lock_no_preempt().read(&mut buf[0..len]).0
}
@ -347,8 +349,9 @@ impl IndexNode for SocketInode {
_offset: usize,
len: usize,
buf: &[u8],
_data: SpinLockGuard<FilePrivateData>,
data: SpinLockGuard<FilePrivateData>,
) -> Result<usize, SystemError> {
drop(data);
self.0.lock_no_preempt().write(&buf[0..len], None)
}
@ -417,7 +420,7 @@ impl SocketHandleItem {
.sleep_without_schedule(events)
};
drop(handle_map_guard);
sched();
schedule(SchedMode::SM_NONE);
}
pub fn shutdown_type(&self) -> ShutdownType {