[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [BUG] unfairness in Xen's credit scheduler



Hi all,

Since Xen 4.2.0, users can change time slice of the scheduler at
runtime via xl command line, a very nice feature. However, it is
not *correctly* implemented.

Problem description
--------------------
say you set the 'cap' of one VM to 50 (a half core),
-when setting the time slice to be *greater* than 30ms, the VM gets
much *less* CPU cycles than its allocation
-when setting the time slice to be *smaller* than 30ms, the VM gets
much *more* CPU cycles than its allocation


Problem happens in sched_credit.c/csched_sys_cntl():
--------------------
after changing prv->tslice_ms, other parameters *should* also be
changed accordingly:

csched_sys_cntl() {
    ...
    prv->tslice_ms = params->tslice_ms;
    prv->ratelimit_us = params->ratelimit_us;
-------
    /* my patch: these parameters should also be changed */
    prv->ticks_per_tslice = CSCHED_TICKS_PER_TSLICE;
    if ( prv->tslice_ms < prv->ticks_per_tslice )
        prv->ticks_per_tslice = 1;
    prv->tick_period_us = prv->tslice_ms * 1000 / prv->ticks_per_tslice;
    prv->credits_per_tslice = CSCHED_CREDITS_PER_MSEC * prv->tslice_ms;
-------
    ...
}

Particularly, [prv->credits_per_tslice] is very important to maintain
the *fairness* of credit allocation in csched_acct().

This bug has been there since Xen-4.2.0.

Thanks,
CHENG Luwei
--
PhD student
Department of Computer Science
The University of Hong Kong
Homepage: http://www.cs.hku.hk/~lwcheng

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.