aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/racct.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2018-12-07 16:47:34 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2018-12-07 16:47:34 +0000
commit448db4f761b6bd0c4099ce1aa08a7562bc09ebb8 (patch)
tree85002640706bb71796412097ed9739de1399af89 /sys/sys/racct.h
parent82f4b826347e72f3963df37c1be4daf7052b112b (diff)
downloadsrc-448db4f761b6bd0c4099ce1aa08a7562bc09ebb8.tar.gz
src-448db4f761b6bd0c4099ce1aa08a7562bc09ebb8.zip
racct: add RACCT_ENABLED macro and racct_set_unlocked
This allows to remove PROC_LOCK/UNLOCK pairs spread thorought the kernel only used to appease racct_set. Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=341701
Diffstat (limited to 'sys/sys/racct.h')
-rw-r--r--sys/sys/racct.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/sys/racct.h b/sys/sys/racct.h
index 57291e1d45ba..17af3276d691 100644
--- a/sys/sys/racct.h
+++ b/sys/sys/racct.h
@@ -164,12 +164,14 @@ extern struct mtx racct_lock;
#define RACCT_UNLOCK() mtx_unlock(&racct_lock)
#define RACCT_LOCK_ASSERT() mtx_assert(&racct_lock, MA_OWNED)
+#define RACCT_ENABLED() __predict_false(racct_enable)
+
#define RACCT_PROC_LOCK(p) do { \
- if (__predict_false(racct_enable)) \
+ if (RACCT_ENABLED()) \
PROC_LOCK(p); \
} while (0)
#define RACCT_PROC_UNLOCK(p) do { \
- if (__predict_false(racct_enable)) \
+ if (RACCT_ENABLED()) \
PROC_UNLOCK(p); \
} while (0)
@@ -178,6 +180,7 @@ void racct_add_cred(struct ucred *cred, int resource, uint64_t amount);
void racct_add_force(struct proc *p, int resource, uint64_t amount);
void racct_add_buf(struct proc *p, const struct buf *bufp, int is_write);
int racct_set(struct proc *p, int resource, uint64_t amount);
+int racct_set_unlocked(struct proc *p, int resource, uint64_t amount);
void racct_set_force(struct proc *p, int resource, uint64_t amount);
void racct_sub(struct proc *p, int resource, uint64_t amount);
void racct_sub_cred(struct ucred *cred, int resource, uint64_t amount);