]> Zhao Yanbai Git Server - minix.git/commitdiff
Message type for SCHEDULING_{START,INHERIT}
authorLionel Sambuc <lionel@minix3.org>
Wed, 14 May 2014 15:57:12 +0000 (17:57 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:43 +0000 (17:05 +0200)
Change-Id: Iad2b4079f72488ea3c3abef2b4a4fefe26ae9066

include/minix/com.h
include/minix/ipc.h
lib/libsys/sched_start.c
servers/sched/schedule.c

index a188b3bb43bb4069e35a4560002168e04ea5f0b3..fb432750c56981d63913413d66a561b86db1f2cf 100644 (file)
 #define SCHEDULING_NO_QUANTUM  (SCHEDULING_BASE+1)
 /* These are used for SYS_SCHEDULE, a reply to SCHEDULING_NO_QUANTUM */
 #      define SCHEDULING_ENDPOINT      m9_l1
-#      define SCHEDULING_QUANTUM       m9_l2
-
-/*
- * SCHEDULING_START uses _ENDPOINT, _PRIORITY and _QUANTUM from
- * SCHEDULING_NO_QUANTUM/SYS_SCHEDULE
- */
 #define SCHEDULING_START       (SCHEDULING_BASE+2)
-#      define SCHEDULING_SCHEDULER     m9_l1 /* Overrides _ENDPOINT on return*/
-#      define SCHEDULING_PARENT        m9_l3
 #      define SCHEDULING_MAXPRIO       m9_l4
-
 #define SCHEDULING_STOP                (SCHEDULING_BASE+3)
-
 #define SCHEDULING_SET_NICE    (SCHEDULING_BASE+4)
-
-/* SCHEDULING_INHERIT is like SCHEDULING_START, but without _QUANTUM field */
 #define SCHEDULING_INHERIT     (SCHEDULING_BASE+5)
 
 /*===========================================================================*
index c2e809a19e78b2649c0b49cab8bc0752cdfb484e..69f8b29ed96a1911f1d0f35774e652563c0ff1aa 100644 (file)
@@ -635,6 +635,23 @@ typedef struct {
 } mess_lsys_pm_srv_fork;
 _ASSERT_MSG_SIZE(mess_lsys_pm_srv_fork);
 
+typedef struct {
+       endpoint_t endpoint;
+       endpoint_t parent;
+       int maxprio;
+       int quantum;
+
+       uint8_t padding[40];
+} mess_lsys_sched_scheduling_start;
+_ASSERT_MSG_SIZE(mess_lsys_sched_scheduling_start);
+
+typedef struct {
+       endpoint_t scheduler;
+
+       uint8_t padding[52];
+} mess_sched_lsys_scheduling_start;
+_ASSERT_MSG_SIZE(mess_sched_lsys_scheduling_start);
+
 typedef struct {
        endpoint_t endpt;
        cp_grant_id_t grant;
@@ -1205,6 +1222,8 @@ typedef struct {
                mess_lsys_pm_getprocnr  m_lsys_pm_getprocnr;
                mess_lsys_pm_srv_fork   m_lsys_pm_srv_fork;
 
+               mess_lsys_sched_scheduling_start m_lsys_sched_scheduling_start;
+
                mess_lsys_vfs_checkperms m_lsys_vfs_checkperms;
                mess_lsys_vfs_copyfd    m_lsys_vfs_copyfd;
                mess_lsys_vfs_mapdriver m_lsys_vfs_mapdriver;
@@ -1225,6 +1244,8 @@ typedef struct {
                mess_rs_pm_exec_restart m_rs_pm_exec_restart;
                mess_rs_pm_srv_kill     m_rs_pm_srv_kill;
 
+               mess_sched_lsys_scheduling_start m_sched_lsys_scheduling_start;
+
                mess_vfs_fs_breadwrite  m_vfs_fs_breadwrite;
                mess_vfs_fs_chmod       m_vfs_fs_chmod;
                mess_vfs_fs_chown       m_vfs_fs_chown;
index 7017047b34dfe9a4bee4dda974566638aca19279..1cd2e510e65b174b1024dd1afa0f5a62e0aa60cc 100644 (file)
@@ -26,9 +26,9 @@ int sched_inherit(endpoint_t scheduler_e,
        assert(newscheduler_e);
 
        memset(&m, 0, sizeof(m));
-       m.SCHEDULING_ENDPOINT   = schedulee_e;
-       m.SCHEDULING_PARENT     = parent_e;
-       m.SCHEDULING_MAXPRIO    = (int) maxprio;
+       m.m_lsys_sched_scheduling_start.endpoint        = schedulee_e;
+       m.m_lsys_sched_scheduling_start.parent          = parent_e;
+       m.m_lsys_sched_scheduling_start.maxprio         = maxprio;
 
        /* Send the request to the scheduler */
        if ((rv = _taskcall(scheduler_e, SCHEDULING_INHERIT, &m))) {
@@ -40,7 +40,7 @@ int sched_inherit(endpoint_t scheduler_e,
         * might have forwarded the scheduling message on to another scheduler
         * before returning the message.
         */
-       *newscheduler_e = m.SCHEDULING_SCHEDULER;
+       *newscheduler_e = m.m_sched_lsys_scheduling_start.scheduler;
        return (OK);
 }
 
@@ -82,10 +82,10 @@ int sched_start(endpoint_t scheduler_e,
 
        /* A user-space scheduler must schedule this process. */
        memset(&m, 0, sizeof(m));
-       m.SCHEDULING_ENDPOINT   = schedulee_e;
-       m.SCHEDULING_PARENT     = parent_e;
-       m.SCHEDULING_MAXPRIO    = (int) maxprio;
-       m.SCHEDULING_QUANTUM    = (int) quantum;
+       m.m_lsys_sched_scheduling_start.endpoint        = schedulee_e;
+       m.m_lsys_sched_scheduling_start.parent          = parent_e;
+       m.m_lsys_sched_scheduling_start.maxprio         = maxprio;
+       m.m_lsys_sched_scheduling_start.quantum         = quantum;
 
        /* Send the request to the scheduler */
        if ((rv = _taskcall(scheduler_e, SCHEDULING_START, &m))) {
@@ -97,6 +97,6 @@ int sched_start(endpoint_t scheduler_e,
         * might have forwarded the scheduling message on to another scheduler
         * before returning the message.
         */
-       *newscheduler_e = m.SCHEDULING_SCHEDULER;
+       *newscheduler_e = m.m_sched_lsys_scheduling_start.scheduler;
        return (OK);
 }
index 1a01436a376b4b6f69211cce6396bec552b24c9c..fd5e04931e2f9b3a57b108b87fa7cb8d4fa6aa57 100644 (file)
@@ -153,16 +153,16 @@ int do_start_scheduling(message *m_ptr)
                return EPERM;
 
        /* Resolve endpoint to proc slot. */
-       if ((rv = sched_isemtyendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr_n))
-                       != OK) {
+       if ((rv = sched_isemtyendpt(m_ptr->m_lsys_sched_scheduling_start.endpoint,
+                       &proc_nr_n)) != OK) {
                return rv;
        }
        rmp = &schedproc[proc_nr_n];
 
        /* Populate process slot */
-       rmp->endpoint     = m_ptr->SCHEDULING_ENDPOINT;
-       rmp->parent       = m_ptr->SCHEDULING_PARENT;
-       rmp->max_priority = (unsigned) m_ptr->SCHEDULING_MAXPRIO;
+       rmp->endpoint     = m_ptr->m_lsys_sched_scheduling_start.endpoint;
+       rmp->parent       = m_ptr->m_lsys_sched_scheduling_start.parent;
+       rmp->max_priority = m_ptr->m_lsys_sched_scheduling_start.maxprio;
        if (rmp->max_priority >= NR_SCHED_QUEUES) {
                return EINVAL;
        }
@@ -195,14 +195,14 @@ int do_start_scheduling(message *m_ptr)
                 * quanum and priority are set explicitly rather than inherited 
                 * from the parent */
                rmp->priority   = rmp->max_priority;
-               rmp->time_slice = (unsigned) m_ptr->SCHEDULING_QUANTUM;
+               rmp->time_slice = m_ptr->m_lsys_sched_scheduling_start.quantum;
                break;
                
        case SCHEDULING_INHERIT:
                /* Inherit current priority and time slice from parent. Since there
                 * is currently only one scheduler scheduling the whole system, this
                 * value is local and we assert that the parent endpoint is valid */
-               if ((rv = sched_isokendpt(m_ptr->SCHEDULING_PARENT,
+               if ((rv = sched_isokendpt(m_ptr->m_lsys_sched_scheduling_start.parent,
                                &parent_nr_n)) != OK)
                        return rv;
 
@@ -242,10 +242,10 @@ int do_start_scheduling(message *m_ptr)
         * By default, processes are scheduled by the parents scheduler. In case
         * this scheduler would want to delegate scheduling to another
         * scheduler, it could do so and then write the endpoint of that
-        * scheduler into SCHEDULING_SCHEDULER
+        * scheduler into the "scheduler" field.
         */
 
-       m_ptr->SCHEDULING_SCHEDULER = SCHED_PROC_NR;
+       m_ptr->m_sched_lsys_scheduling_start.scheduler = SCHED_PROC_NR;
 
        return OK;
 }