]> Zhao Yanbai Git Server - minix.git/commitdiff
Message type for SCHEDULING_NO_QUANTUM, SYS_SCHEDULE
authorLionel Sambuc <lionel@minix3.org>
Wed, 14 May 2014 14:59:14 +0000 (16:59 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:42 +0000 (17:05 +0200)
Change-Id: Ia0f2689067159b4d821092d4ac60efa75e396f7c

include/minix/com.h
include/minix/ipc.h
kernel/proc.c
kernel/system/do_schedule.c
lib/libsys/sys_schedule.c

index d2092256992fa84217e40076e57d2c00c8096e8a..a188b3bb43bb4069e35a4560002168e04ea5f0b3 100644 (file)
 #define SCHEDULING_BASE        0xF00
 
 #define SCHEDULING_NO_QUANTUM  (SCHEDULING_BASE+1)
-#      define SCHEDULING_ACNT_DEQS             m9_l1
-#      define SCHEDULING_ACNT_IPC_SYNC         m9_l2
-#      define SCHEDULING_ACNT_IPC_ASYNC        m9_l3
-#      define SCHEDULING_ACNT_PREEMPT          m9_l4
-#      define SCHEDULING_ACNT_QUEUE            m9_l5
-#      define SCHEDULING_ACNT_CPU              m9_s1
-#      define SCHEDULING_ACNT_CPU_LOAD         m9_s2
 /* These are used for SYS_SCHEDULE, a reply to SCHEDULING_NO_QUANTUM */
 #      define SCHEDULING_ENDPOINT      m9_l1
 #      define SCHEDULING_QUANTUM       m9_l2
-#      define SCHEDULING_PRIORITY      m9_s1
-#      define SCHEDULING_CPU           m9_l4
 
 /*
  * SCHEDULING_START uses _ENDPOINT, _PRIORITY and _QUANTUM from
index 1d319402050bc5be90294d4d3333e61875610d69..c2e809a19e78b2649c0b49cab8bc0752cdfb484e 100644 (file)
@@ -145,6 +145,30 @@ typedef struct {
 } mess_sigcalls;
 _ASSERT_MSG_SIZE(mess_sigcalls);
 
+typedef struct {
+       time_t acnt_queue;
+
+       unsigned long acnt_deqs;
+       unsigned long acnt_ipc_sync;
+       unsigned long acnt_ipc_async;
+       unsigned long acnt_preempt;
+       uint32_t acnt_cpu;
+       uint32_t acnt_cpu_load;
+
+       uint8_t padding[24];
+} mess_krn_lsys_schedule;
+_ASSERT_MSG_SIZE(mess_krn_lsys_schedule);
+
+typedef struct {
+       endpoint_t endpoint;
+       int quantum;
+       int priority;
+       int cpu;
+
+       uint8_t padding[40];
+} mess_lsys_krn_schedule;
+_ASSERT_MSG_SIZE(mess_lsys_krn_schedule);
+
 typedef struct {
        vir_bytes name;
        size_t namelen;
@@ -1117,6 +1141,8 @@ typedef struct {
                mess_notify             m_notify;
                mess_sigcalls           m_sigcalls;
 
+               mess_krn_lsys_schedule  m_krn_lsys_schedule;
+
                mess_fs_vfs_breadwrite  m_fs_vfs_breadwrite;
                mess_fs_vfs_chmod       m_fs_vfs_chmod;
                mess_fs_vfs_chown       m_fs_vfs_chown;
@@ -1173,6 +1199,7 @@ typedef struct {
                mess_lexec_pm_exec_new  m_lexec_pm_exec_new;
 
                mess_lsys_krn_schedctl  m_lsys_krn_schedctl;
+               mess_lsys_krn_schedule  m_lsys_krn_schedule;
 
                mess_lsys_pm_getepinfo  m_lsys_pm_getepinfo;
                mess_lsys_pm_getprocnr  m_lsys_pm_getprocnr;
index 36c51ce20410672879afd961b6bb6d6c96e12e79..3dff67ca562e4c66b6415397121e33be17b4930c 100644 (file)
@@ -1806,13 +1806,13 @@ static void notify_scheduler(struct proc *p)
         */
        m_no_quantum.m_source = p->p_endpoint;
        m_no_quantum.m_type   = SCHEDULING_NO_QUANTUM;
-       m_no_quantum.SCHEDULING_ACNT_QUEUE = cpu_time_2_ms(p->p_accounting.time_in_queue);
-       m_no_quantum.SCHEDULING_ACNT_DEQS      = p->p_accounting.dequeues;
-       m_no_quantum.SCHEDULING_ACNT_IPC_SYNC  = p->p_accounting.ipc_sync;
-       m_no_quantum.SCHEDULING_ACNT_IPC_ASYNC = p->p_accounting.ipc_async;
-       m_no_quantum.SCHEDULING_ACNT_PREEMPT   = p->p_accounting.preempted;
-       m_no_quantum.SCHEDULING_ACNT_CPU       = cpuid;
-       m_no_quantum.SCHEDULING_ACNT_CPU_LOAD  = cpu_load();
+       m_no_quantum.m_krn_lsys_schedule.acnt_queue = cpu_time_2_ms(p->p_accounting.time_in_queue);
+       m_no_quantum.m_krn_lsys_schedule.acnt_deqs      = p->p_accounting.dequeues;
+       m_no_quantum.m_krn_lsys_schedule.acnt_ipc_sync  = p->p_accounting.ipc_sync;
+       m_no_quantum.m_krn_lsys_schedule.acnt_ipc_async = p->p_accounting.ipc_async;
+       m_no_quantum.m_krn_lsys_schedule.acnt_preempt   = p->p_accounting.preempted;
+       m_no_quantum.m_krn_lsys_schedule.acnt_cpu       = cpuid;
+       m_no_quantum.m_krn_lsys_schedule.acnt_cpu_load  = cpu_load();
 
        /* Reset accounting */
        reset_proc_accounting(p);
index 799f8064fde84b1a0f959b24a4a29f4e58468849..272cc29af9f4e97c382ec0eb5f85916cf2d5ade3 100644 (file)
@@ -11,7 +11,7 @@ int do_schedule(struct proc * caller, message * m_ptr)
        int proc_nr;
        int priority, quantum, cpu;
 
-       if (!isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr))
+       if (!isokendpt(m_ptr->m_lsys_krn_schedule.endpoint, &proc_nr))
                return EINVAL;
 
        p = proc_addr(proc_nr);
