Add sched_prio config option
Benjamin Marzinski
maintainercover Add sched_prio config option
This patchset is based on discussions at:
https://github.com/opensvc/multipath-tools/issues/82
The first patch fixes a condlog logging level, and the second patch adds the new config option, so that users can change multipathd's realtime priority or stop multipath from running ched_setscheduler() at all. After we do some testing with multipathd not using a realtime policy, I think we can probably change the defaults
Benjamin Marzinski (2):
multipathd: use condlog level for setscheduler error message
multipathd: Add sched_prio defaults section option
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 | 11 ++++++----- 6 files changed, 45 insertions(+), 5 deletions(-)
Signature · 1 line
2.43.0
Benjamin Marzinski
maintainerPATCH 1/2 multipathd: use condlog level for setscheduler error message
condlog uses it's own log levels, so LOG_WARNING makes no sense. It actually translates to a message sent at the LOG_DEBUG level.
--- multipathd/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
multipathd/main.c +1 -1
@@ -3178,7 +3178,7 @@ setscheduler (void) res =sched_setscheduler (0 ,SCHED_RR , &sched_param);if (res ==-1 ) -condlog (LOG_WARNING ,"Could not set SCHED_RR at priority 99" ); +condlog (2 ,"Could not set SCHED_RR at priority 99" );return ; }
Signature · 1 line
2.43.0
Benjamin Marzinski
maintainerPATCH 2/2 multipathd: Add sched_prio defaults section option
In reply to Benjamin MarzinskiCurrently 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.
--- 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(-)
libmultipath/config.c +1 -0
@@ -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 */
libmultipath/config.h +1 -0
@@ -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;
libmultipath/defaults.h +1 -0
@@ -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
libmultipath/dict.c +23 -0
@@ -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);
multipath/multipath.conf.5.in +13 -0
@@ -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" .\" ----------------------------------------------------------------------------
multipathd/main.c +5 -4
@@ -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 )
Signature · 1 line
2.43.0
Quoted 15 lines · Benjamin Marzinski
This patchset is based on discussions at:
https://github.com/opensvc/multipath-tools/issues/82The first patch fixes a condlog logging level, and the second patch adds
the new config option, so that users can change multipathd's realtime priority or stop multipath from runningched_setscheduler()at all. After we do some testing with multipathd not using a realtime policy, I
think we can probably change the defaultsBenjamin Marzinski (2):
multipathd: use condlog level for setscheduler error message
multipathd: Addsched_priodefaults section option
Quoted 8 lines
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 | 11 ++++++-----
6 files changed, 45 insertions(+), 5 deletions(-)
I wonder if we really want / need a new runtime configuration option for this. For playing around, a compile-time option would be fine and much easier. In general, I think we should do what's already been discussed on on GitHub, use systemd directives to set the RT properties of multipathd.
Regards
Martin