SMP - Changed prototype of sys_schedule()
- sys_schedule can change only selected values, -1 means that the current value should be kept unchanged. For instance we mostly want to change the scheduling quantum and priority but we want to keep the process at the current cpu - RS can hand off its processes to scheduler - service can read the destination cpu from system.conf - RS can pass the information farther
This commit is contained in:
@@ -39,6 +39,7 @@ PUBLIC void sched_init(void)
|
||||
parent_e, /* parent_e */
|
||||
USER_Q, /* maxprio */
|
||||
USER_QUANTUM, /* quantum */
|
||||
-1, /* don't change cpu */
|
||||
&trmp->mp_scheduler); /* *newsched_e */
|
||||
if (s != OK) {
|
||||
printf("PM: SCHED denied taking over scheduling of %s: %d\n",
|
||||
|
||||
@@ -50,5 +50,7 @@ EXTERN int shutting_down;
|
||||
|
||||
EXTERN unsigned system_hz;
|
||||
|
||||
EXTERN struct machine machine; /* machine info */
|
||||
|
||||
#endif /* RS_GLO_H */
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) );
|
||||
FORWARD _PROTOTYPE( void sef_cb_signal_handler, (int signo) );
|
||||
FORWARD _PROTOTYPE( int sef_cb_signal_manager, (endpoint_t target, int signo) );
|
||||
|
||||
|
||||
/*===========================================================================*
|
||||
* main *
|
||||
*===========================================================================*/
|
||||
@@ -46,9 +47,13 @@ PUBLIC int main(void)
|
||||
int ipc_status; /* status code */
|
||||
int call_nr, who_e,who_p; /* call number and caller */
|
||||
int result; /* result to return */
|
||||
int s;
|
||||
|
||||
/* SEF local startup. */
|
||||
sef_local_startup();
|
||||
|
||||
if (OK != (s=sys_getmachine(&machine)))
|
||||
panic("couldn't get machine info: %d", s);
|
||||
|
||||
/* Main loop - get work and do it, forever. */
|
||||
while (TRUE) {
|
||||
|
||||
@@ -1361,6 +1361,7 @@ endpoint_t source;
|
||||
rp->r_scheduler = rs_start->rss_scheduler;
|
||||
rp->r_priority = rs_start->rss_priority;
|
||||
rp->r_quantum = rs_start->rss_quantum;
|
||||
rp->r_cpu = rs_start->rss_cpu;
|
||||
}
|
||||
|
||||
/* Update command and arguments. */
|
||||
|
||||
@@ -958,6 +958,18 @@ PRIVATE int check_request(struct rs_start *rs_start)
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (rs_start->rss_cpu == RS_CPU_BSP)
|
||||
rs_start->rss_cpu = machine.bsp_id;
|
||||
else if (rs_start->rss_cpu == RS_CPU_DEFAULT) {
|
||||
/* keep the default value */
|
||||
} else if (rs_start->rss_cpu < 0)
|
||||
return EINVAL;
|
||||
else if (rs_start->rss_cpu > machine.processors_count) {
|
||||
printf("RS: cpu number %d out of range 0-%d, using BSP\n",
|
||||
rs_start->rss_cpu, machine.processors_count);
|
||||
rs_start->rss_cpu = machine.bsp_id;
|
||||
}
|
||||
|
||||
/* Verify signal manager. */
|
||||
if (rs_start->rss_sigmgr != SELF &&
|
||||
(rs_start->rss_sigmgr < 0 ||
|
||||
|
||||
+3
-2
@@ -62,8 +62,9 @@ struct rproc {
|
||||
*/
|
||||
uid_t r_uid;
|
||||
endpoint_t r_scheduler; /* scheduler */
|
||||
unsigned r_priority;
|
||||
unsigned r_quantum;
|
||||
int r_priority; /* negative values are reserved for special meanings */
|
||||
int r_quantum;
|
||||
int r_cpu;
|
||||
|
||||
char r_ipc_list[MAX_IPC_LIST];
|
||||
int r_nr_control;
|
||||
|
||||
@@ -205,7 +205,7 @@ PUBLIC int sched_init_proc(struct rproc *rp)
|
||||
|
||||
/* Start scheduling for the given process. */
|
||||
if ((s = sched_start(rp->r_scheduler, rp->r_pub->endpoint,
|
||||
RS_PROC_NR, rp->r_priority, rp->r_quantum,
|
||||
RS_PROC_NR, rp->r_priority, rp->r_quantum, rp->r_cpu,
|
||||
&rp->r_scheduler)) != OK) {
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ PUBLIC int do_start_scheduling(message *m_ptr)
|
||||
|
||||
/* Take over scheduling the process. The kernel reply message populates
|
||||
* the processes current priority and its time slice */
|
||||
if ((rv = sys_schedctl(0, rmp->endpoint, 0, 0)) != OK) {
|
||||
if ((rv = sys_schedctl(0, rmp->endpoint, 0, 0, 0)) != OK) {
|
||||
printf("Sched: Error taking over scheduling for %d, kernel said %d\n",
|
||||
rmp->endpoint, rv);
|
||||
return rv;
|
||||
@@ -268,7 +268,7 @@ PRIVATE int schedule_process(struct schedproc * rmp)
|
||||
pick_cpu(rmp);
|
||||
|
||||
if ((rv = sys_schedule(rmp->endpoint, rmp->priority,
|
||||
rmp->time_slice)) != OK) {
|
||||
rmp->time_slice, rmp->cpu)) != OK) {
|
||||
printf("SCHED: An error occurred when trying to schedule %d: %d\n",
|
||||
rmp->endpoint, rv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user