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/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D269150

            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=
.=20
I've seen it take 30 minutes at "Probing devices".  top shows that the slow=
down
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.

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



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