Skip to content
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

Merged
merged 24 commits into from
Jan 14, 2023
Merged

Conversation

kkkkkong
Copy link
Collaborator

@kkkkkong kkkkkong commented Jan 6, 2023

No description provided.

@@ -105,6 +105,7 @@ struct process_control_block
long pid;
long priority; // 优先级
int64_t virtual_runtime; // 虚拟运行时间
int64_t time_slice;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改成rt_time_slice

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

*
*/
void sched_rt_init(struct rt_rq *rt_rq);
void init_rt_rq(struct rt_rq *rt_rq);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些不存在的函数的声明得删掉哦

res = self.queue.pop().unwrap();
} else {
// 如果队列为空,则返回IDLE进程的pcb
res = unsafe { &mut initial_proc_union.pcb };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不用返回IDLE的

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不用在这判断

}
// curr优先级更大,说明一定是实时进程,则减去消耗时间片
else {
current_pcb().time_slice -= 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sched_update_jiffies里面已经更新了时间片了哦

self.lock.lock();
if self.queue.len() > 0 {
// 队列不为空,返回下一个要执行的pcb
res = Some(self.queue.pop().unwrap());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pop是从队尾弹出的

@fslongjin fslongjin merged commit 06b09f3 into DragonOS-Community:master Jan 14, 2023
fslongjin added a commit that referenced this pull request Jan 16, 2023
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants