[Bug 296793] TASKQGROUP_DEFINE() and taskqgroup_create() ignores sparse cpus

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 14 Jul 2026 20:18:43 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296793

            Bug ID: 296793
           Summary: TASKQGROUP_DEFINE() and taskqgroup_create() ignores
                    sparse cpus
           Product: Base System
           Version: 14.4-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: nreilly@qnx.com

TASKQGROUP_DEFINE() is typically with mp_ncpus and stride 1. This ends up
calling taskqgroup_create() and that loops mp_ncpus times. In the case where
some CPUs are missing, this potentially creates too many threads, and the first
CPU may not be CPU 0.

taskqgroup_create should be reworked to use the CPU_FIRST() / CPU_NEXT() or
just CPU_FOREACH(), however net/iflib.c also does
TASKQGROUP_DEFINE(if_config_tqg, 1, 1); i.e. this needs to handle the case of a
single CPU as well.

I'm not sure the best way forwards on changing the API. One possibility would
be to remove the specification of CPUs and stride and just have a flag
specifying if this should use all CPUs or just 1 as those seem to be the only
use cases that I see?

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