Date: Fri, 26 Feb 2021 17:33:31 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 253877] [libgeom] O(n^2) behavior in geom_stats_resync Message-ID: <bug-253877-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D253877 Bug ID: 253877 Summary: [libgeom] O(n^2) behavior in geom_stats_resync Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: asomers@FreeBSD.org geom_stats_resync tries to mmap all of /dev/devstat. But without knowing t= hat device's size, it simply tries to mmap successively larger amounts of memory until it fails. That means that the entire operation has O(n^2) syscalls, where n is related to the number of geom providers. On a system with a few thousand providers, running "mdconfig -l" can take several minutes. void geom_stats_resync(void) { void *p; if (statsfd =3D=3D -1) return; for (;;) { p =3D mmap(statp, (npages + 1) * pagesize, PROT_READ, MAP_SHARED, statsfd, 0); if (p =3D=3D MAP_FAILED) break; else statp =3D p; npages++; } } --=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-253877-227>