linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [cleanup][PATCH 1/2] mlock_vma_pages_range() never return negative value
@ 2009-12-28  2:45 KOSAKI Motohiro
  2009-12-28  2:46 ` [cleanup][PATCH 2/2] mlock_vma_pages_range() only return success or failure KOSAKI Motohiro
  0 siblings, 1 reply; 2+ messages in thread
From: KOSAKI Motohiro @ 2009-12-28  2:45 UTC (permalink / raw)
  To: LKML, linux-mm, Andrew Morton; +Cc: kosaki.motohiro

Currently, mlock_vma_pages_range() never return negative value. Then, we can
remove some worthless error check.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
 mm/mmap.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 64e0b04..826b0ec 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1247,12 +1247,7 @@ out:
 	mm->total_vm += len >> PAGE_SHIFT;
 	vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT);
 	if (vm_flags & VM_LOCKED) {
-		/*
-		 * makes pages present; downgrades, drops, reacquires mmap_sem
-		 */
 		long nr_pages = mlock_vma_pages_range(vma, addr, addr + len);
-		if (nr_pages < 0)
-			return nr_pages;	/* vma gone! */
 		mm->locked_vm += (len >> PAGE_SHIFT) - nr_pages;
 	} else if ((flags & MAP_POPULATE) && !(flags & MAP_NONBLOCK))
 		make_pages_present(addr, addr + len);
@@ -1730,8 +1725,7 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr)
 	if (!prev || expand_stack(prev, addr))
 		return NULL;
 	if (prev->vm_flags & VM_LOCKED) {
-		if (mlock_vma_pages_range(prev, addr, prev->vm_end) < 0)
-			return NULL;	/* vma gone! */
+		mlock_vma_pages_range(prev, addr, prev->vm_end);
 	}
 	return prev;
 }
@@ -1759,8 +1753,7 @@ find_extend_vma(struct mm_struct * mm, unsigned long addr)
 	if (expand_stack(vma, addr))
 		return NULL;
 	if (vma->vm_flags & VM_LOCKED) {
-		if (mlock_vma_pages_range(vma, addr, start) < 0)
-			return NULL;	/* vma gone! */
+		mlock_vma_pages_range(vma, addr, start);
 	}
 	return vma;
 }
-- 
1.6.5.2



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [cleanup][PATCH 2/2] mlock_vma_pages_range() only return success or failure
  2009-12-28  2:45 [cleanup][PATCH 1/2] mlock_vma_pages_range() never return negative value KOSAKI Motohiro
@ 2009-12-28  2:46 ` KOSAKI Motohiro
  0 siblings, 0 replies; 2+ messages in thread
From: KOSAKI Motohiro @ 2009-12-28  2:46 UTC (permalink / raw)
  To: LKML, linux-mm, Andrew Morton; +Cc: kosaki.motohiro

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 <kosaki.motohiro@jp.fujitsu.com>
---
 mm/mmap.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 826b0ec..0f10176 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1247,8 +1247,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;
-- 
1.6.5.2



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-28  2:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-28  2:45 [cleanup][PATCH 1/2] mlock_vma_pages_range() never return negative value KOSAKI Motohiro
2009-12-28  2:46 ` [cleanup][PATCH 2/2] mlock_vma_pages_range() only return success or failure KOSAKI Motohiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).