summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2000-10-06 13:03:50 +0000
committerdwmalone <dwmalone@FreeBSD.org>2000-10-06 13:03:50 +0000
commit16be903415b6d2c5e4f1e058f61958eaa3ac778b (patch)
treec64472690a5dc06a6046b33d2012457f0e99d7f2 /sys
parent78f27a920c604a0cfbd345813425ee184055fc63 (diff)
downloadFreeBSD-src-16be903415b6d2c5e4f1e058f61958eaa3ac778b.zip
FreeBSD-src-16be903415b6d2c5e4f1e058f61958eaa3ac778b.tar.gz
If a process is over its resource limit for datasize, still allow
it to lower its memory usage. This was mentioned on the mailing lists ages ago, and I've lost the name of the person who brought it up. Reviewed by: alc
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_unix.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c
index d5e9f58..bea87f0 100644
--- a/sys/vm/vm_unix.c
+++ b/sys/vm/vm_unix.c
@@ -73,8 +73,14 @@ obreak(p, uap)
base = round_page((vm_offset_t) vm->vm_daddr);
new = round_page((vm_offset_t)uap->nsize);
+ old = base + ctob(vm->vm_dsize);
if (new > base) {
- if ((new - base) > (unsigned) p->p_rlimit[RLIMIT_DATA].rlim_cur)
+ /*
+ * We check resource limits here, but alow processes to
+ * reduce their usage, even if they remain over the limit.
+ */
+ if (new > old &&
+ (new - base) > (unsigned) p->p_rlimit[RLIMIT_DATA].rlim_cur)
return ENOMEM;
if (new >= VM_MAXUSER_ADDRESS)
return (ENOMEM);
@@ -87,8 +93,6 @@ obreak(p, uap)
return EINVAL;
}
- old = base + ctob(vm->vm_dsize);
-
if (new > old) {
vm_size_t diff;
OpenPOWER on IntegriCloud