Author: fabient
Date: Tue Dec  8 19:18:32 2009
New Revision: 200271
URL: http://svn.freebsd.org/changeset/base/200271

Log:
  MFC 198464:
  Inform hwpmc(4) of a thread's impending demise prior to invoking 
sched_throw().

Modified:
  stable/7/sys/kern/kern_thread.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/kern_thread.c
==============================================================================
--- stable/7/sys/kern/kern_thread.c     Tue Dec  8 19:12:38 2009        
(r200270)
+++ stable/7/sys/kern/kern_thread.c     Tue Dec  8 19:18:32 2009        
(r200271)
@@ -26,6 +26,8 @@
  * DAMAGE.
  */
 
+#include "opt_hwpmc_hooks.h"
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
@@ -44,6 +46,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/ktr.h>
 #include <sys/umtx.h>
 #include <sys/cpuset.h>
+#ifdef HWPMC_HOOKS
+#include <sys/pmckern.h>
+#endif
 
 #include <security/audit/audit.h>
 
@@ -497,6 +502,14 @@ thread_exit(void)
                        panic ("thread_exit: Last thread exiting on its own");
                }
        } 
+#ifdef HWPMC_HOOKS
+       /*
+        * If this thread is part of a process that is being tracked by 
hwpmc(4),
+        * inform the module of the thread's impending exit.
+        */
+       if (PMC_PROC_IS_USING_PMCS(td->td_proc))
+               PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT);
+#endif
        PROC_UNLOCK(p);
        thread_lock(td);
        /* Save our tick information with both the thread and proc locked */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to