summaryrefslogtreecommitdiff
path: root/sys/vm/vm_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/vm/vm_unix.c')
-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 d5e9f58aab60..bea87f07be60 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;