Scheduling parameters out of the kernel.

This commit is contained in:
Cristiano Giuffrida
2010-07-13 15:30:17 +00:00
parent d4e41fd1f6
commit 8cedace2f5
26 changed files with 196 additions and 156 deletions

View File

@@ -9,6 +9,7 @@ PUBLIC int do_schedule(struct proc * caller, message * m_ptr)
{
struct proc *p;
int proc_nr;
unsigned priority, quantum;
if (!isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr))
return EINVAL;
@@ -19,24 +20,8 @@ PUBLIC int do_schedule(struct proc * caller, message * m_ptr)
if (caller != p->p_scheduler)
return(EPERM);
/* Make sure the priority number given is within the allowed range.*/
if (m_ptr->SCHEDULING_PRIORITY < TASK_Q ||
m_ptr->SCHEDULING_PRIORITY > NR_SCHED_QUEUES)
return(EINVAL);
/* In some cases, we might be rescheduling a runnable process. In such
* a case (i.e. if we are updating the priority) we set the NO_QUANTUM
* flag before the generic unset to dequeue/enqueue the process
*/
if (proc_is_runnable(p))
RTS_SET(p, RTS_NO_QUANTUM);
/* Clear the scheduling bit and enqueue the process */
p->p_priority = m_ptr->SCHEDULING_PRIORITY;
p->p_quantum_size_ms = m_ptr->SCHEDULING_QUANTUM;
p->p_cpu_time_left = ms_2_cpu_time(m_ptr->SCHEDULING_QUANTUM);
RTS_UNSET(p, RTS_NO_QUANTUM);
return(OK);
/* Try to schedule the process. */
priority = (unsigned) m_ptr->SCHEDULING_PRIORITY;
quantum = (unsigned) m_ptr->SCHEDULING_QUANTUM;
return sched_proc(p, priority, quantum);
}