DF-2943 / fix.diff
--- a/sys/kern/kern_sysref.c 2026-06-29 12:51:19.000000000 +0000 +++ b/sys/kern/kern_sysref.c 2026-10-26 00:25:42.789042927 +0000 @@ -97,33 +97,10 @@ return(0); } -/* - * Manual initialization of a resource structure's sysref, only used during - * booting to set up certain statically declared resources which cannot - * be deallocated. +/* sysref_init() and allocsysid() removed: zero in-tree callers. + * sysref_init produced objects without objcache backing whose final + * put would objcache_put() non-cache memory on production builds. */ -void -sysref_init(struct sysref *sr, struct sysref_class *srclass) -{ - struct srpercpu *sa; - globaldata_t gd; - - gd = mycpu; - crit_enter_gd(gd); - gd->gd_sysid_alloc += ncpus_fit; /* next unique sysid */ - sr->sysid = gd->gd_sysid_alloc; - KKASSERT(((int)sr->sysid & ncpus_fit_mask) == gd->gd_cpuid); - sr->refcnt = -0x40000000; - sr->flags = 0; - sr->srclass = srclass; - - sa = &sysref_array[gd->gd_cpuid]; - spin_lock(&sa->spin); - sysref_rb_tree_RB_INSERT(&sa->rbtree, sr); - spin_unlock(&sa->spin); - crit_exit_gd(gd); -} - /* * Allocate a resource structure of the specified class, initialize a * sysid and add the resource to the RB tree. The caller must complete @@ -359,16 +336,4 @@ } } -sysid_t -allocsysid(void) -{ - globaldata_t gd = mycpu; - sysid_t sysid; - - crit_enter_gd(gd); - gd->gd_sysid_alloc += ncpus_fit; - sysid = gd->gd_sysid_alloc; - crit_exit_gd(gd); - return(sysid); -} - +/* allocsysid() removed: zero in-tree callers. */ --- a/sys/sys/sysref2.h 2026-06-29 12:51:19.000000000 +0000 +++ b/sys/sys/sysref2.h 2026-10-26 00:25:42.789042927 +0000 @@ -119,7 +119,7 @@ #ifdef _KERNEL -void sysref_init(struct sysref *sr, struct sysref_class *); +/* sysref_init() removed: unused and unsafe for non-objcache objects. */ void *sysref_alloc(struct sysref_class *class); void sysref_activate(struct sysref *); --- a/sys/sys/sysref.h 2026-06-29 12:51:19.000000000 +0000 +++ b/sys/sys/sysref.h 2026-10-26 00:25:42.789042927 +0000 @@ -139,7 +139,7 @@ #ifdef _KERNEL -sysid_t allocsysid(void); +/* allocsysid() removed: unused. */ #endif |