diff options
author | David Malone <dwmalone@FreeBSD.org> | 2000-10-06 13:03:50 +0000 |
---|---|---|
committer | David Malone <dwmalone@FreeBSD.org> | 2000-10-06 13:03:50 +0000 |
commit | a77c9610f2f1968aa6e4ef0a6be80ce0ad7a03ae (patch) | |
tree | a7fae1032e06e28a0e9fa598ba92f87be818e2a4 /sys/vm/vm_unix.c | |
parent | 016f1c3e2310ecaf549eb9e64ec0c853489da142 (diff) |
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
Notes
Notes:
svn path=/head/; revision=66748
Diffstat (limited to 'sys/vm/vm_unix.c')
-rw-r--r-- | sys/vm/vm_unix.c | 10 |
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; |