bitkeeper revision 1.1044 (40ec19236iHRt47R5UsW46zQ42dHIw)

Implementation of a new scheduler. Based on BVT (Borrowed Virtual Time) but trying to give more fair allocation of CPU for diverse environments (CPU-bound domains running against I/O bound ones). For that reason I called it Fair BVT (or FBVT for short). The BVT implementation gave the basic implementation. This changeset contains also the interface to control the scheduler. Unfortunatelly the contex switch allowance cannot be changed yet (a bug). The parameters introduced in the scheduler are likely to change in near future (after running tests).
This commit is contained in:
gm281@boulderdash.cl.cam.ac.uk committed 2004-07-07 15:39:15 +00:00
1 parent e52a2cd60b
commit bdb25a6156
17 files changed
+919 -19

No files matched your search

+124
View File
@@ -479,6 +479,92 @@ static PyObject *pyxc_bvtsched_domain_get(PyObject *self,
"warpu", warpu);
}
static PyObject *pyxc_fbvtsched_global_set(PyObject *self,
PyObject *args,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
unsigned long ctx_allow;
static char *kwd_list[] = { "ctx_allow", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "l", kwd_list, &ctx_allow) )
return NULL;
if ( xc_fbvtsched_global_set(xc->xc_handle, ctx_allow) != 0 )
return PyErr_SetFromErrno(xc_error);
Py_INCREF(zero);
return zero;
}
static PyObject *pyxc_fbvtsched_global_get(PyObject *self,
PyObject *args,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
unsigned long ctx_allow;
if ( !PyArg_ParseTuple(args, "") )
return NULL;
if ( xc_fbvtsched_global_get(xc->xc_handle, &ctx_allow) != 0 )
return PyErr_SetFromErrno(xc_error);
return Py_BuildValue("s:l", "ctx_allow", ctx_allow);
}
static PyObject *pyxc_fbvtsched_domain_set(PyObject *self,
PyObject *args,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
u32 dom;
unsigned long mcuadv, warp, warpl, warpu;
static char *kwd_list[] = { "dom", "mcuadv", "warp", "warpl",
"warpu", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illll", kwd_list,
&dom, &mcuadv, &warp, &warpl, &warpu) )
return NULL;
if ( xc_fbvtsched_domain_set(xc->xc_handle, dom, mcuadv,
warp, warpl, warpu) != 0 )
return PyErr_SetFromErrno(xc_error);
Py_INCREF(zero);
return zero;
}
static PyObject *pyxc_fbvtsched_domain_get(PyObject *self,
PyObject *args,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
u32 dom;
unsigned long mcuadv, warp, warpl, warpu;
static char *kwd_list[] = { "dom", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
return NULL;
if ( xc_fbvtsched_domain_get(xc->xc_handle, dom, &mcuadv, &warp,
&warpl, &warpu) != 0 )
return PyErr_SetFromErrno(xc_error);
return Py_BuildValue("{s:i,s:l,s:l,s:l,s:l}",
"domain", dom,
"mcuadv", mcuadv,
"warp", warp,
"warpl", warpl,
"warpu", warpu);
}
static PyObject *pyxc_evtchn_bind_interdomain(PyObject *self,
PyObject *args,
PyObject *kwds)
@@ -973,6 +1059,44 @@ static PyMethodDef pyxc_methods[] = {
" warpl [long]: Warp limit,\n"
},
{ "fbvtsched_global_set",
(PyCFunction)pyxc_fbvtsched_global_set,
METH_VARARGS | METH_KEYWORDS, "\n"
"Set global tuning parameters for Fair Borrowed Virtual Time scheduler.\n"
" ctx_allow [int]: Minimal guaranteed quantum.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "fbvtsched_global_get",
(PyCFunction)pyxc_fbvtsched_global_get,
METH_KEYWORDS, "\n"
"Get global tuning parameters for FBVT scheduler.\n"
"Returns: [dict]:\n"
" ctx_allow [int]: context switch allowance\n" },
{ "fbvtsched_domain_set",
(PyCFunction)pyxc_fbvtsched_domain_set,
METH_VARARGS | METH_KEYWORDS, "\n"
"Set per-domain tuning parameters for Fair Borrowed Virtual Time scheduler.\n"
" dom [int]: Identifier of domain to be tuned.\n"
" mcuadv [int]: Proportional to the inverse of the domain's weight.\n"
" warp [int]: How far to warp domain's EVT on unblock.\n"
" warpl [int]: How long the domain can run warped.\n"
" warpu [int]: How long before the domain can warp again.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "fbvtsched_domain_get",
(PyCFunction)pyxc_fbvtsched_domain_get,
METH_KEYWORDS, "\n"
"Get per-domain tuning parameters under the FBVT scheduler.\n"
" dom [int]: Identifier of domain to be queried.\n"
"Returns [dict]:\n"
" domain [int]: Domain ID.\n"
" mcuadv [long]: MCU Advance.\n"
" warp [long]: Warp.\n"
" warpu [long]: Unwarp requirement.\n"
" warpl [long]: Warp limit,\n"
},
{ "atropos_domain_set",
(PyCFunction)pyxc_atropos_domain_set,
METH_KEYWORDS, "\n"
+17 -3
View File
@@ -171,10 +171,15 @@ class Xend:
{'op' : 'cpu_rrobin_slice_set',
'slice' : slice })
def xend_node_cpu_bvt_slice_set(self, slice):
def xend_node_cpu_bvt_slice_set(self, ctx_allow):
return xend_call(self.nodeurl(),
{'op' : 'cpu_bvt_slice_set',
'slice' : slice })
'ctx_allow' : ctx_allow })
def xend_node_cpu_fbvt_slice_set(self, ctx_allow):
return xend_call(self.nodeurl(),
{'op' : 'cpu_fbvt_slice_set',
'ctx_allow' : ctx_allow })
def xend_domains(self):
return xend_get(self.domainurl())
@@ -226,10 +231,19 @@ class Xend:
def xend_domain_cpu_bvt_set(self, id, mcuadv, warp, warpl, warpu):
return xend_call(self.domainurl(id),
{'op' : 'cpu_bvt_set',
'mcuadv' : mvuadv,
'mcuadv' : mcuadv,
'warp' : warp,
'warpl' : warpl,
'warpu' : warpu })
def xend_domain_cpu_fbvt_set(self, id, mcuadv, warp, warpl, warpu):
return xend_call(self.domainurl(id),
{'op' : 'cpu_fbvt_set',
'mcuadv' : mcuadv,
'warp' : warp,
'warpl' : warpl,
'warpu' : warpu })
def xend_domain_cpu_atropos_set(self, id, period, slice, latency, xtratime):
return xend_call(self.domainurl(id),
+13
View File
@@ -363,6 +363,19 @@ class XendDomain:
dom = int(dom)
return xc.bvtsched_domain_get(dom)
def domain_cpu_fbvt_set(self, dom, mcuadv, warp, warpl, warpu):
"""Set FBVT (Fair Borrowed Virtual Time) scheduler parameters for a domain.
"""
dom = int(dom)
return xc.fbvtsched_domain_set(dom=dom, mcuadv=mcuadv,
warp=warp, warpl=warpl, warpu=warpu)
def domain_cpu_fbvt_get(self, dom):
"""Get FBVT (Fair Borrowed Virtual Time) scheduler parameters for a domain.
"""
dom = int(dom)
return xc.fbvtsched_domain_get(dom)
def domain_cpu_atropos_set(self, dom, period, slice, latency, xtratime):
"""Set Atropos scheduler parameters for a domain.
"""
+12 -2
View File
@@ -24,12 +24,22 @@ class XendNode:
def notify(self, uri):
return 0
def cpu_bvt_slice_set(self, slice):
def cpu_bvt_slice_set(self, ctx_allow):
ret = 0
#ret = self.xc.bvtsched_global_set(ctx_allow=slice)
return ret
def cpu_bvt_slice_get(self, slice):
def cpu_bvt_slice_get(self, ctx_allow):
ret = 0
#ret = self.xc.bvtsched_global_get()
return ret
def cpu_fbvt_slice_set(self, ctx_allow):
ret = 0
#ret = self.xc.bvtsched_global_set(ctx_allow=slice)
return ret
def cpu_fbvt_slice_get(self, ctx_allow):
ret = 0
#ret = self.xc.bvtsched_global_get()
return ret
+10
View File
@@ -70,6 +70,16 @@ class SrvDomain(SrvDir):
['warpu', 'int']])
val = fn(req.args, {'dom': self.dom.id})
return val
def op_cpu_fbvt_set(self, op, req):
fn = FormFn(self.xd.domain_cpu_fbvt_set,
[['dom', 'int'],
['mcuadv', 'int'],
['warp', 'int'],
['warpl', 'int'],
['warpu', 'int']])
val = fn(req.args, {'dom': self.dom.id})
return val
def op_cpu_atropos_set(self, op, req):
fn = FormFn(self.xd.domain_cpu_atropos_set,
+8 -1
View File
@@ -4,6 +4,7 @@ import os
from SrvDir import SrvDir
from xen.xend import sxp
from xen.xend import XendNode
from xen.xend.Args import FormFn
class SrvNode(SrvDir):
"""Information about the node.
@@ -29,7 +30,13 @@ class SrvNode(SrvDir):
def op_cpu_bvt_slice_set(self, op, req):
fn = FormFn(self.xn.cpu_bvt_slice_set,
[['slice', 'int']])
[['ctx_allow', 'int']])
val = fn(req.args, {})
return val
def op_cpu_fbvt_slice_set(self, op, req):
fn = FormFn(self.xn.cpu_fbvt_slice_set,
[['ctx_allow', 'int']])
val = fn(req.args, {})
return val
+39 -5
View File
@@ -347,19 +347,53 @@ xm.prog(ProgBvt)
class ProgBvtslice(Prog):
group = 'scheduler'
name = "bvtslice"
info = """Set the BVT scheduler slice."""
name = "bvt_ctxallow"
info = """Set the BVT scheduler context switch allowance."""
def help(self, args):
print args[0], 'SLICE'
print '\nSet Borrowed Virtual Time scheduler slice.'
print args[0], 'CTX_ALLOW'
print '\nSet Borrowed Virtual Time scheduler context switch allowance.'
def main(self, args):
if len(args) < 2: self.err('%s: Missing slice' % args[0])
if len(args) < 2: self.err('%s: Missing context switch allowance'
% args[0])
server.xend_node_cpu_bvt_slice_set(slice)
xm.prog(ProgBvtslice)
class ProgFbvt(Prog):
group = 'scheduler'
name = "fbvt"
info = """Set FBVT scheduler parameters."""
def help(self, args):
print args[0], "DOM MCUADV WARP WARPL WARPU"
print '\nSet Fair Borrowed Virtual Time scheduler parameters.'
def main(self, args):
if len(args) != 6: self.err("%s: Invalid argument(s)" % args[0])
v = map(int, args[1:6])
server.xend_domain_cpu_fbvt_set(*v)
xm.prog(ProgFbvt)
class ProgFbvtslice(Prog):
group = 'scheduler'
name = "fbvt_ctxallow"
info = """Set the FBVT scheduler context switch allowance."""
def help(self, args):
print args[0], 'CTX_ALLOW'
print '\nSet Fair Borrowed Virtual Time scheduler context switch allowance.'
def main(self, args):
if len(args) < 2: self.err('%s: Missing context switch allowance.'
% args[0])
server.xend_node_cpu_fbvt_slice_set(slice)
xm.prog(ProgFbvtslice)
class ProgAtropos(Prog):
group = 'scheduler'
name= "atropos"
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.