-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
feat(sched): add sched_yield #766
Conversation
@zwb0x00: no appropriate reviewer found, use |
kernel/src/syscall/mod.rs
Outdated
@@ -1007,6 +1008,31 @@ impl Syscall { | |||
Self::fchmodat(dirfd, pathname, mode) | |||
} | |||
|
|||
SYS_SCHED_YIELD => { |
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.
感觉将这个封装成一个函数会比较好一点
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.
每个子系统的系统调用,一般是写到对应模块的syscall.rs里面去哈哈,比如sched/syscall.rs
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,了解了
@dragonosbot author |
@dragonosbot ready |
|
||
CompletelyFairScheduler::yield_task(rq); | ||
|
||
pcb.preempt_disable(); |
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.
这里的preempt_disable
和preempt_enable
似乎没有什么必要?,这里已经禁用中断,是不会被时钟中断调度走的,所以我感觉可以不需要这个两个调用。
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.
这里完全参考linux实现,应该是保证在一些特殊情况下也不会被抢占,保证drop(guard)和drop(irq_guard)成功执行。可以暂时先保持原状。
|
||
pcb.preempt_enable(); // sched_preempt_enable_no_resched(); | ||
|
||
schedule(SchedMode::SM_NONE); |
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.
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.
可以的~
@dragonosbot author |
* 实现sched_yield系统调用
issue: #756