diff options
author | Hillf Danton <dhillf@gmail.com> | 2012-01-10 18:08:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 19:30:45 -0500 |
commit | 0c176d52b0b2619f231b2bbf329b90c028134f58 (patch) | |
tree | 540d2b64a9efe0cd307c04fecedf72e5f3875260 /mm/hugetlb.c | |
parent | 86cfd3a45042ab242d47f3935a02811a402beab6 (diff) |
mm: hugetlb: fix pgoff computation when unmapping page from vma
The computation for pgoff is incorrect, at least with
(vma->vm_pgoff >> PAGE_SHIFT)
involved. It is fixed with the available method if HPAGE_SIZE is
concerned in page cache lookup.
[akpm@linux-foundation.org: use vma_hugecache_offset() directly, per Michal]
Signed-off-by: Hillf Danton <dhillf@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Michal Hocko <mhocko@suse.cz>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r-- | mm/hugetlb.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ab89d6f382d1..bb7dc405634f 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -2315,8 +2315,7 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2315 | * from page cache lookup which is in HPAGE_SIZE units. | 2315 | * from page cache lookup which is in HPAGE_SIZE units. |
2316 | */ | 2316 | */ |
2317 | address = address & huge_page_mask(h); | 2317 | address = address & huge_page_mask(h); |
2318 | pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) | 2318 | pgoff = vma_hugecache_offset(h, vma, address); |
2319 | + (vma->vm_pgoff >> PAGE_SHIFT); | ||
2320 | mapping = (struct address_space *)page_private(page); | 2319 | mapping = (struct address_space *)page_private(page); |
2321 | 2320 | ||
2322 | /* | 2321 | /* |