Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jan 2016 14:08:11 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r293473 - in stable/10/sys: compat/linux compat/svr4 fs/procfs kern sys
Message-ID:  <201601091408.u09E8BeO092734@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Sat Jan  9 14:08:10 2016
New Revision: 293473
URL: https://svnweb.freebsd.org/changeset/base/293473

Log:
  To facillitate an upcoming Linuxulator merging partially
  MFC r275121 (by kib). Only merge the syntax changes from r275121,
  PROC_*LOCK() macros still lock the same proc spinlock.
  
  The process spin lock currently has the following distinct uses:
  
  - Threads lifetime cycle, in particular, counting of the threads in
    the process, and interlocking with process mutex and thread lock.
    The main reason of this is that turnstile locks are after thread
    locks, so you e.g. cannot unlock blockable mutex (think process
    mutex) while owning thread lock.
  
  - Virtual and profiling itimers, since the timers activation is done
    from the clock interrupt context.  Replace the p_slock by p_itimmtx
    and PROC_ITIMLOCK().
  
  - Profiling code (profil(2)), for similar reason.  Replace the p_slock
    by p_profmtx and PROC_PROFLOCK().
  
  - Resource usage accounting.  Need for the spinlock there is subtle,
    my understanding is that spinlock blocks context switching for the
    current thread, which prevents td_runtime and similar fields from
    changing (updates are done at the mi_switch()).  Replace the p_slock
    by p_statmtx and PROC_STATLOCK().
  
  Discussed with:	kib

Modified:
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/compat/svr4/svr4_misc.c
  stable/10/sys/fs/procfs/procfs_status.c
  stable/10/sys/kern/init_main.c
  stable/10/sys/kern/kern_clock.c
  stable/10/sys/kern/kern_exit.c
  stable/10/sys/kern/kern_proc.c
  stable/10/sys/kern/kern_racct.c
  stable/10/sys/kern/kern_resource.c
  stable/10/sys/kern/kern_thread.c
  stable/10/sys/kern/kern_time.c
  stable/10/sys/kern/subr_prof.c
  stable/10/sys/sys/proc.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_misc.c
