PM remembers what it should schedule

- while PM implements fork also for RS it needs to remember what to
  schedule and what not. PM_SCHEDULED flag serves this purpose.

- PM only schedules processes that are descendaints of init, i.e. normal
  user processes

- after a process is forked PM schedules for the first time only
  processes that have PM_SCHEDULED set. The others are handled iether
  by kernel or some other scheduler
This commit is contained in:
Tomas Hruby 2010-04-13 10:45:08 +00:00
parent 5f7c37bb84
commit 86378ff645
4 changed files with 5 additions and 2 deletions

View file

@ -92,7 +92,7 @@ PUBLIC int do_fork()
sigemptyset(&rmc->mp_sigtrace);
}
/* Inherit only these flags. In normal fork(), PRIV_PROC is not inherited. */
rmc->mp_flags &= (IN_USE|DELAY_CALL);
rmc->mp_flags &= (IN_USE|DELAY_CALL|PM_SCHEDULED);
rmc->mp_child_utime = 0; /* reset administration */
rmc->mp_child_stime = 0; /* reset administration */
rmc->mp_exitstatus = 0;

View file

@ -505,7 +505,8 @@ PRIVATE void handle_fs_reply()
case PM_FORK_REPLY:
/* Schedule the newly created process ... */
schedule_process(rmp);
if (rmp->mp_flags & PM_SCHEDULED)
schedule_process(rmp);
/* ... and wake it up */
setreply(proc_n, OK);

View file

@ -82,6 +82,7 @@ EXTERN struct mproc {
#define TRACE_EXIT 0x08000 /* tracer is forcing this process to exit */
#define TRACE_ZOMBIE 0x10000 /* waiting for tracer to issue WAIT call */
#define DELAY_CALL 0x20000 /* waiting for call before sending signal */
#define PM_SCHEDULED 0x40000 /* this process is scheduled by PM */
#define NIL_MPROC ((struct mproc *) 0)

View file

@ -69,6 +69,7 @@ PUBLIC void overtake_scheduling(void)
if (sys_schedctl(trmp->mp_endpoint))
printf("PM: Error while overtaking scheduling for %s\n",
trmp->mp_name);
trmp->mp_flags |= PM_SCHEDULED;
}
}