diff options
author | Hugh Dickins <hugh@veritas.com> | 2006-10-28 13:38:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-28 14:30:53 -0400 |
commit | ebed4bfc8da8df5b6b0bc4a5064a949f04683509 (patch) | |
tree | 9991be7829c6a03d4a8c3307dae6b43e0f392dc5 /mm | |
parent | 856fc29505556cf263f3dcda2533cf3766c14ab6 (diff) |
[PATCH] hugetlb: fix absurd HugePages_Rsvd
If you truncated an mmap'ed hugetlbfs file, then faulted on the truncated
area, /proc/meminfo's HugePages_Rsvd wrapped hugely "negative". Reinstate my
preliminary i_size check before attempting to allocate the page (though this
only fixes the most obvious case: more work will be needed here).
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: Adam Litke <agl@us.ibm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/hugetlb.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 2dbec90dc3ba..a088f593a807 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -478,6 +478,9 @@ int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
478 | retry: | 478 | retry: |
479 | page = find_lock_page(mapping, idx); | 479 | page = find_lock_page(mapping, idx); |
480 | if (!page) { | 480 | if (!page) { |
481 | size = i_size_read(mapping->host) >> HPAGE_SHIFT; | ||
482 | if (idx >= size) | ||
483 | goto out; | ||
481 | if (hugetlb_get_quota(mapping)) | 484 | if (hugetlb_get_quota(mapping)) |
482 | goto out; | 485 | goto out; |
483 | page = alloc_huge_page(vma, address); | 486 | page = alloc_huge_page(vma, address); |