Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 May 2018 23:16:40 +0000 (UTC)
From:      Matt Macy <mmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334300 - head/sys/dev/hwpmc
Message-ID:  <201805282316.w4SNGetx001410@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmacy
Date: Mon May 28 23:16:39 2018
New Revision: 334300
URL: https://svnweb.freebsd.org/changeset/base/334300

Log:
  hwmpc: fix brain-damaged handling of thread descriptor freeing

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

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c	Mon May 28 23:14:38 2018	(r334299)
+++ head/sys/dev/hwpmc/hwpmc_mod.c	Mon May 28 23:16:39 2018	(r334300)
@@ -2351,9 +2351,9 @@ pmc_thread_descriptor_pool_free_task(void *arg __unuse
 	/* 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);
-		MPASS(pt);
+	while (delta > 0 &&
+		   (pt = LIST_FIRST(&pmc_threadfreelist)) != NULL) {
+		delta--;
 		LIST_REMOVE(pt, pt_next);
 		LIST_INSERT_HEAD(&tmplist, pt, pt_next);
 	}
@@ -2361,7 +2361,7 @@ pmc_thread_descriptor_pool_free_task(void *arg __unuse
 
 	/* If there are entries to free, free them. */
 	while (!LIST_EMPTY(&tmplist)) {
-		pt = LIST_FIRST(&pmc_threadfreelist);
+		pt = LIST_FIRST(&tmplist);
 		LIST_REMOVE(pt, pt_next);
 		free(pt, M_PMC);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805282316.w4SNGetx001410>