diff options
author | trasz <trasz@FreeBSD.org> | 2015-11-15 12:10:51 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2015-11-15 12:10:51 +0000 |
commit | ae1d62cec88b407829500bdbda089bfdb1a116f8 (patch) | |
tree | e99b1082ae89a7ccc5c9b147425c8f65904388a0 /sys/kern/kern_resource.c | |
parent | cd2ea18f1d0c7c51b701eb33ec1dd20e14100138 (diff) | |
download | FreeBSD-src-ae1d62cec88b407829500bdbda089bfdb1a116f8.zip FreeBSD-src-ae1d62cec88b407829500bdbda089bfdb1a116f8.tar.gz |
Speed up rctl operation with large rulesets, by holding the lock
during iteration instead of relocking it for each traversed rule.
Reviewed by: mjg@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D4110
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r-- | sys/kern/kern_resource.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index b6dbab9..4edbcba 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1356,17 +1356,22 @@ uifree(struct uidinfo *uip) #ifdef RACCT void ui_racct_foreach(void (*callback)(struct racct *racct, - void *arg2, void *arg3), void *arg2, void *arg3) + void *arg2, void *arg3), void (*pre)(void), void (*post)(void), + void *arg2, void *arg3) { struct uidinfo *uip; struct uihashhead *uih; rw_rlock(&uihashtbl_lock); + if (pre != NULL) + (pre)(); for (uih = &uihashtbl[uihash]; uih >= uihashtbl; uih--) { LIST_FOREACH(uip, uih, ui_hash) { (callback)(uip->ui_racct, arg2, arg3); } } + if (post != NULL) + (post)(); rw_runlock(&uihashtbl_lock); } #endif |