summaryrefslogtreecommitdiffstats
path: root/mm/mlock.c
diff options
context:
space:
mode:
authorAlexander Kuleshov <kuleshovmail@gmail.com>2015-11-05 21:46:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 22:34:48 -0500
commit8fd9e4883a2b08c52ec00f3c214b45d096fc697a (patch)
tree5d14eb0eb90f3d60859f5d8016cb7e9eac63f671 /mm/mlock.c
parentea53cde089e07cfd7996c2072f770ebb984ce8db (diff)
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: Alexander Kuleshov <kuleshovmail@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mlock.c')
-rw-r--r--mm/mlock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/mlock.c b/mm/mlock.c
index 7e6ad9c4c549..550228d983cc 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -560,7 +560,7 @@ static int do_mlock(unsigned long start, size_t len, int on)
560 struct vm_area_struct * vma, * prev; 560 struct vm_area_struct * vma, * prev;
561 int error; 561 int error;
562 562
563 VM_BUG_ON(start & ~PAGE_MASK); 563 VM_BUG_ON(offset_in_page(start));
564 VM_BUG_ON(len != PAGE_ALIGN(len)); 564 VM_BUG_ON(len != PAGE_ALIGN(len));
565 end = start + len; 565 end = start + len;
566 if (end < start) 566 if (end < start)
@@ -616,7 +616,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
616 616
617 lru_add_drain_all(); /* flush pagevec */ 617 lru_add_drain_all(); /* flush pagevec */
618 618
619 len = PAGE_ALIGN(len + (start & ~PAGE_MASK)); 619 len = PAGE_ALIGN(len + (offset_in_page(start)));
620 start &= PAGE_MASK; 620 start &= PAGE_MASK;
621 621
622 lock_limit = rlimit(RLIMIT_MEMLOCK); 622 lock_limit = rlimit(RLIMIT_MEMLOCK);
@@ -645,7 +645,7 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
645{ 645{
646 int ret; 646 int ret;
647 647
648 len = PAGE_ALIGN(len + (start & ~PAGE_MASK)); 648 len = PAGE_ALIGN(len + (offset_in_page(start)));
649 start &= PAGE_MASK; 649 start &= PAGE_MASK;
650 650
651 down_write(&current->mm->mmap_sem); 651 down_write(&current->mm->mmap_sem);