[PATCH 2/2] huge page MAP_NORESERVE review cleanups

Previous thread: [PATCH 0/2] hugetlb reservations v4/MAP_NORESERVE V3 cleanups by Andy Whitcroft on Friday, May 30, 2008 - 9:57 am. (1 message)

Next thread: [PATCH 1/2] huge page private reservation review cleanups by Andy Whitcroft on Friday, May 30, 2008 - 9:58 am. (4 messages)
From: Andy Whitcroft
Date: Friday, May 30, 2008 - 9:58 am

Use the new encapsulated huge page offset helper.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
 mm/hugetlb.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 1dce03a..901e580 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -733,8 +733,7 @@ static int vma_needs_reservation(struct vm_area_struct *vma, unsigned long addr)
 	struct inode *inode = mapping->host;
 
 	if (vma->vm_flags & VM_SHARED) {
-		unsigned long idx = ((addr - vma->vm_start) >> HPAGE_SHIFT) +
-				(vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT));
+		pgoff_t idx = vma_pagecache_offset(vma, addr);
 		return region_chg(&inode->i_mapping->private_list,
 							idx, idx + 1);
 
@@ -752,8 +751,7 @@ static void vma_commit_reservation(struct vm_area_struct *vma,
 	struct inode *inode = mapping->host;
 
 	if (vma->vm_flags & VM_SHARED) {
-		unsigned long idx = ((addr - vma->vm_start) >> HPAGE_SHIFT) +
-				(vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT));
+		pgoff_t idx = vma_pagecache_offset(vma, addr);
 		region_add(&inode->i_mapping->private_list, idx, idx + 1);
 	}
 }
--

Previous thread: [PATCH 0/2] hugetlb reservations v4/MAP_NORESERVE V3 cleanups by Andy Whitcroft on Friday, May 30, 2008 - 9:57 am. (1 message)

Next thread: [PATCH 1/2] huge page private reservation review cleanups by Andy Whitcroft on Friday, May 30, 2008 - 9:58 am. (4 messages)