Re: RLIMIT_AS maximum is 2GB

Jan Edler (edler@research.nj.nec.com)
Thu, 4 Mar 1999 01:45:52 -0500


So this seems to be about the minimal patch; it just makes the kernel
honor the RLIM_INFINITY value as "unlimited" rather than 2GB-1.
It seems to work. Certainly it is not as good as having a bigger word
or using a larger unit than 1 byte, but neither of those seem like
very palatable alternatives.

Jan Edler

--- old/mm/mmap.c Sun Jan 31 01:52:06 1999
+++ new/mm/mmap.c Thu Mar 4 00:38:19 1999
@@ -289,7 +289,8 @@

/* Check against address space limit. */
if ((mm->total_vm << PAGE_SHIFT) + len
- > current->rlim[RLIMIT_AS].rlim_cur)
+ > current->rlim[RLIMIT_AS].rlim_cur &&
+ current->rlim[RLIMIT_AS].rlim_cur != RLIM_INFINITY)
goto free_vma;

/* Private writable mapping? Check memory availability.. */
--- old/mm/mremap.c Sun Nov 22 12:38:19 1998
+++ new/mm/mremap.c Thu Mar 4 00:38:50 1999
@@ -201,7 +201,8 @@
}
ret = -ENOMEM;
if ((current->mm->total_vm << PAGE_SHIFT) + (new_len - old_len)
- > current->rlim[RLIMIT_AS].rlim_cur)
+ > current->rlim[RLIMIT_AS].rlim_cur &&
+ current->rlim[RLIMIT_AS].rlim_cur != RLIM_INFINITY)
goto out;
/* Private writable mapping? Check memory availability.. */
if ((vma->vm_flags & (VM_SHARED | VM_WRITE)) == VM_WRITE &&
--- old/ipc/shm.c Tue Dec 29 14:21:49 1998
+++ new/ipc/shm.c Thu Mar 4 00:39:24 1999
@@ -405,7 +405,8 @@
/* add new mapping */
tmp = shmd->vm_end - shmd->vm_start;
if((current->mm->total_vm << PAGE_SHIFT) + tmp
- > (unsigned long) current->rlim[RLIMIT_AS].rlim_cur)
+ > (unsigned long) current->rlim[RLIMIT_AS].rlim_cur &&
+ current->rlim[RLIMIT_AS].rlim_cur != RLIM_INFINITY)
return -ENOMEM;
current->mm->total_vm += tmp >> PAGE_SHIFT;
insert_vm_struct(current->mm, shmd);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/