==============================================================================
--- stable/10/sys/compat/linux/linux_misc.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/compat/linux/linux_misc.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -691,9 +691,9 @@ linux_times(struct thread *td, struct li
 	if (args->buf != NULL) {
 		p = td->td_proc;
 		PROC_LOCK(p);
-		PROC_SLOCK(p);
+		PROC_STATLOCK(p);
 		calcru(p, &utime, &stime);
-		PROC_SUNLOCK(p);
+		PROC_STATUNLOCK(p);
 		calccru(p, &cutime, &cstime);
 		PROC_UNLOCK(p);
 

Modified: stable/10/sys/compat/svr4/svr4_misc.c
==============================================================================
--- stable/10/sys/compat/svr4/svr4_misc.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/compat/svr4/svr4_misc.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -875,9 +875,9 @@ svr4_sys_times(td, uap)
 
 	p = td->td_proc;
 	PROC_LOCK(p);
-	PROC_SLOCK(p);
+	PROC_STATLOCK(p);
 	calcru(p, &utime, &stime);
-	PROC_SUNLOCK(p);
+	PROC_STATUNLOCK(p);
 	calccru(p, &cutime, &cstime);
 	PROC_UNLOCK(p);
 
@@ -1288,9 +1288,9 @@ loop:
 			pid = p->p_pid;
 			status = p->p_xstat;
 			ru = p->p_ru;
-			PROC_SLOCK(p);
+			PROC_STATLOCK(p);
 			calcru(p, &ru.ru_utime, &ru.ru_stime);
-			PROC_SUNLOCK(p);
+			PROC_STATUNLOCK(p);
 			PROC_UNLOCK(p);
 			sx_sunlock(&proctree_lock);
 
@@ -1315,9 +1315,9 @@ loop:
 			pid = p->p_pid;
 			status = W_STOPCODE(p->p_xstat);
 			ru = p->p_ru;
-			PROC_SLOCK(p);
+			PROC_STATLOCK(p);
 			calcru(p, &ru.ru_utime, &ru.ru_stime);
-			PROC_SUNLOCK(p);
+			PROC_STATUNLOCK(p);
 			PROC_UNLOCK(p);
 
 		        if (((uap->options & SVR4_WNOWAIT)) == 0) {
@@ -1339,9 +1339,9 @@ loop:
 			pid = p->p_pid;
 			ru = p->p_ru;
 			status = SIGCONT;
-			PROC_SLOCK(p);
+			PROC_STATLOCK(p);
 			calcru(p, &ru.ru_utime, &ru.ru_stime);
-			PROC_SUNLOCK(p);
+			PROC_STATUNLOCK(p);
 			PROC_UNLOCK(p);
 
 		        if (((uap->options & SVR4_WNOWAIT)) == 0) {

Modified: stable/10/sys/fs/procfs/procfs_status.c
==============================================================================
--- stable/10/sys/fs/procfs/procfs_status.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/fs/procfs/procfs_status.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -125,9 +125,9 @@ procfs_doprocstatus(PFS_FILL_ARGS)
 	if (p->p_flag & P_INMEM) {
 		struct timeval start, ut, st;
 
-		PROC_SLOCK(p);
+		PROC_STATLOCK(p);
 		calcru(p, &ut, &st);
-		PROC_SUNLOCK(p);
+		PROC_STATUNLOCK(p);
 		start = p->p_stats->p_start;
 		timevaladd(&start, &boottime);
 		sbuf_printf(sb, " %jd,%ld %jd,%ld %jd,%ld",

Modified: stable/10/sys/kern/init_main.c
==============================================================================
--- stable/10/sys/kern/init_main.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/kern/init_main.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -608,9 +608,9 @@ proc0_post(void *dummy __unused)
 	sx_slock(&allproc_lock);
 	FOREACH_PROC_IN_SYSTEM(p) {
 		microuptime(&p->p_stats->p_start);
-		PROC_SLOCK(p);
+		PROC_STATLOCK(p);
 		rufetch(p, &ru);	/* Clears thread stats */
-		PROC_SUNLOCK(p);
+		PROC_STATUNLOCK(p);
 		p->p_rux.rux_runtime = 0;
 		p->p_rux.rux_uticks = 0;
 		p->p_rux.rux_sticks = 0;

Modified: stable/10/sys/kern/kern_clock.c
==============================================================================
--- stable/10/sys/kern/kern_clock.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/kern/kern_clock.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -433,16 +433,16 @@ hardclock_cpu(int usermode)
 	flags = 0;
 	if (usermode &&
 	    timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value)) {
-		PROC_SLOCK(p);
+		PROC_ITIMLOCK(p);
 		if (itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0)
 			flags |= TDF_ALRMPEND | TDF_ASTPENDING;
-		PROC_SUNLOCK(p);
+		PROC_ITIMUNLOCK(p);
 	}
 	if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value)) {
-		PROC_SLOCK(p);
+		PROC_ITIMLOCK(p);
 		if (itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0)
 			flags |= TDF_PROFPEND | TDF_ASTPENDING;
-		PROC_SUNLOCK(p);
+		PROC_ITIMUNLOCK(p);
 	}
 	thread_lock(td);
 	sched_tick(1);
@@ -521,18 +521,18 @@ hardclock_cnt(int cnt, int usermode)
 	flags = 0;
 	if (usermode &&
 	    timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value)) {
-		PROC_SLOCK(p);
+		PROC_ITIMLOCK(p);
 		if (itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL],
 		    tick * cnt) == 0)
 			flags |= TDF_ALRMPEND | TDF_ASTPENDING;
-		PROC_SUNLOCK(p);
+		PROC_ITIMUNLOCK(p);
 	}
 	if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value)) {
-		PROC_SLOCK(p);
+		PROC_ITIMLOCK(p);
 		if (itimerdecr(&pstats->p_timer[ITIMER_PROF],
 		    tick * cnt) == 0)
 			flags |= TDF_PROFPEND | TDF_ASTPENDING;
-		PROC_SUNLOCK(p);
+		PROC_ITIMUNLOCK(p);
 	}
 	thread_lock(td);
 	sched_tick(cnt);

Modified: stable/10/sys/kern/kern_exit.c
==============================================================================
--- stable/10/sys/kern/kern_exit.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/kern/kern_exit.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -660,7 +660,9 @@ exit1(struct thread *td, int rv)
 	/*
 	 * Save our children's rusage information in our exit rusage.
 	 */
+	PROC_STATLOCK(p);
 	ruadd(&p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
+	PROC_STATUNLOCK(p);
 
 	/*
 	 * Make sure the scheduler takes this thread out of its tables etc.
@@ -1044,8 +1046,6 @@ proc_to_reap(struct thread *td, struct p
 		return (0);
 	}
 
-	PROC_SLOCK(p);
-
 	if (siginfo != NULL) {
 		bzero(siginfo, sizeof(*siginfo));
 		siginfo->si_errno = 0;
@@ -1092,7 +1092,9 @@ proc_to_reap(struct thread *td, struct p
 	if (wrusage != NULL) {
 		rup = &wrusage->wru_self;
 		*rup = p->p_ru;
+		PROC_STATLOCK(p);
 		calcru(p, &rup->ru_utime, &rup->ru_stime);
+		PROC_STATUNLOCK(p);
 
 		rup = &wrusage->wru_children;
 		*rup = p->p_stats->p_cru;
@@ -1100,10 +1102,10 @@ proc_to_reap(struct thread *td, struct p
 	}
 
 	if (p->p_state == PRS_ZOMBIE && !check_only) {
+		PROC_SLOCK(p);
 		proc_reap(td, p, status, options);
 		return (-1);
 	}
-	PROC_SUNLOCK(p);
 	PROC_UNLOCK(p);
 	return (1);
 }

Modified: stable/10/sys/kern/kern_proc.c
==============================================================================
--- stable/10/sys/kern/kern_proc.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/kern/kern_proc.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -872,11 +872,11 @@ fill_kinfo_proc_only(struct proc *p, str
 	kp->ki_fibnum = p->p_fibnum;
 	kp->ki_start = p->p_stats->p_start;
 	timevaladd(&kp->ki_start, &boottime);
-	PROC_SLOCK(p);
+	PROC_STATLOCK(p);
 	rufetch(p, &kp->ki_rusage);
 	kp->ki_runtime = cputick2usec(p->p_rux.rux_runtime);
 	calcru(p, &kp->ki_rusage.ru_utime, &kp->ki_rusage.ru_stime);
-	PROC_SUNLOCK(p);
+	PROC_STATUNLOCK(p);
 	calccru(p, &kp->ki_childutime, &kp->ki_childstime);
 	/* Some callers want child times in a single value. */
 	kp->ki_childtime = kp->ki_childstime;
@@ -941,7 +941,7 @@ fill_kinfo_thread(struct thread *td, str
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 
 	if (preferthread)
-		PROC_SLOCK(p);
+		PROC_STATLOCK(p);
 	thread_lock(td);
 	if (td->td_wmesg != NULL)
 		strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg));
