@@ -18,6 +18,12 @@ READLINE :=
# SCSI_DH_MODULES_PRELOAD := scsi_dh_alua scsi_dh_rdac
SCSI_DH_MODULES_PRELOAD :=
+# Multipathd scheduling priority. Set value from 1 to 99 to make multipathd
+# change its scheduling policy to SCHED_RR and its priority to the specified
+# value. set to 0 to stop multipathd from changing the scheduling policy and
+# priority it was started with.
+SCHED_RT_PRIO := 99
+
EXTRAVERSION := $(shell rev=$$(git rev-parse --short=7 HEAD 2>/dev/null); echo $${rev:+-g$$rev})
# PKG_CONFIG must be read from the environment to enable compilation
@@ -98,6 +98,9 @@ The following variables can be passed to the `make` command line:
By default, command line editing is disabled.
Note that using libreadline may
[make binary indistributable due to license incompatibility](https://github.com/opensvc/multipath-tools/issues/36).
+ * `SCHED_RT_PRIO={0-99}`: for values {1-99} set the realtime priority
+ multipathd will attempt to run with. for value 0, disable multipathd
+ changing itself to a realtime process.
* `ENABLE_LIBDMMP=0`: disable building libdmmp
* `ENABLE_DMEVENTS_POLL=0`: disable support for the device-mapper event
polling API. For use with pre-5.0 kernels that don't support dmevent polling
@@ -57,6 +57,9 @@ $(CLI): $(CLI_OBJS)
cli_handlers.o: cli_handlers.c
$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
+main.o: main.c
+ $(Q)$(CC) $(CPPFLAGS) -DSCHED_RT_PRIO=$(SCHED_RT_PRIO) $(CFLAGS) -c -o $@ $<
+
install:
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
@@ -3172,7 +3172,7 @@ setscheduler (void)
{
int res;
static struct sched_param sched_param = {
- .sched_priority = 99
+ .sched_priority = SCHED_RT_PRIO
};
res = sched_setscheduler (0, SCHED_RR, &sched_param);
@@ -3471,7 +3471,8 @@ child (__attribute__((unused)) void *param)
if (!vecs)
goto failed;
- setscheduler();
+ if (SCHED_RT_PRIO)
+ setscheduler();
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 at compile time to lower the priority or keep multipathd from making itself a realtime process. Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> --- Makefile.inc | 6 ++++++ README.md | 3 +++ multipathd/Makefile | 3 +++ multipathd/main.c | 5 +++-- 4 files changed, 15 insertions(+), 2 deletions(-)