Re: git: d3f96f661050 - main - Fix O(n^2) behavior in sysctl
Date: Tue, 27 Sep 2022 13:37:50 UTC
On 9/27/22 15:33, Hans Petter Selasky wrote: > This change has resulted in some external breakage: > >> drm_sysctl_freebsd.c:93:2: error: no member named 'sle_next' in >> 'struct sysctl_oid::(unnamed at /usr/src/sys/sys/sysctl.h:189:2)' >> SLIST_FOREACH(oid, SYSCTL_CHILDREN(drioid), oid_link) { >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> /usr/src/sys/sys/queue.h:236:14: note: expanded from macro >> 'SLIST_FOREACH' >> (var) = SLIST_NEXT((var), field)) >> ^~~~~~~~~~~~~~~~~~~~~~~~ >> /usr/src/sys/sys/queue.h:272:46: note: expanded from macro 'SLIST_NEXT' >> #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) > > Maybe we should have a SYSCTL_FOREACH() macro? > > --HPS The fix is simple enough: diff --git a/./work/drm-kmod-drm_v5.10.113_7/drivers/gpu/drm/drm_sysctl_freebsd.c.orig b/./work/drm-kmod-drm_v5.10.113_7/drivers/gpu/drm/drm_sysctl_freebsd.c index 6bb5ece..2956210 100644 --- a/./work/drm-kmod-drm_v5.10.113_7/drivers/gpu/drm/drm_sysctl_freebsd.c.orig +++ b/./work/drm-kmod-drm_v5.10.113_7/drivers/gpu/drm/drm_sysctl_freebsd.c @@ -90,7 +90,7 @@ drm_sysctl_init(struct drm_device *dev) /* Find the next free slot under hw.dri */ i = 0; - SLIST_FOREACH(oid, SYSCTL_CHILDREN(drioid), oid_link) { + RB_FOREACH(oid, sysctl_oid_list, SYSCTL_CHILDREN(drioid)) { if (i == oid->oid_name[0] - '0' && oid->oid_name[1] == 0) i++; } --HPS