Date: Sun, 25 Oct 2009 04:34:47 +0000 (UTC) From: Joseph Koshy <jkoshy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r198464 - head/sys/kern Message-ID: <200910250434.n9P4YlhC041029@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkoshy Date: Sun Oct 25 04:34:47 2009 New Revision: 198464 URL: http://svn.freebsd.org/changeset/base/198464 Log: Inform hwpmc(4) of a thread's impending demise prior to invoking sched_throw(). Debugging help: fabient Review and testing by: fabient Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sun Oct 25 02:48:29 2009 (r198463) +++ head/sys/kern/kern_thread.c Sun Oct 25 04:34:47 2009 (r198464) @@ -27,6 +27,7 @@ */ #include "opt_witness.h" +#include "opt_hwpmc_hooks.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); @@ -47,6 +48,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> @@ -417,6 +421,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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910250434.n9P4YlhC041029>