Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_thr.c
Show All 23 Lines | |||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_compat.h" | #include "opt_compat.h" | ||||
#include "opt_posix.h" | #include "opt_posix.h" | ||||
#include "opt_hwpmc_hooks.h" | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/priv.h> | #include <sys/priv.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/posix4.h> | #include <sys/posix4.h> | ||||
#include <sys/racct.h> | #include <sys/racct.h> | ||||
#include <sys/resourcevar.h> | #include <sys/resourcevar.h> | ||||
#include <sys/rwlock.h> | #include <sys/rwlock.h> | ||||
#include <sys/sched.h> | #include <sys/sched.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/syscallsubr.h> | #include <sys/syscallsubr.h> | ||||
#include <sys/sysent.h> | #include <sys/sysent.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/sysproto.h> | #include <sys/sysproto.h> | ||||
#include <sys/signalvar.h> | #include <sys/signalvar.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/ucontext.h> | #include <sys/ucontext.h> | ||||
#include <sys/thr.h> | #include <sys/thr.h> | ||||
#include <sys/rtprio.h> | #include <sys/rtprio.h> | ||||
#include <sys/umtx.h> | #include <sys/umtx.h> | ||||
#include <sys/limits.h> | #include <sys/limits.h> | ||||
#ifdef HWPMC_HOOKS | |||||
#include <sys/pmckern.h> | |||||
#endif | |||||
#include <vm/vm_domain.h> | #include <vm/vm_domain.h> | ||||
#include <machine/frame.h> | #include <machine/frame.h> | ||||
#include <security/audit/audit.h> | #include <security/audit/audit.h> | ||||
static SYSCTL_NODE(_kern, OID_AUTO, threads, CTLFLAG_RW, 0, | static SYSCTL_NODE(_kern, OID_AUTO, threads, CTLFLAG_RW, 0, | ||||
▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | if (P_SHOULDSTOP(p)) | ||||
newtd->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK; | newtd->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK; | ||||
/* | /* | ||||
* Copy the existing thread VM policy into the new thread. | * Copy the existing thread VM policy into the new thread. | ||||
*/ | */ | ||||
vm_domain_policy_localcopy(&newtd->td_vm_dom_policy, | vm_domain_policy_localcopy(&newtd->td_vm_dom_policy, | ||||
&td->td_vm_dom_policy); | &td->td_vm_dom_policy); | ||||
#ifdef HWPMC_HOOKS | |||||
if (PMC_PROC_IS_USING_PMCS(p)) { | |||||
PROC_UNLOCK(p); | |||||
PMC_CALL_HOOK(newtd, PMC_FN_THR_CREATE, NULL); | |||||
} else | |||||
#endif | |||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
tidhash_add(newtd); | tidhash_add(newtd); | ||||
thread_lock(newtd); | thread_lock(newtd); | ||||
if (rtp != NULL) { | if (rtp != NULL) { | ||||
if (!(td->td_pri_class == PRI_TIMESHARE && | if (!(td->td_pri_class == PRI_TIMESHARE && | ||||
rtp->type == RTP_PRIO_NORMAL)) { | rtp->type == RTP_PRIO_NORMAL)) { | ||||
▲ Show 20 Lines • Show All 313 Lines • Show Last 20 Lines |