mbox series

[v2,0/3] multipath: optimizations for large mptable

Message ID 20220824081147.29270-1-mwilck@suse.com (mailing list archive)
Headers show
Series multipath: optimizations for large mptable | expand

Message

Martin Wilck Aug. 24, 2022, 8:11 a.m. UTC
From: Martin Wilck <mwilck@suse.com>

We observe that multipath operations take a long time if the multipaths
section in multipath.conf contains a lot of alias settings
(10000+ in our case). This hurts in particular in udev rules, when
multipath -u or multipath -U is invoked, but also for command line
invocations like "multipath -ll".

This series provides a few optimizations for this use case. It speeds
up simple multipath operations in the test case by a factor of 20.

Changes wrt v1, after suggestions from Benjamin Marzinski:

 01, 02: Use pointer comparisons to achieve stable sorting with qsort
 02:  Fix return without popping the cleanup handler. The way I fixed this
      leaves the possibility that some memory won't be freed if a thread is
      killed while executing vector_convert(). I think this is acceptible;
      avoiding it would complicate the code, with very small benefit.
 02: Remove unnecessary checks and break loop if alias==NULL is encountered.

Martin Wilck (3):
  libmultipath: merge_mptable(): sort table by wwid
  libmultipath: check_alias_settings(): pre-sort mptable by alias
  multipath: optimize program startup for frequent invocations

 libmultipath/alias.c  | 44 ++++++++++++++++++++++++++++++++++++++++---
 libmultipath/config.c | 24 +++++++++++++++++++++--
 libmultipath/vector.c |  8 ++++++++
 libmultipath/vector.h |  1 +
 multipath/main.c      | 33 ++++++++++++++++----------------
 5 files changed, 89 insertions(+), 21 deletions(-)