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
This commit is contained in:
parent
016f1c3e23
commit
a77c9610f2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66748
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user