[libvirt] [PATCH v2 2/5] util: allow virProcessSetScheduler to set SCHED_DEADLINE

Martin Kletzander mkletzan at redhat.com
Wed Nov 23 15:59:52 UTC 2016


On Mon, Nov 21, 2016 at 02:23:21PM +0100, Martin Kletzander wrote:
>On Mon, Nov 21, 2016 at 01:56:05PM +0100, Martin Polednik wrote:
>>As sched_deadline is linux specific, it is not set through
>>sched_setscheduler but rather the sched_setattr syscall. Additionally,
>>the scheduler has new set of parameters: runtime, deadline and period.
>>
>>In this part of the series, we extend virProcessSetScheduler to
>>accommodate the additional parameters and use sched_setattr syscall to
>>set SCHED_DEADLINE. Another small addition is sched_attr struct, which
>>is required for sched_setattr and not exposed from the kernel or
>>libraries.
>>---
>> src/qemu/qemu_process.c |  3 ++-
>> src/util/virprocess.c   | 37 +++++++++++++++++++++++++++++++++----
>> src/util/virprocess.h   | 25 ++++++++++++++++++++++++-
>> 3 files changed, 59 insertions(+), 6 deletions(-)
>>
>>diff --git a/src/util/virprocess.c b/src/util/virprocess.c
>>index 9b4a555..acf4d6b 100644
>>--- a/src/util/virprocess.c
>>+++ b/src/util/virprocess.c
>>@@ -100,6 +99,24 @@ static inline int setns(int fd, int nstype)
>> #   error Please determine the syscall number for setns on your architecture
>> #  endif
>> # endif
>>+
>>+# if defined(SCHED_DEADLINE) && defined(__NR_sched_setattr)
>>+static inline int sched_setattr(pid_t pid,
>>+                                const struct sched_attr *attr,
>>+                                unsigned int flags)
>>+{
>>+    return syscall(__NR_sched_setattr, pid, attr, flags);
>>+}
>>+# else
>>+static inline int sched_setattr(pid_t pid,
>>+                                const struct sched_attr *attr,
>>+                                unsigned int flags)
>>+{
>>+    virReportSystemError(ENOSYS, "%s",
>>+                         _("Deadline scheduler is not supported on this platform."));
>>+    return -1;
>>+}
>>+# endif
>
>As I said, no need to do that, just use AC_CHECK_FUNCS_ONCE we already
>have in configure.ac.  Don't redefine it, just error out if it's not
>available.
>

OK, my bad, it *is* needed, even according to
Documentation/scheduler/sched-deadline.txt

Sorry for the confusion.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20161123/a7ae20b4/attachment-0001.sig>


More information about the libvir-list mailing list