diff options
author | John Baldwin <jhb@FreeBSD.org> | 2002-10-09 17:17:24 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2002-10-09 17:17:24 +0000 |
commit | 5715307f74621e9e2dcde38412eb6dc54b79d8ad (patch) | |
tree | 3e3a76a37ddfc3f0b9a6307cc20b48df759ba06c /sys/kern/kern_synch.c | |
parent | e7ab2f36839cb4658e277b12feb3fcec37aa99bf (diff) | |
download | src-5715307f74621e9e2dcde38412eb6dc54b79d8ad.tar.gz src-5715307f74621e9e2dcde38412eb6dc54b79d8ad.zip |
- Move p_cpulimit to struct proc from struct plimit and protect it with
sched_lock. This means that we no longer access p_limit in mi_switch()
and the p_limit pointer can be protected by the proc lock.
- Remove PRS_ZOMBIE check from CPU limit test in mi_switch(). PRS_ZOMBIE
processes don't call mi_switch(), and even if they did there is no longer
the danger of p_limit being NULL (which is what the original zombie check
was added for).
- When we bump the current processes soft CPU limit in ast(), just bump the
private p_cpulimit instead of the shared rlimit. This fixes an XXX for
some value of fix. There is still a (probably benign) bug in that this
code doesn't check that the new soft limit exceeds the hard limit.
Inspired by: bde (2)
Notes
Notes:
svn path=/head/; revision=104719
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r-- | sys/kern/kern_synch.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index b0f9d9297cbe..29c383863cf1 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -786,15 +786,9 @@ mi_switch(void) /* * Check if the process exceeds its cpu resource allocation. If * over max, arrange to kill the process in ast(). - * - * XXX The checking for p_limit being NULL here is totally bogus, - * but hides something easy to trip over, as a result of us switching - * after the limit has been freed/set-to-NULL. A KASSERT() will be - * appropriate once this is no longer a bug, to watch for regression. */ - if (p->p_state != PRS_ZOMBIE && p->p_limit != NULL && - p->p_limit->p_cpulimit != RLIM_INFINITY && - p->p_runtime.sec > p->p_limit->p_cpulimit) { + if (p->p_cpulimit != RLIM_INFINITY && + p->p_runtime.sec > p->p_cpulimit) { p->p_sflag |= PS_XCPU; ke->ke_flags |= KEF_ASTPENDING; } |