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

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

 



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.

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux