Fix accounting of hwpmc's thread descriptor freelist.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2020-03-30 14:23:08 +00:00
parent 59d50fe5ef
commit 9893ab3f50

View File

@ -2428,12 +2428,13 @@ pmc_thread_descriptor_pool_free_task(void *arg __unused)
int delta;
LIST_INIT(&tmplist);
/* Determine what changes, if any, we need to make. */
mtx_lock_spin(&pmc_threadfreelist_mtx);
delta = pmc_threadfreelist_entries - pmc_threadfreelist_max;
while (delta > 0 &&
(pt = LIST_FIRST(&pmc_threadfreelist)) != NULL) {
while (delta > 0 && (pt = LIST_FIRST(&pmc_threadfreelist)) != NULL) {
delta--;
pmc_threadfreelist_entries--;
LIST_REMOVE(pt, pt_next);
LIST_INSERT_HEAD(&tmplist, pt, pt_next);
}