Skip to contentSkip to conversation

fork: use vma_pages() to simplify the code

PATCH New Huang Shijie 1 participant 1 message May 30, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fork: use vma_pages() to simplify the code

The current code can be replaced by vma_pages().
So use it to simplify the code.

---
 kernel/fork.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/fork.c +1 -1
index 3417e1b..3decf6d 100644
@@ -386,7 +386,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
 		charge = 0;
 		if (mpnt->vm_flags & VM_ACCOUNT) {
 			unsigned long len;
-			len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
+			len = vma_pages(mpnt);
 			if (security_vm_enough_memory_mm(oldmm, len)) /* sic */
 				goto fail_nomem;
 			charge = len;
Signature · 1 line
1.7.4.4