From 939deb433656eadcd7e74873a32a38411367cdc8 Mon Sep 17 00:00:00 2001
From: dchagin <dchagin@FreeBSD.org>
Date: Sat, 9 Jan 2016 14:08:10 +0000
Subject: 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
---
 sys/fs/procfs/procfs_status.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'sys/fs/procfs/procfs_status.c')

diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c
index a97e0a9..5a00ee1 100644
--- a/sys/fs/procfs/procfs_status.c
+++ b/sys/fs/procfs/procfs_status.c
@@ -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",
-- 
cgit v1.1