summaryrefslogtreecommitdiffstats
path: root/sys/sys/resourcevar.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2004-07-02 03:50:48 +0000
committerjhb <jhb@FreeBSD.org>2004-07-02 03:50:48 +0000
commitca6f6cfd39b42dad774ba17c48666bb06fd0740a (patch)
tree42012da010219d1aec73a52579d11b3eaafb6e3e /sys/sys/resourcevar.h
parent2c858bc6df28ae0a10387695a8c2001bd49d9b28 (diff)
downloadFreeBSD-src-ca6f6cfd39b42dad774ba17c48666bb06fd0740a.zip
FreeBSD-src-ca6f6cfd39b42dad774ba17c48666bb06fd0740a.tar.gz
Tidy up uprof locking. Mostly the fields are protected by both the proc
lock and sched_lock so they can be read with either lock held. Document the locking as well. The one remaining bogosity is that pr_addr and pr_ticks should be per-thread but profiling of multithreaded apps is currently undefined.
Diffstat (limited to 'sys/sys/resourcevar.h')
-rw-r--r--sys/sys/resourcevar.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h
index 0b9198f..b61b276 100644
--- a/sys/sys/resourcevar.h
+++ b/sys/sys/resourcevar.h
@@ -43,25 +43,31 @@
/*
* Kernel per-process accounting / statistics
* (not necessarily resident except when running).
+ *
+ * Locking key:
+ * b - created at fork, never changes
+ * c - locked by proc mtx
+ * j - locked by sched_lock mtx
+ * k - only accessed by curthread
*/
struct pstats {
#define pstat_startzero p_ru
- struct rusage p_ru; /* stats for this proc */
- struct rusage p_cru; /* sum of stats for reaped children */
- struct itimerval p_timer[3]; /* virtual-time timers */
+ struct rusage p_ru; /* Stats for this process. */
+ struct rusage p_cru; /* Stats for reaped children. */
+ struct itimerval p_timer[3]; /* (j) Virtual-time timers. */
#define pstat_endzero pstat_startcopy
#define pstat_startcopy p_prof
- struct uprof { /* profile arguments */
- caddr_t pr_base; /* buffer base */
- u_long pr_size; /* buffer size */
- u_long pr_off; /* pc offset */
- u_long pr_scale; /* pc scaling */
- u_long pr_addr; /* temp storage for addr until AST */
- u_int pr_ticks; /* temp storage for ticks until AST */
+ 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. */
+ u_long pr_addr; /* (k) Temporary addr until AST. */
+ u_int pr_ticks; /* (k) Temporary ticks until AST. */
} p_prof;
#define pstat_endcopy p_start
- struct timeval p_start; /* starting time */
+ struct timeval p_start; /* (b) Starting time. */
};
#ifdef _KERNEL
OpenPOWER on IntegriCloud