A simpler test whether to use kernel's default scheduling

- this is a small addition to the userspace scheduling.
  proc_kernel_scheduler() tests whether to use the default scheduling
  policy in kernel. It is true if the process' scheduler is NULL _or_
  self. Currently none of the tests was complete.
This commit is contained in:
Tomas Hruby 2010-04-10 15:19:25 +00:00
parent 485a037563
commit 9fdb773cdb
2 changed files with 10 additions and 6 deletions

View file

@ -129,7 +129,7 @@ not_runnable_pick_new:
* If this process is scheduled by the kernel, we renew it's quantum
* and remove it's RTS_NO_QUANTUM flag.
*/
if (proc_no_quantum(proc_ptr) && (proc_ptr->p_scheduler == NULL)) {
if (proc_no_quantum(proc_ptr) && proc_kernel_scheduler(proc_ptr)) {
/* give new quantum */
proc_ptr->p_ticks_left = proc_ptr->p_quantum_size;
RTS_UNSET(proc_ptr, RTS_NO_QUANTUM);
@ -1355,14 +1355,14 @@ PRIVATE void notify_scheduler(struct proc *p)
* quantum. This is done by sending a message to the scheduler
* on the process's behalf
*/
if (p->p_scheduler == p) {
if (proc_kernel_scheduler(p)) {
/*
* If a scheduler is scheduling itself, and runs out of
* quantum, we don't send a message. The RTS_NO_QUANTUM
* flag will be removed by schedcheck in proc.c.
* If a scheduler is scheduling itself or has no scheduler, and
* runs out of quantum, we don't send a message. The
* RTS_NO_QUANTUM flag will be removed by schedcheck in proc.c.
*/
}
else if (p->p_scheduler != NULL) {
else {
message m_no_quantum;
int err;

View file

@ -148,6 +148,10 @@ struct proc {
#define proc_no_quantum(p) ((p)->p_rts_flags & RTS_NO_QUANTUM)
#define proc_ptr_ok(p) ((p)->p_magic == PMAGIC)
/* test whether the process is scheduled by the kernel's default policy */
#define proc_kernel_scheduler(p) ((p)->p_scheduler == NULL || \
(p)->p_scheduler == (p))
/* Macro to return: on which process is a certain process blocked?
* return endpoint number (can be ANY) or NONE. It's important to
* check RTS_SENDING first, and then RTS_RECEIVING, as they could