@@ -932,6 +932,7 @@ int _init_config (const char *file, struct config *conf)
conf->ghost_delay = DEFAULT_GHOST_DELAY;
conf->all_tg_pt = DEFAULT_ALL_TG_PT;
conf->recheck_wwid = DEFAULT_RECHECK_WWID;
+ conf->sched_prio = DEFAULT_SCHED_PRIO;
/*
* preload default hwtable
*/
@@ -203,6 +203,7 @@ struct config {
unsigned int sequence_nr;
int recheck_wwid;
int auto_resize;
+ int sched_prio;
char * selector;
struct _vector uid_attrs;
@@ -59,6 +59,7 @@
#define DEFAULT_AUTO_RESIZE AUTO_RESIZE_NEVER
/* Enable no foreign libraries by default */
#define DEFAULT_ENABLE_FOREIGN "NONE"
+#define DEFAULT_SCHED_PRIO 99
#define CHECKINT_UNDEF UINT_MAX
#define DEFAULT_CHECKINT 5
@@ -1699,6 +1699,28 @@ print_auto_resize(struct strbuf *buff, long v)
declare_def_snprint(auto_resize, print_auto_resize)
+static int
+def_sched_prio_handler(struct config *conf, vector strvec, const char *file,
+ int line_nr)
+{
+ char * buff;
+
+ buff = set_value(strvec);
+ if (!buff)
+ return 1;
+
+ if (strcmp(buff, "undef") == 0)
+ conf->sched_prio = 0;
+ else
+ do_set_int(strvec, &conf->sched_prio, 1, 99, file, line_nr,
+ buff);
+
+ free(buff);
+ return 0;
+}
+
+declare_def_snprint(sched_prio, print_nonzero)
+
static int
hw_vpd_vendor_handler(struct config *conf, vector strvec, const char *file,
int line_nr)
@@ -2176,6 +2198,7 @@ init_keywords(vector keywords)
install_keyword("max_sectors_kb", &def_max_sectors_kb_handler, &snprint_def_max_sectors_kb);
install_keyword("ghost_delay", &def_ghost_delay_handler, &snprint_def_ghost_delay);
install_keyword("auto_resize", &def_auto_resize_handler, &snprint_def_auto_resize);
+ install_keyword("sched_prio", &def_sched_prio_handler, &snprint_def_sched_prio);
install_keyword("find_multipaths_timeout",
&def_find_multipaths_timeout_handler,
&snprint_def_find_multipaths_timeout);
@@ -1375,6 +1375,19 @@ The default is: \fBno\fR
.RE
.
.
+.TP
+.B sched_prio
+Sets the real-time scheduling priority for multipathd. If set to \fIundef\fR,
+multipathd will not attempt to change the scheduling policy or priority it
+was started with. If set from \fI1\fR to \fI99\fR, multipathd will set its
+scheduling policy to the SCHED_RR real-time round robin policy and set is
+priority to the specified value.
+.RS
+.TP
+The default is: \fB99\fR
+.RE
+.
+.
.\" ----------------------------------------------------------------------------
.SH "blacklist and blacklist_exceptions sections"
.\" ----------------------------------------------------------------------------
@@ -3168,11 +3168,11 @@ signal_init(void)
}
static void
-setscheduler (void)
+setscheduler (int sched_prio)
{
int res;
- static struct sched_param sched_param = {
- .sched_priority = 99
+ struct sched_param sched_param = {
+ .sched_priority = sched_prio
};
res = sched_setscheduler (0, SCHED_RR, &sched_param);
@@ -3471,7 +3471,8 @@ child (__attribute__((unused)) void *param)
if (!vecs)
goto failed;
- setscheduler();
+ if (conf->sched_prio)
+ setscheduler(conf->sched_prio);
set_oom_adj();
#ifdef FPIN_EVENT_HANDLER
if (conf->marginal_pathgroups == MARGINAL_PATHGROUP_FPIN)
Currently multipathd always tries to run as a realtime process with a priority of 99. This is excessive. As a first step towards fixing this, make it possible to lower the priority keep multipathd from making itself a realtime process. Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> --- libmultipath/config.c | 1 + libmultipath/config.h | 1 + libmultipath/defaults.h | 1 + libmultipath/dict.c | 23 +++++++++++++++++++++++ multipath/multipath.conf.5.in | 13 +++++++++++++ multipathd/main.c | 9 +++++---- 6 files changed, 44 insertions(+), 4 deletions(-)