From 9893ab3f503fb7defedeeae831e8fa07743ab24f Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Mon, 30 Mar 2020 14:23:08 +0000 Subject: [PATCH] Fix accounting of hwpmc's thread descriptor freelist. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/dev/hwpmc/hwpmc_mod.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index 49667704ff64..bee3f63c5bc3 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -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); }