From: KOSAKI Motohiro Date: Fri, 5 Mar 2010 21:41:43 +0000 (-0800) Subject: mm: mlock_vma_pages_range() only return success or failure X-Git-Tag: v3.0~5846 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=06f9d8c2b50060543fb6e0af87ddb86e654dee6b;p=platform%2Fkernel%2Flinux-amlogic.git mm: mlock_vma_pages_range() only return success or failure Currently, mlock_vma_pages_range() only return len or 0. then current error handling of mmap_region() is meaningless complex. This patch makes simplify and makes consist with brk() code. Signed-off-by: KOSAKI Motohiro Cc: Nick Piggin Cc: Lee Schermerhorn Cc: Rik van Riel Cc: KAMEZAWA Hiroyuki Cc: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/mmap.c b/mm/mmap.c index 7acd7b0..c646618 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1265,8 +1265,8 @@ out: mm->total_vm += len >> PAGE_SHIFT; vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT); if (vm_flags & VM_LOCKED) { - long nr_pages = mlock_vma_pages_range(vma, addr, addr + len); - mm->locked_vm += (len >> PAGE_SHIFT) - nr_pages; + if (!mlock_vma_pages_range(vma, addr, addr + len)) + mm->locked_vm += (len >> PAGE_SHIFT); } else if ((flags & MAP_POPULATE) && !(flags & MAP_NONBLOCK)) make_pages_present(addr, addr + len); return addr;