Author: markj
Date: Mon Mar 30 14:23:08 2020
New Revision: 359437
URL: https://svnweb.freebsd.org/changeset/base/359437

Log:
  Fix accounting of hwpmc's thread descriptor freelist.
  
  MFC after:    1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c      Mon Mar 30 14:22:52 2020        
(r359436)
+++ head/sys/dev/hwpmc/hwpmc_mod.c      Mon Mar 30 14:23:08 2020        
(r359437)
@@ -2428,12 +2428,13 @@ pmc_thread_descriptor_pool_free_task(void *arg __unuse
        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);
        }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to