mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 21:21:09 -04:00
[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 <[email protected]> Cc: Adam Litke <[email protected]> Cc: David Gibson <[email protected]> Cc: "Chen, Kenneth W" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
committed by
Linus Torvalds
parent
856fc29505
commit
ebed4bfc8d
@@ -478,6 +478,9 @@ int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
|
|||||||
retry:
|
retry:
|
||||||
page = find_lock_page(mapping, idx);
|
page = find_lock_page(mapping, idx);
|
||||||
if (!page) {
|
if (!page) {
|
||||||
|
size = i_size_read(mapping->host) >> HPAGE_SHIFT;
|
||||||
|
if (idx >= size)
|
||||||
|
goto out;
|
||||||
if (hugetlb_get_quota(mapping))
|
if (hugetlb_get_quota(mapping))
|
||||||
goto out;
|
goto out;
|
||||||
page = alloc_huge_page(vma, address);
|
page = alloc_huge_page(vma, address);
|
||||||
|
|||||||
Reference in New Issue
Block a user