User-space scheduling for system processes
This commit is contained in:
@@ -86,14 +86,8 @@ PUBLIC int do_fork(struct proc * caller, message * m_ptr)
|
||||
rpc->p_virt_left = 0; /* disable, clear the process-virtual timers */
|
||||
rpc->p_prof_left = 0;
|
||||
|
||||
/*
|
||||
* if the child process inherited a scheduler, the child process is not
|
||||
* runnable until it's scheduled. Otherwise the default kernel policy applies.
|
||||
* This is only the case of system servers, drivers and similar sensitive
|
||||
* processes
|
||||
*/
|
||||
if (rpc->p_scheduler)
|
||||
RTS_SET(rpc, RTS_NO_QUANTUM);
|
||||
/* the child process is not runnable until it's scheduled. */
|
||||
RTS_SET(rpc, RTS_NO_QUANTUM);
|
||||
|
||||
make_zero64(rpc->p_cpu_time_left);
|
||||
make_zero64(rpc->p_cycles);
|
||||
|
||||
@@ -7,17 +7,37 @@
|
||||
PUBLIC int do_schedctl(struct proc * caller, message * m_ptr)
|
||||
{
|
||||
struct proc *p;
|
||||
unsigned flags;
|
||||
int proc_nr;
|
||||
|
||||
/* Only system processes can change process schedulers */
|
||||
if (! (priv(caller)->s_flags & SYS_PROC))
|
||||
return(EPERM);
|
||||
|
||||
if (!isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr))
|
||||
/* check parameter validity */
|
||||
flags = (unsigned) m_ptr->SCHEDCTL_FLAGS;
|
||||
if (flags & ~SCHEDCTL_FLAG_KERNEL) {
|
||||
printf("do_schedctl: flags 0x%x invalid, caller=%d\n",
|
||||
flags, caller - proc);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (!isokendpt(m_ptr->SCHEDCTL_ENDPOINT, &proc_nr))
|
||||
return EINVAL;
|
||||
|
||||
p = proc_addr(proc_nr);
|
||||
p->p_scheduler = caller;
|
||||
|
||||
if ((flags & SCHEDCTL_FLAG_KERNEL) == SCHEDCTL_FLAG_KERNEL) {
|
||||
/* the kernel becomes the scheduler and starts
|
||||
* scheduling the process; RTS_NO_QUANTUM which was
|
||||
* previously set by sys_fork is removed
|
||||
*/
|
||||
p->p_scheduler = NULL;
|
||||
RTS_UNSET(p, RTS_NO_QUANTUM);
|
||||
} else {
|
||||
/* the caller becomes the scheduler */
|
||||
p->p_scheduler = caller;
|
||||
}
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user