@@ -1008,7 +1008,7 @@ fill_kinfo_thread(struct thread *td, str
 	kp->ki_sigmask = td->td_sigmask;
 	thread_unlock(td);
 	if (preferthread)
-		PROC_SUNLOCK(p);
+		PROC_STATUNLOCK(p);
 }
 
 /*

Modified: stable/10/sys/kern/kern_racct.c
==============================================================================
--- stable/10/sys/kern/kern_racct.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/kern/kern_racct.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -1214,11 +1214,11 @@ racctd(void)
 
 			microuptime(&wallclock);
 			timevalsub(&wallclock, &p->p_stats->p_start);
-			PROC_SLOCK(p);
+			PROC_STATLOCK(p);
 			FOREACH_THREAD_IN_PROC(p, td)
 				ruxagg(p, td);
 			runtime = cputick2usec(p->p_rux.rux_runtime);
-			PROC_SUNLOCK(p);
+			PROC_STATUNLOCK(p);
 #ifdef notyet
 			KASSERT(runtime >= p->p_prev_runtime,
 			    ("runtime < p_prev_runtime"));

Modified: stable/10/sys/kern/kern_resource.c
==============================================================================
--- stable/10/sys/kern/kern_resource.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/kern/kern_resource.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -631,11 +631,11 @@ lim_cb(void *arg)
 	 */
 	if (p->p_cpulimit == RLIM_INFINITY)
 		return;
-	PROC_SLOCK(p);
+	PROC_STATLOCK(p);
 	FOREACH_THREAD_IN_PROC(p, td) {
 		ruxagg(p, td);
 	}
-	PROC_SUNLOCK(p);
+	PROC_STATUNLOCK(p);
 	if (p->p_rux.rux_runtime > p->p_cpulimit * cpu_tickrate()) {
 		lim_rlimit(p, RLIMIT_CPU, &rlim);
 		if (p->p_rux.rux_runtime >= rlim.rlim_max * cpu_tickrate()) {
@@ -847,7 +847,7 @@ calcru(struct proc *p, struct timeval *u
 	uint64_t runtime, u;
 
 	PROC_LOCK_ASSERT(p, MA_OWNED);
-	PROC_SLOCK_ASSERT(p, MA_OWNED);
+	PROC_STATLOCK_ASSERT(p, MA_OWNED);
 	/*
 	 * If we are getting stats for the current process, then add in the
 	 * stats that this thread has accumulated in its current time slice.
@@ -879,7 +879,7 @@ rufetchtd(struct thread *td, struct rusa
 	uint64_t runtime, u;
 
 	p = td->td_proc;
-	PROC_SLOCK_ASSERT(p, MA_OWNED);
+	PROC_STATLOCK_ASSERT(p, MA_OWNED);
 	THREAD_LOCK_ASSERT(td, MA_OWNED);
 	/*
 	 * If we are getting stats for the current thread, then add in the
@@ -1015,11 +1015,11 @@ kern_getrusage(struct thread *td, int wh
 		break;
 
 	case RUSAGE_THREAD:
-		PROC_SLOCK(p);
+		PROC_STATLOCK(p);
 		thread_lock(td);
 		rufetchtd(td, rup);
 		thread_unlock(td);
-		PROC_SUNLOCK(p);
+		PROC_STATUNLOCK(p);
 		break;
 
 	default:
@@ -1066,7 +1066,7 @@ ruxagg_locked(struct rusage_ext *rux, st
 {
 
 	THREAD_LOCK_ASSERT(td, MA_OWNED);
-	PROC_SLOCK_ASSERT(td->td_proc, MA_OWNED);
+	PROC_STATLOCK_ASSERT(td->td_proc, MA_OWNED);
 	rux->rux_runtime += td->td_incruntime;
 	rux->rux_uticks += td->td_uticks;
 	rux->rux_sticks += td->td_sticks;
@@ -1096,7 +1096,7 @@ rufetch(struct proc *p, struct rusage *r
 {
 	struct thread *td;
 
-	PROC_SLOCK_ASSERT(p, MA_OWNED);
+	PROC_STATLOCK_ASSERT(p, MA_OWNED);
 
 	*ru = p->p_ru;
 	if (p->p_numthreads > 0)  {
@@ -1117,10 +1117,10 @@ rufetchcalc(struct proc *p, struct rusag
     struct timeval *sp)
 {
 
-	PROC_SLOCK(p);
+	PROC_STATLOCK(p);
 	rufetch(p, ru);
 	calcru(p, up, sp);
-	PROC_SUNLOCK(p);
+	PROC_STATUNLOCK(p);
 }
 
 /*

Modified: stable/10/sys/kern/kern_thread.c
==============================================================================
--- stable/10/sys/kern/kern_thread.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/kern/kern_thread.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -472,6 +472,9 @@ thread_exit(void)
 		PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT);
 #endif
 	PROC_UNLOCK(p);
+	PROC_STATLOCK(p);
+	thread_lock(td);
+	PROC_SUNLOCK(p);
 
 	/* Do the same timestamp bookkeeping that mi_switch() would do. */
 	new_switchtime = cpu_ticks();
@@ -486,9 +489,8 @@ thread_exit(void)
 	td->td_ru.ru_nvcsw++;
 	ruxagg(p, td);
 	rucollect(&p->p_ru, &td->td_ru);
+	PROC_STATUNLOCK(p);
 
-	thread_lock(td);
-	PROC_SUNLOCK(p);
 	td->td_state = TDS_INACTIVE;
 #ifdef WITNESS
 	witness_thread_exit(td);

Modified: stable/10/sys/kern/kern_time.c
==============================================================================
--- stable/10/sys/kern/kern_time.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/kern/kern_time.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -273,10 +273,10 @@ get_process_cputime(struct proc *targetp
 	uint64_t runtime;
 	struct rusage ru;
 
-	PROC_SLOCK(targetp);
+	PROC_STATLOCK(targetp);
 	rufetch(targetp, &ru);
 	runtime = targetp->p_rux.rux_runtime;
-	PROC_SUNLOCK(targetp);
+	PROC_STATUNLOCK(targetp);
 	cputick2timespec(runtime, ats);
 }
 
@@ -325,17 +325,17 @@ kern_clock_gettime(struct thread *td, cl
 		break;
 	case CLOCK_VIRTUAL:
 		PROC_LOCK(p);
-		PROC_SLOCK(p);
+		PROC_STATLOCK(p);
 		calcru(p, &user, &sys);
-		PROC_SUNLOCK(p);
+		PROC_STATUNLOCK(p);
 		PROC_UNLOCK(p);
 		TIMEVAL_TO_TIMESPEC(&user, ats);
 		break;
 	case CLOCK_PROF:
 		PROC_LOCK(p);
-		PROC_SLOCK(p);
+		PROC_STATLOCK(p);
 		calcru(p, &user, &sys);
-		PROC_SUNLOCK(p);
+		PROC_STATUNLOCK(p);
 		PROC_UNLOCK(p);
 		timevaladd(&user, &sys);
 		TIMEVAL_TO_TIMESPEC(&user, ats);
@@ -695,9 +695,9 @@ kern_getitimer(struct thread *td, u_int 
 				timevalsub(&aitv->it_value, &ctv);
 		}
 	} else {
-		PROC_SLOCK(p);
+		PROC_ITIMLOCK(p);
 		*aitv = p->p_stats->p_timer[which];
-		PROC_SUNLOCK(p);
+		PROC_ITIMUNLOCK(p);
 	}
 	return (0);
 }
@@ -779,10 +779,10 @@ kern_setitimer(struct thread *td, u_int 
 		    aitv->it_value.tv_usec != 0 &&
 		    aitv->it_value.tv_usec < tick)
 			aitv->it_value.tv_usec = tick;
-		PROC_SLOCK(p);
+		PROC_ITIMLOCK(p);
 		*oitv = p->p_stats->p_timer[which];
 		p->p_stats->p_timer[which] = *aitv;
-		PROC_SUNLOCK(p);
+		PROC_ITIMUNLOCK(p);
 	}
 	return (0);
 }

Modified: stable/10/sys/kern/subr_prof.c
==============================================================================
--- stable/10/sys/kern/subr_prof.c	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/kern/subr_prof.c	Sat Jan  9 14:08:10 2016	(r293473)
@@ -421,12 +421,12 @@ sys_profil(struct thread *td, struct pro
 	}
 	PROC_LOCK(p);
 	upp = &td->td_proc->p_stats->p_prof;
