[mutter/wip/carlosg/rt-scheduler: 5/5] core: Set a SCHED_RR scheduler priority on Wayland sessions
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/rt-scheduler: 5/5] core: Set a SCHED_RR scheduler priority on Wayland sessions
- Date: Wed, 8 May 2019 14:48:07 +0000 (UTC)
commit 1bd9775df9d5b99442d592455ec5d37d87f3de45
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Feb 27 19:02:25 2019 +0100
core: Set a SCHED_RR scheduler priority on Wayland sessions
This is similar to a change in kwin:
https://blog.martin-graesslin.com/blog/2017/09/kwinwayland-goes-real-time/
If the backend is native, make it claim the lowest of RT scheduler
priorities, this will be both educated to other RT processes and improves
responsiveness wrt every other process.
Notably, This does not happen (yet?) for X11 as the interactions of a RT
process with a lower priority Xserver are unclear. It is worth noting that
gnome-shell is just a regular X client, not a special entity.
This can only work if mutter/gnome-shell process receives CAP_SYS_NICE
somehow. That is out of the scope of this patch.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/921
https://gitlab.gnome.org/GNOME/mutter/merge_requests/460
src/core/main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
---
diff --git a/src/core/main.c b/src/core/main.c
index bcd8c8648..144b11cf2 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -521,6 +521,23 @@ meta_override_compositor_configuration (MetaCompositorType compositor_type,
_backend_gtype_override = backend_gtype;
}
+static void
+meta_set_scheduler (GType backend_gtype)
+{
+ if (backend_gtype == META_TYPE_BACKEND_NATIVE)
+ {
+ int retval;
+ struct sched_param sp = {
+ .sched_priority = sched_get_priority_min (SCHED_RR)
+ };
+
+ retval = sched_setscheduler (0, SCHED_RR | SCHED_RESET_ON_FORK, &sp);
+
+ if (retval != 0)
+ g_warning ("Failed to set RT scheduler: %m");
+ }
+}
+
/**
* meta_init: (skip)
*
@@ -584,6 +601,8 @@ meta_init (void)
meta_wayland_pre_clutter_init ();
#endif
+ meta_set_scheduler (backend_gtype);
+
/* NB: When running as a hybrid wayland compositor we run our own headless X
* server so the user can't control the X display to connect too. */
if (!meta_is_wayland_compositor ())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]