From: Tomas Hruby Date: Tue, 13 Apr 2010 10:45:08 +0000 (+0000) Subject: PM remembers what it should schedule X-Git-Tag: v3.1.7~150 X-Git-Url: http://zhaoyanbai.com/repos/?a=commitdiff_plain;h=86378ff645f2ca1fec97764e1adda649ad7fcba2;p=minix.git 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 --- diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index 3406296c2..17a8c9f8d 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -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; diff --git a/servers/pm/main.c b/servers/pm/main.c index 2fdafbb93..41d3c4106 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -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); diff --git a/servers/pm/mproc.h b/servers/pm/mproc.h index 358e93e50..bb4cbf7bb 100644 --- a/servers/pm/mproc.h +++ b/servers/pm/mproc.h @@ -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) diff --git a/servers/pm/schedule.c b/servers/pm/schedule.c index 590ce45d2..2f6ee3d24 100644 --- a/servers/pm/schedule.c +++ b/servers/pm/schedule.c @@ -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; } }