Author: markj
Date: Mon Apr  6 14:58:24 2020
New Revision: 359659
URL: https://svnweb.freebsd.org/changeset/base/359659

Log:
  MFC r359437:
  Fix accounting of hwpmc's thread descriptor freelist.

Modified:
  stable/12/sys/dev/hwpmc/hwpmc_mod.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- stable/12/sys/dev/hwpmc/hwpmc_mod.c Mon Apr  6 14:56:19 2020        
(r359658)
+++ stable/12/sys/dev/hwpmc/hwpmc_mod.c Mon Apr  6 14:58:24 2020        
(r359659)
@@ -2426,12 +2426,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);
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to