Skip to content

Commit

Permalink
multipathd: make multipathd scheduling configurable
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Martin Wilck <[email protected]>
  • Loading branch information
bmarzins authored and mwilck committed Mar 4, 2024
1 parent 38a3572 commit 1c4301a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions multipathd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions multipathd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down

1 comment on commit 1c4301a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

🔴 Please review

See the 📜action log or 📝 job summary for details.

Unrecognized words (1)

SCHED

To accept these unrecognized words as correct, you could run the following commands

... in a clone of the [email protected]:openSUSE/multipath-tools.git repository
on the queue branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/main/apply.pl' |
perl - 'https://github.com/openSUSE/multipath-tools/actions/runs/8142260375/attempts/1'
Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary

This includes both expected items (241) from .github/actions/spelling/expect.txt and unrecognized words (1)

Dictionary Entries Covers Uniquely
cspell:node/dict/node.txt 891 14 2
cspell:php/dict/php.txt 1689 12 2
cspell:python/src/python/python-lib.txt 2417 10 1
cspell:golang/dict/go.txt 2099 7 1
cspell:k8s/dict/k8s.txt 153 6 1

Consider adding them (in .github/workflows/spelling.yml) for uses: check-spelling/check-spelling@main in its with:

      with:
        extra_dictionaries:
          cspell:node/dict/node.txt
          cspell:php/dict/php.txt
          cspell:python/src/python/python-lib.txt
          cspell:golang/dict/go.txt
          cspell:k8s/dict/k8s.txt

To stop checking additional dictionaries, add (in .github/workflows/spelling.yml) for uses: check-spelling/check-spelling@main in its with:

check_extra_dictionaries: ''

Please sign in to comment.