Restructure and simplyfycation of the scheduling code in PM a little bit.
- It introduces schedule_process() which makes a kernel call to set the scheduling parameters of a process. It is used in the next patch.
This commit is contained in:
parent
512058ca98
commit
1a31d158ad
|
@ -455,8 +455,7 @@ PUBLIC int do_getsetpriority()
|
||||||
if (new_q > MIN_USER_Q) new_q = MIN_USER_Q; /* shouldn't happen */
|
if (new_q > MIN_USER_Q) new_q = MIN_USER_Q; /* shouldn't happen */
|
||||||
|
|
||||||
rmp->mp_max_priority = rmp->mp_priority = new_q;
|
rmp->mp_max_priority = rmp->mp_priority = new_q;
|
||||||
if ((r = sys_schedule(rmp->mp_priority, rmp->mp_priority,
|
if ((r = schedule_process(rmp)))
|
||||||
rmp->mp_time_slice)) != OK)
|
|
||||||
return(r);
|
return(r);
|
||||||
|
|
||||||
rmp->mp_nice = arg_pri;
|
rmp->mp_nice = arg_pri;
|
||||||
|
|
|
@ -61,6 +61,7 @@ _PROTOTYPE( int do_svrctl, (void) );
|
||||||
_PROTOTYPE( int do_getsetpriority, (void) );
|
_PROTOTYPE( int do_getsetpriority, (void) );
|
||||||
|
|
||||||
/* schedule.c */
|
/* schedule.c */
|
||||||
|
_PROTOTYPE( int schedule_process, (struct mproc * rmp) );
|
||||||
_PROTOTYPE( void do_noquantum, (void) );
|
_PROTOTYPE( void do_noquantum, (void) );
|
||||||
_PROTOTYPE( void overtake_scheduling, (void) );
|
_PROTOTYPE( void overtake_scheduling, (void) );
|
||||||
_PROTOTYPE( void balance_queues, (struct timer *tp) );
|
_PROTOTYPE( void balance_queues, (struct timer *tp) );
|
||||||
|
|
|
@ -11,6 +11,23 @@
|
||||||
|
|
||||||
PRIVATE timer_t sched_timer;
|
PRIVATE timer_t sched_timer;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* makes a kernel call that schedules the process using the actuall scheduling
|
||||||
|
* parameters set for this process
|
||||||
|
*/
|
||||||
|
PUBLIC int schedule_process(struct mproc * rmp)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if ((err = sys_schedule(rmp->mp_endpoint, rmp->mp_priority,
|
||||||
|
rmp->mp_time_slice)) != OK) {
|
||||||
|
printf("PM: An error occurred when trying to schedule %s: %d\n",
|
||||||
|
rmp->mp_name, err);
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* do_noquantum *
|
* do_noquantum *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
@ -31,11 +48,7 @@ PUBLIC void do_noquantum(void)
|
||||||
rmp->mp_priority += 1; /* lower priority */
|
rmp->mp_priority += 1; /* lower priority */
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rv = sys_schedule(rmp->mp_endpoint, rmp->mp_priority,
|
schedule_process(rmp);
|
||||||
rmp->mp_time_slice))) {
|
|
||||||
printf("PM: An error occurred when trying to schedule %s: %d\n",
|
|
||||||
rmp->mp_name, rv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
|
@ -77,12 +90,7 @@ struct timer *tp;
|
||||||
if (rmp->mp_flags & IN_USE) {
|
if (rmp->mp_flags & IN_USE) {
|
||||||
if (rmp->mp_priority > rmp->mp_max_priority) {
|
if (rmp->mp_priority > rmp->mp_max_priority) {
|
||||||
rmp->mp_priority -= 1; /* increase priority */
|
rmp->mp_priority -= 1; /* increase priority */
|
||||||
if ((rv = sys_schedule(rmp->mp_endpoint,
|
schedule_process(rmp);
|
||||||
rmp->mp_priority,
|
|
||||||
rmp->mp_time_slice))) {
|
|
||||||
printf("PM: An error occurred when balancing %s: %d\n",
|
|
||||||
rmp->mp_name, rv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue