summaryrefslogtreecommitdiffstats
path: root/sys/sys/resourcevar.h
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-11-26 14:10:00 +0000
committerkib <kib@FreeBSD.org>2014-11-26 14:10:00 +0000
commit11cee2ecf718fa761131860c639d7818651056ec (patch)
treea1ba3d51716b09fd5fc82995da8ea68bc729c69f /sys/sys/resourcevar.h
parent4501dadd00cece6d06392c42e5fc6af07731e451 (diff)
downloadFreeBSD-src-11cee2ecf718fa761131860c639d7818651056ec.zip
FreeBSD-src-11cee2ecf718fa761131860c639d7818651056ec.tar.gz
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(). The split is done mostly for code clarity, and should not affect scalability. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week
Diffstat (limited to 'sys/sys/resourcevar.h')
-rw-r--r--sys/sys/resourcevar.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h
index a24e89a..a07fdf8 100644
--- a/sys/sys/resourcevar.h
+++ b/sys/sys/resourcevar.h
@@ -47,21 +47,22 @@
* Locking key:
* b - created at fork, never changes
* c - locked by proc mtx
- * j - locked by proc slock
* k - only accessed by curthread
+ * w - locked by proc itim lock
+ * w2 - locked by proc prof lock
*/
struct pstats {
#define pstat_startzero p_cru
struct rusage p_cru; /* Stats for reaped children. */
- struct itimerval p_timer[3]; /* (j) Virtual-time timers. */
+ struct itimerval p_timer[3]; /* (w) Virtual-time timers. */
#define pstat_endzero pstat_startcopy
#define pstat_startcopy p_prof
struct uprof { /* Profile arguments. */
- caddr_t pr_base; /* (c + j) Buffer base. */
- u_long pr_size; /* (c + j) Buffer size. */
- u_long pr_off; /* (c + j) PC offset. */
- u_long pr_scale; /* (c + j) PC scaling. */
+ caddr_t pr_base; /* (c + w2) Buffer base. */
+ u_long pr_size; /* (c + w2) Buffer size. */
+ u_long pr_off; /* (c + w2) PC offset. */
+ u_long pr_scale; /* (c + w2) PC scaling. */
} p_prof;
#define pstat_endcopy p_start
struct timeval p_start; /* (b) Starting time. */
OpenPOWER on IntegriCloud