Commit 8fd9e488 authored by Alexander Kuleshov's avatar Alexander Kuleshov Committed by Linus Torvalds

mm/mlock: use offset_in_page macro

linux/mm.h provides offset_in_page() macro.  Let's use already predefined
macro instead of (addr & ~PAGE_MASK).
Signed-off-by: default avatarAlexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ea53cde0
...@@ -560,7 +560,7 @@ static int do_mlock(unsigned long start, size_t len, int on) ...@@ -560,7 +560,7 @@ static int do_mlock(unsigned long start, size_t len, int on)
struct vm_area_struct * vma, * prev; struct vm_area_struct * vma, * prev;
int error; int error;
VM_BUG_ON(start & ~PAGE_MASK); VM_BUG_ON(offset_in_page(start));
VM_BUG_ON(len != PAGE_ALIGN(len)); VM_BUG_ON(len != PAGE_ALIGN(len));
end = start + len; end = start + len;
if (end < start) if (end < start)
...@@ -616,7 +616,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len) ...@@ -616,7 +616,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
lru_add_drain_all(); /* flush pagevec */ lru_add_drain_all(); /* flush pagevec */
len = PAGE_ALIGN(len + (start & ~PAGE_MASK)); len = PAGE_ALIGN(len + (offset_in_page(start)));
start &= PAGE_MASK; start &= PAGE_MASK;
lock_limit = rlimit(RLIMIT_MEMLOCK); lock_limit = rlimit(RLIMIT_MEMLOCK);
...@@ -645,7 +645,7 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len) ...@@ -645,7 +645,7 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
{ {
int ret; int ret;
len = PAGE_ALIGN(len + (start & ~PAGE_MASK)); len = PAGE_ALIGN(len + (offset_in_page(start)));
start &= PAGE_MASK; start &= PAGE_MASK;
down_write(&current->mm->mmap_sem); down_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