diff options
author | mjg <mjg@FreeBSD.org> | 2015-06-10 10:48:12 +0000 |
---|---|---|
committer | mjg <mjg@FreeBSD.org> | 2015-06-10 10:48:12 +0000 |
commit | d7bc9285a673d676370f95a84ce93ef553c8688c (patch) | |
tree | dbbb077ee034cbfe839c1ba19dbe5ce374a5c6a3 /sys/kern/kern_thread.c | |
parent | 67f2eebb44e1f27017750eddaf5a5ea513cb9c71 (diff) | |
download | FreeBSD-src-d7bc9285a673d676370f95a84ce93ef553c8688c.zip FreeBSD-src-d7bc9285a673d676370f95a84ce93ef553c8688c.tar.gz |
Implement lockless resource limits.
Use the same scheme implemented to manage credentials.
Code needing to look at process's credentials (as opposed to thred's) is
provided with *_proc variants of relevant functions.
Places which possibly had to take the proc lock anyway still use the proc
pointer to access limits.
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r-- | sys/kern/kern_thread.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 2e97553..4343b64 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -389,6 +389,7 @@ thread_cow_get_proc(struct thread *newtd, struct proc *p) PROC_LOCK_ASSERT(p, MA_OWNED); newtd->td_ucred = crhold(p->p_ucred); + newtd->td_limit = lim_hold(p->p_limit); newtd->td_cowgen = p->p_cowgen; } @@ -397,6 +398,7 @@ thread_cow_get(struct thread *newtd, struct thread *td) { newtd->td_ucred = crhold(td->td_ucred); + newtd->td_limit = lim_hold(td->td_limit); newtd->td_cowgen = td->td_cowgen; } @@ -406,6 +408,8 @@ thread_cow_free(struct thread *td) if (td->td_ucred) crfree(td->td_ucred); + if (td->td_limit) + lim_free(td->td_limit); } void @@ -417,6 +421,8 @@ thread_cow_update(struct thread *td) PROC_LOCK(p); if (td->td_ucred != p->p_ucred) cred_update_thread(td); + if (td->td_limit != p->p_limit) + lim_update_thread(td); td->td_cowgen = p->p_cowgen; PROC_UNLOCK(p); } |