From e3a64610bf4f5884baabe5da1ca9e5d664112b1f Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Wed, 4 Aug 2004 18:14:19 +0000 Subject: [PATCH] Annotate locking strategy for 'struct uidinfo'. --- sys/sys/resourcevar.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index d0669f6a9e25..9fb4aa4b97b1 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -85,15 +85,20 @@ struct plimit { #define LIM_UNLOCK(lim) mtx_unlock((lim)->pl_mtx) #define LIM_LOCK_ASSERT(lim, f) mtx_assert((lim)->pl_mtx, (f)) -/* +/*- * Per uid resource consumption + * + * Locking guide: + * (a) Constant from inception + * (b) Locked by ui_mtxp + * (c) Locked by global uihashtbl_mtx */ struct uidinfo { - LIST_ENTRY(uidinfo) ui_hash; - rlim_t ui_sbsize; /* socket buffer space consumed */ - long ui_proccnt; /* number of processes */ - uid_t ui_uid; /* uid */ - u_int ui_ref; /* reference count */ + LIST_ENTRY(uidinfo) ui_hash; /* (c) hash chain of uidinfos */ + rlim_t ui_sbsize; /* (b) socket buffer space consumed */ + long ui_proccnt; /* (b) number of processes */ + uid_t ui_uid; /* (a) uid */ + u_int ui_ref; /* (b) reference count */ struct mtx *ui_mtxp; /* protect all counts/limits */ };