[PATCH 2/2] huge page MAP_NORESERVE review cleanups

From: Andy Whitcroft
Date: Fri May 30 2008 - 12:59:31 EST



Use the new encapsulated huge page offset helper.

Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxx>
---
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);
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/