[PATCH 0/3] qemu: add support for the SCHED_DEADLINE scheduling policy

Sasha Algisi sasha.algisi at edu.unito.it
Mon Aug 1 17:11:43 UTC 2022


Hello everyone,

This patchset aims at adding support for the SCHED_DEADLINE Linux
scheduling policy for vcpus, io-threads and emulator processes.

In fact, libvirt currently supports SCHED_OTHER, SCHED_BATCH,
SCHED_IDLE, SCHE_FIFO and SCHED_RR, but not SCHED_DEADLINE.
SCHED_DEADLINE is a policy implementing an algorithm originating from
the real-time scheduling community, but it can be useful outside of
the real-time computing field as well.

It allows one to set a specific amount of CPU time that a task should
receive with a given periodicity, and withing a certain deadline.
E.g., task t should be scheduled at least for 50 ms every 100 ms. To
achieve this, it needs 3 parameters: runtime, deadline and period
(although period can just be equal to deadline, which is what happens
automatically if one sets period=0). It must always hold that:
runtime <= deadline <= period (and this is enforced by the kernel,
but checks are included in the patches, so that meaningful and easy
to interpret error messages can be printed to the user).

More info on SCHED_DEADLINE are available here:

https://docs.kernel.org/scheduler/sched-deadline.html

The interface will look like this, e.g., for setting SCHED_DEADLINE
as a policy for 3 (0-2) vcpus, with runtime = 10000000, deadline =
15000000 and period = 20000000:

  <cputune>
    ...
    <vcpusched vcpus="0-2" scheduler="deadline" runtime="10000000"
     deadline="15000000" period="20000000"/>
    ...
  </cputune>

This a link to a branch containing the patches:

https://gitlab.com/Algisi-00/libvirt/-/tree/sched-deadline

And this is the link to results of running the CI on such branch:

https://gitlab.com/Algisi-00/libvirt/-/pipelines/601795712

Note that the jobs that are failing are also failing in the exact
same way without these patches applied.

Feedback is welcome and very much appreciated.

Thanks and regards.

Sasha Algisi (3):
  virprocess: define sched_attr and sched_setattr
  virprocess: add the SCHED_DEADLINE scheduling policy
  domain_conf: add SCHED_DEADLINE support in the XML configuration

 NEWS.rst                          |   5 ++
 docs/formatdomain.rst             |  16 +++-
 src/ch/ch_process.c               |   3 +-
 src/conf/domain_conf.c            |  52 +++++++++++--
 src/conf/domain_conf.h            |   3 +
 src/conf/schemas/domaincommon.rng |  16 ++++
 src/qemu/qemu_process.c           |   8 +-
 src/util/virprocess.c             | 123 +++++++++++++++++++++++++++++-
 src/util/virprocess.h             |   6 +-
 9 files changed, 216 insertions(+), 16 deletions(-)

-- 
2.37.1


-- 
------------------------


Indirizzo istituzionale di posta elettronica 
degli studenti e dei laureati dell'Università di TorinoOfficial University 
of Turin email address for students and graduates 



More information about the libvir-list mailing list