From b694a09a536db693f119e3fee19e91674d49114c Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Wed, 14 May 2014 16:59:14 +0200 Subject: [PATCH] Message type for SCHEDULING_NO_QUANTUM, SYS_SCHEDULE Change-Id: Ia0f2689067159b4d821092d4ac60efa75e396f7c --- include/minix/com.h | 9 --------- include/minix/ipc.h | 27 +++++++++++++++++++++++++++ kernel/proc.c | 14 +++++++------- kernel/system/do_schedule.c | 8 ++++---- lib/libsys/sys_schedule.c | 8 ++++---- 5 files changed, 42 insertions(+), 24 deletions(-) diff --git a/include/minix/com.h b/include/minix/com.h index d20922569..a188b3bb4 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -1000,18 +1000,9 @@ #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 diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 1d3194020..c2e809a19 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -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; diff --git a/kernel/proc.c b/kernel/proc.c index 36c51ce20..3dff67ca5 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -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); diff --git a/kernel/system/do_schedule.c b/kernel/system/do_schedule.c index 799f8064f..272cc29af 100644 --- a/kernel/system/do_schedule.c +++ b/kernel/system/do_schedule.c @@ -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); } diff --git a/lib/libsys/sys_schedule.c b/lib/libsys/sys_schedule.c index 40d5a1ea1..1c25c7e58 100644 --- a/lib/libsys/sys_schedule.c +++ b/lib/libsys/sys_schedule.c @@ -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)); }