[mutter/wip/carlosg/rt-scheduler: 2/2] backends/native: Add rt-scheduler experimental key to set RT scheduling
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/rt-scheduler: 2/2] backends/native: Add rt-scheduler experimental key to set RT scheduling
- Date: Wed, 27 Feb 2019 18:23:32 +0000 (UTC)
commit cf04551771cc2fdf7a528ae9e71fb686741b5e72
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Feb 27 19:02:25 2019 +0100
backends/native: Add rt-scheduler experimental key to set RT scheduling
This is similar to a change in kwin:
https://blog.martin-graesslin.com/blog/2017/09/kwinwayland-goes-real-time/
If the experimental features key has "rt-scheduler", make it claim the lowest
of RT scheduler priorities, this will be both educated to other RT processes
and improves responsiveness wrt all other processes.
This can only work if mutter/gnome-shell process receives CAP_SYS_ADMIN
somehow.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/921
src/backends/meta-settings-private.h | 1 +
src/backends/meta-settings.c | 2 ++
src/backends/native/meta-backend-native.c | 16 ++++++++++++++++
3 files changed, 19 insertions(+)
---
diff --git a/src/backends/meta-settings-private.h b/src/backends/meta-settings-private.h
index 619de1710..9f07940b7 100644
--- a/src/backends/meta-settings-private.h
+++ b/src/backends/meta-settings-private.h
@@ -33,6 +33,7 @@ typedef enum _MetaExperimentalFeature
META_EXPERIMENTAL_FEATURE_NONE = 0,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER = (1 << 0),
META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS = (1 << 1),
+ META_EXPERIMENTAL_FEATURE_RT_SCHEDULER = (1 << 2),
} MetaExperimentalFeature;
#define META_TYPE_SETTINGS (meta_settings_get_type ())
diff --git a/src/backends/meta-settings.c b/src/backends/meta-settings.c
index 34d49b3ed..bc17969da 100644
--- a/src/backends/meta-settings.c
+++ b/src/backends/meta-settings.c
@@ -264,6 +264,8 @@ experimental_features_handler (GVariant *features_variant,
features |= META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER;
else if (g_str_equal (feature, "kms-modifiers"))
features |= META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS;
+ else if (g_str_equal (feature, "rt-scheduler"))
+ features |= META_EXPERIMENTAL_FEATURE_RT_SCHEDULER;
else
g_info ("Unknown experimental feature '%s'\n", feature);
}
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index c473681cb..d4120e2f9 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -44,6 +44,7 @@
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor-manager-private.h"
#include "backends/meta-pointer-constraint.h"
+#include "backends/meta-settings-private.h"
#include "backends/meta-stage-private.h"
#include "backends/native/meta-barrier-native.h"
#include "backends/native/meta-clutter-backend-native.h"
@@ -331,6 +332,7 @@ static void
meta_backend_native_post_init (MetaBackend *backend)
{
ClutterDeviceManager *manager = clutter_device_manager_get_default ();
+ MetaSettings *settings = meta_backend_get_settings (backend);
META_BACKEND_CLASS (meta_backend_native_parent_class)->post_init (backend);
@@ -338,6 +340,20 @@ meta_backend_native_post_init (MetaBackend *backend)
NULL, NULL);
clutter_evdev_set_relative_motion_filter (manager, relative_motion_filter,
meta_backend_get_monitor_manager (backend));
+
+ if (meta_settings_is_experimental_feature_enabled (settings,
+ META_EXPERIMENTAL_FEATURE_RT_SCHEDULER))
+ {
+ 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");
+ }
}
static MetaMonitorManager *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]