summaryrefslogtreecommitdiffstats
path: root/sys/sys/resourcevar.h
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2008-03-16 21:29:02 +0000
committerpjd <pjd@FreeBSD.org>2008-03-16 21:29:02 +0000
commit912387399968b156ccbcaafdc3ea3c14379b8bb9 (patch)
treed84d0987afb9cc2d8663e8e1eaa352d805630acc /sys/sys/resourcevar.h
parentea49d310bf69a1de4effcf20fc368f40b3541ef0 (diff)
downloadFreeBSD-src-912387399968b156ccbcaafdc3ea3c14379b8bb9.zip
FreeBSD-src-912387399968b156ccbcaafdc3ea3c14379b8bb9.tar.gz
- Use wait-free method to manage ui_sbsize and ui_proccnt fields in the
uidinfo structure. This entirely removes contention observed on the ui_mtxp mutex (as it is now gone). - Convert the uihashtbl_mtx mutex to a rwlock, as most of the time we just need to read-lock it. Reviewed by: jhb, jeff, kris & others Tested by: kris
Diffstat (limited to 'sys/sys/resourcevar.h')
-rw-r--r--sys/sys/resourcevar.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h
index ea8bbdb..cd80cd4 100644
--- a/sys/sys/resourcevar.h
+++ b/sys/sys/resourcevar.h
@@ -84,21 +84,17 @@ struct plimit {
*
* Locking guide:
* (a) Constant from inception
- * (b) Locked by ui_mtxp
+ * (b) Lockless, updated using atomics
* (c) Locked by global uihashtbl_mtx
*/
struct uidinfo {
LIST_ENTRY(uidinfo) ui_hash; /* (c) hash chain of uidinfos */
- rlim_t ui_sbsize; /* (b) socket buffer space consumed */
+ long 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 */
};
-#define UIDINFO_LOCK(ui) mtx_lock((ui)->ui_mtxp)
-#define UIDINFO_UNLOCK(ui) mtx_unlock((ui)->ui_mtxp)
-
struct proc;
struct rusage_ext;
struct thread;
@@ -107,7 +103,7 @@ void addupc_intr(struct thread *td, uintfptr_t pc, u_int ticks);
void addupc_task(struct thread *td, uintfptr_t pc, u_int ticks);
void calccru(struct proc *p, struct timeval *up, struct timeval *sp);
void calcru(struct proc *p, struct timeval *up, struct timeval *sp);
-int chgproccnt(struct uidinfo *uip, int diff, int maxval);
+int chgproccnt(struct uidinfo *uip, int diff, rlim_t maxval);
int chgsbsize(struct uidinfo *uip, u_int *hiwat, u_int to,
rlim_t maxval);
int fuswintr(void *base);
OpenPOWER on IntegriCloud