xen: credit2: kick away vcpus not running within their soft-affinity
authorDario Faggioli <dario.faggioli@citrix.com>
Tue, 29 Aug 2017 09:18:51 +0000 (10:18 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Tue, 29 Aug 2017 09:18:51 +0000 (10:18 +0100)
commitafd44e2acab5bdc6a62120b21e5c7e4b80919db1
treefe68cf6cd3bd2e1e36203bba6ded43aecf73decc
parenta5948a2b5233dc4c8771f7efb6789681ce9ce2d5
xen: credit2: kick away vcpus not running within their soft-affinity

If, during scheduling, we realize that the current vcpu
is running outside of its own soft-affinity, it would be
preferable to send it somewhere else.

Of course, that may not be possible, and if we're too
strict, we risk having vcpus sit in runqueues, even if
there are idle pcpus (violating work-conservingness).
In fact, what about there are no pcpus, from the soft
affinity mask of the vcpu in question, where it can
run?

To make sure we don't fall in the above described trap,
only actually de-schedule the vcpu if there are idle and
not already tickled cpus from its soft affinity where it
can run immediately.

If there is (at least one) of such cpus, we let current
be preempted, so that csched2_context_saved() will put
it back in the runq, and runq_tickle() will wake (one
of) the cpu.

If there is not even one, we let current run where it is,
as running outside its soft-affinity is still better than
not running at all.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/common/sched_credit2.c