[Bug 269150] bsdconfig: O(n^2) performance in f_device_get_all
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 25 Jan 2023 16:47:07 UTC
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.