sched: convert RTDS from time to event driven model
authorTianyang Chen <tiche@seas.upenn.edu>
Fri, 18 Mar 2016 14:21:36 +0000 (15:21 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 18 Mar 2016 14:21:36 +0000 (15:21 +0100)
commit0709d595458f87fd30ff4e5af42ec0ca3e8d3cb6
tree5fe8ad352bc46a0e740945088b5e5684b9c7cccc
parentcb2a9d480b4aa1a938753717d694b276f51c4dd4
sched: convert RTDS from time to event driven model

The current RTDS code has several problems:
 - the scheduler, although the algorithm is event driven by
   nature, follows a time driven model (is invoked periodically!),
   making the code look unnatural;
 - budget replenishment logic, budget enforcement logic and scheduling
   decisions are mixed and entangled, making the code hard to understand;
 - the various queues of vcpus are scanned various times, making the
   code inefficient;

This patch separates budget replenishment and enforcement. It does that
by handling the former with a dedicated timer, and a queue of pending
replenishment events.

A replenishment queue has been added to keep track of all vcpus that
are runnable.

We also make sure that the main scheduling function is called when a
scheduling decision is necessary, such as when the currently running
vcpu runs out of budget.

Finally, when waking up a vcpu, it is now enough to tickle the various
CPUs appropriately, like all other schedulers also do.

Signed-off-by: Tianyang Chen <tiche@seas.upenn.edu>
Signed-off-by: Meng Xu <mengxu@cis.upenn.edu>
Signed-off-by: Dagaen Golomb <dgolomb@seas.upenn.edu>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
xen/common/sched_rt.c