altq: improve pfctl config time for large numbers of queues

In the current implementation of altq_hfsc.c, whne new queues are being
added (by pfctl), each queue is added to the tail of the siblings linked
list under the parent queue.

On a system with many queues (50,000+) this leads to very long load
times at the insertion process must scan the entire list for every new
queue,

Since this list is unordered, this changes merely adds the new queue to
the head of the list rather than the tail.

Reviewed by:	kp
MFC after:	3 weeks
Sponsored by:	RG Nets
Differential Revision:	https://reviews.freebsd.org/D35964
This commit is contained in:
James Skon 2022-07-28 21:58:31 +02:00 committed by Kristof Provost
parent c019a1690b
commit 13890d30f8

View File

@ -514,9 +514,9 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
if ((p = parent->cl_children) == NULL)
parent->cl_children = cl;
else {
while (p->cl_siblings != NULL)
p = p->cl_siblings;
p->cl_siblings = cl;
/* Put new class at beginning of list */
cl->cl_siblings = parent->cl_children;
parent->cl_children = cl;
}
}
IFQ_UNLOCK(hif->hif_ifq);