Commit e32d96dc authored by Andrew Morton's avatar Andrew Morton Committed by David S. Miller

[PATCH] remove the "half of memory" limit on mlock() and

It seems pretty pointless and people do complain about it occasionally.
parent 6ada8a9c
...@@ -111,16 +111,8 @@ asmlinkage long sys_mlock(unsigned long start, size_t len) ...@@ -111,16 +111,8 @@ asmlinkage long sys_mlock(unsigned long start, size_t len)
lock_limit >>= PAGE_SHIFT; lock_limit >>= PAGE_SHIFT;
/* check against resource limits */ /* check against resource limits */
if (locked > lock_limit) if (locked <= lock_limit)
goto out;
/* we may lock at most half of physical memory... */
/* (this check is pretty bogus, but doesn't hurt) */
if (locked > num_physpages/2)
goto out;
error = do_mlock(start, len, 1); error = do_mlock(start, len, 1);
out:
up_write(&current->mm->mmap_sem); up_write(&current->mm->mmap_sem);
return error; return error;
} }
...@@ -178,14 +170,7 @@ asmlinkage long sys_mlockall(int flags) ...@@ -178,14 +170,7 @@ asmlinkage long sys_mlockall(int flags)
lock_limit >>= PAGE_SHIFT; lock_limit >>= PAGE_SHIFT;
ret = -ENOMEM; ret = -ENOMEM;
if (current->mm->total_vm > lock_limit) if (current->mm->total_vm <= lock_limit)
goto out;
/* we may lock at most half of physical memory... */
/* (this check is pretty bogus, but doesn't hurt) */
if (current->mm->total_vm > num_physpages/2)
goto out;
ret = do_mlockall(flags); ret = do_mlockall(flags);
out: out:
up_write(&current->mm->mmap_sem); up_write(&current->mm->mmap_sem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment