Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jan 2023 16:47:07 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 269150] bsdconfig: O(n^2) performance in f_device_get_all
Message-ID:  <bug-269150-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269150

            Bug ID: 269150
           Summary: bsdconfig: O(n^2) performance in f_device_get_all
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org

bsdconfig can take a very long time on systems with a large number of disks. 
I've seen it take 30 minutes at "Probing devices".  top shows that the slowdown
is entirely due to CPU usage of sh, not subprocesses.  Inspection shows that
the  `f_device_get_all` function calls `f_device_probe_geom` for every geom,
which then calls `f_geom_find`, which again loops over every geom.  It's a
classic O(n^2) problem.  We need to refactor that code to remove the extra
loops.

-- 
You are receiving this mail because:
You are the assignee for the bug.

help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-269150-227>