@@ -21,9 +21,9 @@ int do_schedule(struct proc * caller, message * m_ptr)
                return(EPERM);
 
        /* Try to schedule the process. */
-       priority = (int) m_ptr->SCHEDULING_PRIORITY;
-       quantum = (int) m_ptr->SCHEDULING_QUANTUM;
-       cpu = (int) m_ptr->SCHEDULING_CPU;
+       priority = m_ptr->m_lsys_krn_schedule.priority;
+       quantum = m_ptr->m_lsys_krn_schedule.quantum;
+       cpu = m_ptr->m_lsys_krn_schedule.cpu;
 
        return sched_proc(p, priority, quantum, cpu);
 }
index 40d5a1ea13adbd70b7e5a7d9cf5d5fbc50dadc40..1c25c7e587e4880e5dd58009bbc3412d3cd21f52 100644 (file)
@@ -7,9 +7,9 @@ int sys_schedule(endpoint_t proc_ep,
 {
        message m;
 
-       m.SCHEDULING_ENDPOINT = proc_ep;
-       m.SCHEDULING_PRIORITY = priority;
-       m.SCHEDULING_QUANTUM  = quantum;
-       m.SCHEDULING_CPU = cpu;
+       m.m_lsys_krn_schedule.endpoint = proc_ep;
+       m.m_lsys_krn_schedule.priority = priority;
+       m.m_lsys_krn_schedule.quantum  = quantum;
+       m.m_lsys_krn_schedule.cpu = cpu;
        return(_kernel_call(SYS_SCHEDULE, &m));
 }