-
-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch sched rust #139
Patch sched rust #139
Conversation
kernel/src/process/proc-types.h
Outdated
@@ -105,6 +105,7 @@ struct process_control_block | |||
long pid; | |||
long priority; // 优先级 | |||
int64_t virtual_runtime; // 虚拟运行时间 | |||
int64_t time_slice; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改成rt_time_slice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
kernel/src/sched/rt.h
Outdated
* | ||
*/ | ||
void sched_rt_init(struct rt_rq *rt_rq); | ||
void init_rt_rq(struct rt_rq *rt_rq); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些不存在的函数的声明得删掉哦
kernel/src/sched/rt.rs
Outdated
res = self.queue.pop().unwrap(); | ||
} else { | ||
// 如果队列为空,则返回IDLE进程的pcb | ||
res = unsafe { &mut initial_proc_union.pcb }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不用返回IDLE的
kernel/src/sched/rt.rs
Outdated
for i in 0..SchedulerRT::MAX_RT_PRIO { | ||
let cpu_queue_i: &mut RTQueue = self.cpu_queue[i as usize]; | ||
let proc: &'static mut process_control_block = cpu_queue_i.dequeue(); | ||
if proc.policy != SCHED_NORMAL { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不用在这判断
kernel/src/sched/rt.rs
Outdated
} | ||
// curr优先级更大,说明一定是实时进程,则减去消耗时间片 | ||
else { | ||
current_pcb().time_slice -= 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sched_update_jiffies
里面已经更新了时间片了哦
2a92862
to
6958b92
Compare
self.lock.lock(); | ||
if self.queue.len() > 0 { | ||
// 队列不为空,返回下一个要执行的pcb | ||
res = Some(self.queue.pop().unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pop是从队尾弹出的
* Patch sched rust (#139) * update * 添加rt调度器的rust初步实现 * 完善rt调度逻辑 * 调试rt调度器 * 修改sched的返回值 * cargo fmt 格式化 * 删除无用代码,修补rt bug * 删除无用的代码,和重复的逻辑 * 软中断bugfix * 删除一些代码 * 添加kthread_run_rt文档 * 解决sphinix警告_static目录不存在的问题 Co-authored-by: longjin <[email protected]> * Raw spin lock 增加lock_irqsave、unlock_irqrestore(#151) Raw spin lock 增加lock_irqsave、unlock_irqrestore Co-authored-by: kong <[email protected]> Co-authored-by: Gou Ngai <[email protected]>
No description provided.