2009-11-22 22:09:15 +03:00
|
|
|
/* $NetBSD: sched_m2.c,v 1.29 2009/11/22 19:09:16 mbalmer Exp $ */
|
2007-10-09 23:00:13 +04:00
|
|
|
|
|
|
|
/*
|
2008-01-15 06:37:10 +03:00
|
|
|
* Copyright (c) 2007, 2008 Mindaugas Rasiukevicius <rmind at NetBSD org>
|
2007-11-28 22:30:55 +03:00
|
|
|
* All rights reserved.
|
2007-10-09 23:00:13 +04:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
2008-01-31 03:46:55 +03:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
2007-10-09 23:00:13 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO:
|
|
|
|
* - Implementation of fair share queue;
|
|
|
|
* - Support for NUMA;
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
2009-11-22 22:09:15 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: sched_m2.c,v 1.29 2009/11/22 19:09:16 mbalmer Exp $");
|
2007-10-09 23:00:13 +04:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
|
|
|
#include <sys/cpu.h>
|
|
|
|
#include <sys/callout.h>
|
|
|
|
#include <sys/errno.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/kmem.h>
|
|
|
|
#include <sys/lwp.h>
|
|
|
|
#include <sys/mutex.h>
|
|
|
|
#include <sys/pool.h>
|
|
|
|
#include <sys/proc.h>
|
2008-01-15 06:37:10 +03:00
|
|
|
#include <sys/pset.h>
|
2007-10-09 23:00:13 +04:00
|
|
|
#include <sys/resource.h>
|
|
|
|
#include <sys/resourcevar.h>
|
|
|
|
#include <sys/sched.h>
|
|
|
|
#include <sys/syscallargs.h>
|
|
|
|
#include <sys/sysctl.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
/*
|
2007-11-06 03:42:39 +03:00
|
|
|
* Priority related defintions.
|
2007-10-09 23:00:13 +04:00
|
|
|
*/
|
2007-11-06 03:42:39 +03:00
|
|
|
#define PRI_TS_COUNT (NPRI_USER)
|
|
|
|
#define PRI_RT_COUNT (PRI_COUNT - PRI_TS_COUNT)
|
|
|
|
#define PRI_HTS_RANGE (PRI_TS_COUNT / 10)
|
2007-10-09 23:00:13 +04:00
|
|
|
|
2007-11-07 06:07:14 +03:00
|
|
|
#define PRI_HIGHEST_TS (MAXPRI_USER)
|
2007-11-06 03:42:39 +03:00
|
|
|
|
2007-10-09 23:00:13 +04:00
|
|
|
/*
|
|
|
|
* Time-slices and priorities.
|
|
|
|
*/
|
|
|
|
static u_int min_ts; /* Minimal time-slice */
|
|
|
|
static u_int max_ts; /* Maximal time-slice */
|
|
|
|
static u_int rt_ts; /* Real-time time-slice */
|
|
|
|
static u_int ts_map[PRI_COUNT]; /* Map of time-slices */
|
|
|
|
static pri_t high_pri[PRI_COUNT]; /* Map for priority increase */
|
|
|
|
|
2008-05-19 16:48:54 +04:00
|
|
|
static void sched_precalcts(void);
|
|
|
|
|
2007-10-09 23:00:13 +04:00
|
|
|
/*
|
|
|
|
* Initialization and setup.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
sched_rqinit(void)
|
|
|
|
{
|
|
|
|
struct cpu_info *ci = curcpu();
|
|
|
|
|
|
|
|
if (hz < 100) {
|
|
|
|
panic("sched_rqinit: value of HZ is too low\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Default timing ranges */
|
2008-10-07 13:48:27 +04:00
|
|
|
min_ts = mstohz(20); /* ~20 ms */
|
|
|
|
max_ts = mstohz(150); /* ~150 ms */
|
|
|
|
rt_ts = mstohz(100); /* ~100 ms */
|
2007-10-09 23:00:13 +04:00
|
|
|
sched_precalcts();
|
|
|
|
|
|
|
|
/* Attach the primary CPU here */
|
|
|
|
sched_cpuattach(ci);
|
|
|
|
|
2007-11-06 03:42:39 +03:00
|
|
|
sched_lwp_fork(NULL, &lwp0);
|
2007-10-09 23:00:13 +04:00
|
|
|
sched_newts(&lwp0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Pre-calculate the time-slices for the priorities */
|
|
|
|
static void
|
|
|
|
sched_precalcts(void)
|
|
|
|
{
|
|
|
|
pri_t p;
|
|
|
|
|
2007-11-06 03:42:39 +03:00
|
|
|
/* Time-sharing range */
|
|
|
|
for (p = 0; p <= PRI_HIGHEST_TS; p++) {
|
|
|
|
ts_map[p] = max_ts -
|
|
|
|
(p * 100 / (PRI_TS_COUNT - 1) * (max_ts - min_ts) / 100);
|
|
|
|
high_pri[p] = (PRI_HIGHEST_TS - PRI_HTS_RANGE) +
|
|
|
|
((p * PRI_HTS_RANGE) / (PRI_TS_COUNT - 1));
|
2007-10-09 23:00:13 +04:00
|
|
|
}
|
|
|
|
|
2007-11-06 03:42:39 +03:00
|
|
|
/* Real-time range */
|
|
|
|
for (p = (PRI_HIGHEST_TS + 1); p < PRI_COUNT; p++) {
|
|
|
|
ts_map[p] = rt_ts;
|
|
|
|
high_pri[p] = p;
|
2007-10-09 23:00:13 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Hooks.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
sched_proc_fork(struct proc *parent, struct proc *child)
|
|
|
|
{
|
|
|
|
struct lwp *l;
|
|
|
|
|
|
|
|
LIST_FOREACH(l, &child->p_lwps, l_sibling) {
|
|
|
|
lwp_lock(l);
|
|
|
|
sched_newts(l);
|
|
|
|
lwp_unlock(l);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
sched_proc_exit(struct proc *child, struct proc *parent)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2007-11-06 03:42:39 +03:00
|
|
|
sched_lwp_fork(struct lwp *l1, struct lwp *l2)
|
2007-10-09 23:00:13 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-11-06 03:42:39 +03:00
|
|
|
void
|
|
|
|
sched_lwp_collect(struct lwp *l)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-10-09 23:00:13 +04:00
|
|
|
void
|
|
|
|
sched_setrunnable(struct lwp *l)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
sched_schedclock(struct lwp *l)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Priorities and time-slice.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
sched_nice(struct proc *p, int prio)
|
|
|
|
{
|
2008-10-18 07:44:04 +04:00
|
|
|
struct lwp *l;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
KASSERT(mutex_owned(p->p_lock));
|
|
|
|
|
|
|
|
p->p_nice = prio;
|
|
|
|
n = (prio - NZERO) >> 2;
|
|
|
|
if (n == 0)
|
|
|
|
return;
|
2007-10-09 23:00:13 +04:00
|
|
|
|
2008-10-18 07:44:04 +04:00
|
|
|
LIST_FOREACH(l, &p->p_lwps, l_sibling) {
|
|
|
|
lwp_lock(l);
|
|
|
|
if (l->l_class == SCHED_OTHER) {
|
|
|
|
pri_t pri = l->l_priority - n;
|
|
|
|
pri = (n < 0) ? min(pri, PRI_HIGHEST_TS) : imax(pri, 0);
|
|
|
|
lwp_changepri(l, pri);
|
|
|
|
}
|
|
|
|
lwp_unlock(l);
|
|
|
|
}
|
2007-10-09 23:00:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Recalculate the time-slice */
|
2008-04-12 21:02:08 +04:00
|
|
|
void
|
2007-10-09 23:00:13 +04:00
|
|
|
sched_newts(struct lwp *l)
|
|
|
|
{
|
|
|
|
|
2008-10-07 13:48:27 +04:00
|
|
|
l->l_sched.timeslice = ts_map[lwp_eprio(l)];
|
2007-10-09 23:00:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
sched_slept(struct lwp *l)
|
|
|
|
{
|
|
|
|
|
|
|
|
/*
|
2007-11-06 03:42:39 +03:00
|
|
|
* If thread is in time-sharing queue and batch flag is not marked,
|
2009-11-22 22:09:15 +03:00
|
|
|
* increase the priority, and run with the lower time-quantum.
|
2007-10-09 23:00:13 +04:00
|
|
|
*/
|
2008-05-19 16:48:54 +04:00
|
|
|
if (l->l_priority < PRI_HIGHEST_TS && (l->l_flag & LW_BATCH) == 0) {
|
2008-10-18 07:44:04 +04:00
|
|
|
struct proc *p = l->l_proc;
|
|
|
|
|
2007-11-06 03:42:39 +03:00
|
|
|
KASSERT(l->l_class == SCHED_OTHER);
|
2008-10-18 07:44:04 +04:00
|
|
|
if (__predict_false(p->p_nice < NZERO)) {
|
|
|
|
const int n = max((NZERO - p->p_nice) >> 2, 1);
|
|
|
|
l->l_priority = min(l->l_priority + n, PRI_HIGHEST_TS);
|
|
|
|
} else {
|
|
|
|
l->l_priority++;
|
|
|
|
}
|
2007-11-06 03:42:39 +03:00
|
|
|
}
|
2007-10-09 23:00:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
sched_wakeup(struct lwp *l)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* If thread was sleeping a second or more - set a high priority */
|
2008-05-19 16:48:54 +04:00
|
|
|
if (l->l_slptime >= 1)
|
2007-11-06 03:42:39 +03:00
|
|
|
l->l_priority = high_pri[l->l_priority];
|
2007-10-09 23:00:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-05-19 16:48:54 +04:00
|
|
|
sched_pstats_hook(struct lwp *l, int batch)
|
2007-10-09 23:00:13 +04:00
|
|
|
{
|
2007-11-07 06:07:14 +03:00
|
|
|
pri_t prio;
|
2007-10-09 23:00:13 +04:00
|
|
|
|
2008-03-11 21:18:49 +03:00
|
|
|
/*
|
|
|
|
* Estimate threads on time-sharing queue only, however,
|
|
|
|
* exclude the highest priority for performance purposes.
|
|
|
|
*/
|
2008-10-07 13:48:27 +04:00
|
|
|
KASSERT(lwp_locked(l, NULL));
|
2007-11-06 03:42:39 +03:00
|
|
|
if (l->l_priority >= PRI_HIGHEST_TS)
|
2007-10-09 23:00:13 +04:00
|
|
|
return;
|
2008-01-15 07:16:27 +03:00
|
|
|
KASSERT(l->l_class == SCHED_OTHER);
|
2007-10-09 23:00:13 +04:00
|
|
|
|
2007-11-06 03:42:39 +03:00
|
|
|
/* If it is CPU-bound not a first time - decrease the priority */
|
2007-11-07 06:07:14 +03:00
|
|
|
prio = l->l_priority;
|
|
|
|
if (batch && prio != 0)
|
|
|
|
prio--;
|
2007-11-06 03:42:39 +03:00
|
|
|
|
2007-10-09 23:00:13 +04:00
|
|
|
/* If thread was not ran a second or more - set a high priority */
|
2007-11-07 06:07:14 +03:00
|
|
|
if (l->l_stat == LSRUN) {
|
2008-05-19 16:48:54 +04:00
|
|
|
if (l->l_rticks && (hardclock_ticks - l->l_rticks >= hz))
|
2007-11-07 06:07:14 +03:00
|
|
|
prio = high_pri[prio];
|
|
|
|
/* Re-enqueue the thread if priority has changed */
|
|
|
|
if (prio != l->l_priority)
|
|
|
|
lwp_changepri(l, prio);
|
|
|
|
} else {
|
|
|
|
/* In other states, change the priority directly */
|
|
|
|
l->l_priority = prio;
|
|
|
|
}
|
2007-10-09 23:00:13 +04:00
|
|
|
}
|
|
|
|
|
2008-04-12 21:02:08 +04:00
|
|
|
void
|
|
|
|
sched_oncpu(lwp_t *l)
|
2007-10-09 23:00:13 +04:00
|
|
|
{
|
2008-10-07 13:48:27 +04:00
|
|
|
struct schedstate_percpu *spc = &l->l_cpu->ci_schedstate;
|
2007-10-09 23:00:13 +04:00
|
|
|
|
|
|
|
/* Update the counters */
|
2008-10-07 13:48:27 +04:00
|
|
|
KASSERT(l->l_sched.timeslice >= min_ts);
|
|
|
|
KASSERT(l->l_sched.timeslice <= max_ts);
|
|
|
|
spc->spc_ticks = l->l_sched.timeslice;
|
2007-10-09 23:00:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Time-driven events.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called once per time-quantum. This routine is CPU-local and runs at
|
|
|
|
* IPL_SCHED, thus the locking is not needed.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
sched_tick(struct cpu_info *ci)
|
|
|
|
{
|
|
|
|
struct schedstate_percpu *spc = &ci->ci_schedstate;
|
|
|
|
struct lwp *l = curlwp;
|
2008-10-18 07:44:04 +04:00
|
|
|
struct proc *p;
|
2007-10-09 23:00:13 +04:00
|
|
|
|
2008-10-07 13:48:27 +04:00
|
|
|
if (__predict_false(CURCPU_IDLE_P()))
|
2007-10-11 01:24:53 +04:00
|
|
|
return;
|
2007-10-09 23:00:13 +04:00
|
|
|
|
2007-11-06 03:42:39 +03:00
|
|
|
switch (l->l_class) {
|
2007-10-11 01:24:53 +04:00
|
|
|
case SCHED_FIFO:
|
|
|
|
/*
|
|
|
|
* Update the time-quantum, and continue running,
|
|
|
|
* if thread runs on FIFO real-time policy.
|
|
|
|
*/
|
2008-01-15 07:16:27 +03:00
|
|
|
KASSERT(l->l_priority > PRI_HIGHEST_TS);
|
2008-10-07 13:48:27 +04:00
|
|
|
spc->spc_ticks = l->l_sched.timeslice;
|
2007-10-09 23:00:13 +04:00
|
|
|
return;
|
2007-10-11 01:24:53 +04:00
|
|
|
case SCHED_OTHER:
|
2007-11-06 03:42:39 +03:00
|
|
|
/*
|
|
|
|
* If thread is in time-sharing queue, decrease the priority,
|
|
|
|
* and run with a higher time-quantum.
|
|
|
|
*/
|
2008-01-15 07:16:27 +03:00
|
|
|
KASSERT(l->l_priority <= PRI_HIGHEST_TS);
|
2008-10-18 07:44:04 +04:00
|
|
|
if (l->l_priority == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
p = l->l_proc;
|
|
|
|
if (__predict_false(p->p_nice > NZERO)) {
|
|
|
|
const int n = max((p->p_nice - NZERO) >> 2, 1);
|
|
|
|
l->l_priority = imax(l->l_priority - n, 0);
|
|
|
|
} else
|
2007-11-06 03:42:39 +03:00
|
|
|
l->l_priority--;
|
2007-10-11 01:24:53 +04:00
|
|
|
break;
|
2007-10-09 23:00:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2007-10-11 01:24:53 +04:00
|
|
|
* If there are higher priority threads or threads in the same queue,
|
|
|
|
* mark that thread should yield, otherwise, continue running.
|
2007-10-09 23:00:13 +04:00
|
|
|
*/
|
2008-04-12 21:02:08 +04:00
|
|
|
if (lwp_eprio(l) <= spc->spc_maxpriority || l->l_target_cpu) {
|
2007-10-09 23:00:13 +04:00
|
|
|
spc->spc_flags |= SPCF_SHOULDYIELD;
|
|
|
|
cpu_need_resched(ci, 0);
|
|
|
|
} else
|
2008-10-07 13:48:27 +04:00
|
|
|
spc->spc_ticks = l->l_sched.timeslice;
|
2007-10-09 23:00:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sysctl nodes and initialization.
|
|
|
|
*/
|
|
|
|
|
2008-01-15 06:37:10 +03:00
|
|
|
static int
|
|
|
|
sysctl_sched_rtts(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
struct sysctlnode node;
|
|
|
|
int rttsms = hztoms(rt_ts);
|
|
|
|
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &rttsms;
|
|
|
|
return sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
}
|
|
|
|
|
2007-10-09 23:00:13 +04:00
|
|
|
static int
|
|
|
|
sysctl_sched_mints(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
struct sysctlnode node;
|
|
|
|
struct cpu_info *ci;
|
|
|
|
int error, newsize;
|
|
|
|
CPU_INFO_ITERATOR cii;
|
|
|
|
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &newsize;
|
|
|
|
|
|
|
|
newsize = hztoms(min_ts);
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return error;
|
|
|
|
|
2007-11-04 15:36:01 +03:00
|
|
|
newsize = mstohz(newsize);
|
2007-10-09 23:00:13 +04:00
|
|
|
if (newsize < 1 || newsize > hz || newsize >= max_ts)
|
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
/* It is safe to do this in such order */
|
|
|
|
for (CPU_INFO_FOREACH(cii, ci))
|
|
|
|
spc_lock(ci);
|
|
|
|
|
2007-11-04 15:36:01 +03:00
|
|
|
min_ts = newsize;
|
2007-10-09 23:00:13 +04:00
|
|
|
sched_precalcts();
|
|
|
|
|
|
|
|
for (CPU_INFO_FOREACH(cii, ci))
|
|
|
|
spc_unlock(ci);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sysctl_sched_maxts(SYSCTLFN_ARGS)
|
|
|
|
{
|
|
|
|
struct sysctlnode node;
|
|
|
|
struct cpu_info *ci;
|
|
|
|
int error, newsize;
|
|
|
|
CPU_INFO_ITERATOR cii;
|
|
|
|
|
|
|
|
node = *rnode;
|
|
|
|
node.sysctl_data = &newsize;
|
|
|
|
|
|
|
|
newsize = hztoms(max_ts);
|
|
|
|
error = sysctl_lookup(SYSCTLFN_CALL(&node));
|
|
|
|
if (error || newp == NULL)
|
|
|
|
return error;
|
|
|
|
|
2007-11-04 15:36:01 +03:00
|
|
|
newsize = mstohz(newsize);
|
2007-10-09 23:00:13 +04:00
|
|
|
if (newsize < 10 || newsize > hz || newsize <= min_ts)
|
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
/* It is safe to do this in such order */
|
|
|
|
for (CPU_INFO_FOREACH(cii, ci))
|
|
|
|
spc_lock(ci);
|
|
|
|
|
2007-11-04 15:36:01 +03:00
|
|
|
max_ts = newsize;
|
2007-10-09 23:00:13 +04:00
|
|
|
sched_precalcts();
|
|
|
|
|
|
|
|
for (CPU_INFO_FOREACH(cii, ci))
|
|
|
|
spc_unlock(ci);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-12 21:02:08 +04:00
|
|
|
SYSCTL_SETUP(sysctl_sched_m2_setup, "sysctl sched setup")
|
2007-10-09 23:00:13 +04:00
|
|
|
{
|
|
|
|
const struct sysctlnode *node = NULL;
|
|
|
|
|
|
|
|
sysctl_createv(clog, 0, NULL, NULL,
|
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_NODE, "kern", NULL,
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_KERN, CTL_EOL);
|
|
|
|
sysctl_createv(clog, 0, NULL, &node,
|
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_NODE, "sched",
|
|
|
|
SYSCTL_DESCR("Scheduler options"),
|
|
|
|
NULL, 0, NULL, 0,
|
|
|
|
CTL_KERN, CTL_CREATE, CTL_EOL);
|
|
|
|
|
|
|
|
if (node == NULL)
|
|
|
|
return;
|
|
|
|
|
2008-04-12 21:02:08 +04:00
|
|
|
sysctl_createv(NULL, 0, &node, NULL,
|
2007-10-09 23:00:13 +04:00
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_STRING, "name", NULL,
|
|
|
|
NULL, 0, __UNCONST("M2"), 0,
|
|
|
|
CTL_CREATE, CTL_EOL);
|
2008-04-12 21:02:08 +04:00
|
|
|
sysctl_createv(NULL, 0, &node, NULL,
|
2008-01-15 06:37:10 +03:00
|
|
|
CTLFLAG_PERMANENT,
|
|
|
|
CTLTYPE_INT, "rtts",
|
|
|
|
SYSCTL_DESCR("Round-robin time quantum (in miliseconds)"),
|
|
|
|
sysctl_sched_rtts, 0, NULL, 0,
|
|
|
|
CTL_CREATE, CTL_EOL);
|
2008-04-12 21:02:08 +04:00
|
|
|
sysctl_createv(NULL, 0, &node, NULL,
|
2007-10-09 23:00:13 +04:00
|
|
|
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
|
|
|
|
CTLTYPE_INT, "maxts",
|
2007-11-04 15:36:01 +03:00
|
|
|
SYSCTL_DESCR("Maximal time quantum (in miliseconds)"),
|
2007-10-09 23:00:13 +04:00
|
|
|
sysctl_sched_maxts, 0, &max_ts, 0,
|
|
|
|
CTL_CREATE, CTL_EOL);
|
2008-04-12 21:02:08 +04:00
|
|
|
sysctl_createv(NULL, 0, &node, NULL,
|
2007-10-09 23:00:13 +04:00
|
|
|
CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
|
|
|
|
CTLTYPE_INT, "mints",
|
2007-11-04 15:36:01 +03:00
|
|
|
SYSCTL_DESCR("Minimal time quantum (in miliseconds)"),
|
2007-10-09 23:00:13 +04:00
|
|
|
sysctl_sched_mints, 0, &min_ts, 0,
|
|
|
|
CTL_CREATE, CTL_EOL);
|
|
|
|
}
|