-	PROC_SLOCK(p);
+	PROC_PROFLOCK(p);
 	upp->pr_off = uap->offset;
 	upp->pr_scale = uap->scale;
 	upp->pr_base = uap->samples;
 	upp->pr_size = uap->size;
-	PROC_SUNLOCK(p);
+	PROC_PROFUNLOCK(p);
 	startprofclock(p);
 	PROC_UNLOCK(p);
 
@@ -466,15 +466,15 @@ addupc_intr(struct thread *td, uintfptr_
 	if (ticks == 0)
 		return;
 	prof = &td->td_proc->p_stats->p_prof;
-	PROC_SLOCK(td->td_proc);
+	PROC_PROFLOCK(td->td_proc);
 	if (pc < prof->pr_off ||
 	    (i = PC_TO_INDEX(pc, prof)) >= prof->pr_size) {
-		PROC_SUNLOCK(td->td_proc);
+		PROC_PROFUNLOCK(td->td_proc);
 		return;			/* out of range; ignore */
 	}
 
 	addr = prof->pr_base + i;
-	PROC_SUNLOCK(td->td_proc);
+	PROC_PROFUNLOCK(td->td_proc);
 	if ((v = fuswintr(addr)) == -1 || suswintr(addr, v + ticks) == -1) {
 		td->td_profil_addr = pc;
 		td->td_profil_ticks = ticks;
@@ -509,15 +509,15 @@ addupc_task(struct thread *td, uintfptr_
 	}
 	p->p_profthreads++;
 	prof = &p->p_stats->p_prof;
-	PROC_SLOCK(p);
+	PROC_PROFLOCK(p);
 	if (pc < prof->pr_off ||
 	    (i = PC_TO_INDEX(pc, prof)) >= prof->pr_size) {
-		PROC_SUNLOCK(p);
+		PROC_PROFUNLOCK(p);
 		goto out;
 	}
 
 	addr = prof->pr_base + i;
-	PROC_SUNLOCK(p);
+	PROC_PROFUNLOCK(p);
 	PROC_UNLOCK(p);
 	if (copyin(addr, &v, sizeof(v)) == 0) {
 		v += ticks;

Modified: stable/10/sys/sys/proc.h
==============================================================================
--- stable/10/sys/sys/proc.h	Sat Jan  9 13:52:57 2016	(r293472)
+++ stable/10/sys/sys/proc.h	Sat Jan  9 14:08:10 2016	(r293473)
@@ -616,6 +616,18 @@ struct proc {
 #define	PROC_SUNLOCK(p)	mtx_unlock_spin(&(p)->p_slock)
 #define	PROC_SLOCK_ASSERT(p, type)	mtx_assert(&(p)->p_slock, (type))
 
+#define	PROC_STATLOCK(p)	mtx_lock_spin(&(p)->p_slock)
+#define	PROC_STATUNLOCK(p)	mtx_unlock_spin(&(p)->p_slock)
+#define	PROC_STATLOCK_ASSERT(p, type)	mtx_assert(&(p)->p_slock, (type))
+
+#define	PROC_ITIMLOCK(p)	mtx_lock_spin(&(p)->p_slock)
+#define	PROC_ITIMUNLOCK(p)	mtx_unlock_spin(&(p)->p_slock)
+#define	PROC_ITIMLOCK_ASSERT(p, type)	mtx_assert(&(p)->p_slock, (type))
+
+#define	PROC_PROFLOCK(p)	mtx_lock_spin(&(p)->p_slock)
+#define	PROC_PROFUNLOCK(p)	mtx_unlock_spin(&(p)->p_slock)
+#define	PROC_PROFLOCK_ASSERT(p, type)	mtx_assert(&(p)->p_slock, (type))
+
 /* These flags are kept in p_flag. */
 #define	P_ADVLOCK	0x00001	/* Process may hold a POSIX advisory lock. */
 #define	P_CONTROLT	0x00002	/* Has a controlling terminal. */



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