diff options
author | Hugh Dickins <hugh@veritas.com> | 2006-02-01 06:05:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 11:53:15 -0500 |
commit | 4e6a510a74145585f4111d60d1b5fd450d795dd8 (patch) | |
tree | ff1cb5ba871d6c3f1b90276b865853e20cddefff /fs | |
parent | 9884fd8df195fe48d4e1be2279b419be96127cae (diff) |
[PATCH] mm: hugepage accounting fix
2.6.15's hugepage faulting introduced huge_pages_needed accounting into
hugetlbfs: to count how many pages are already in cache, for spot check on
how far a new mapping may be allowed to extend the file. But it's muddled:
each hugepage found covers HPAGE_SIZE, not PAGE_SIZE. Once pages were
already in cache, it would overshoot, wrap its hugepages count backwards,
and so fail a harmless repeat mapping with -ENOMEM. Fixes the problem
found by Don Dupuis.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Acked-By: Adam Litke <agl@us.ibm.com>
Acked-by: William Irwin <wli@holomorphy.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hugetlbfs/inode.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index f568102da1e8..b35195289945 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -72,8 +72,8 @@ huge_pages_needed(struct address_space *mapping, struct vm_area_struct *vma) | |||
72 | unsigned long start = vma->vm_start; | 72 | unsigned long start = vma->vm_start; |
73 | unsigned long end = vma->vm_end; | 73 | unsigned long end = vma->vm_end; |
74 | unsigned long hugepages = (end - start) >> HPAGE_SHIFT; | 74 | unsigned long hugepages = (end - start) >> HPAGE_SHIFT; |
75 | pgoff_t next = vma->vm_pgoff; | 75 | pgoff_t next = vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT); |
76 | pgoff_t endpg = next + ((end - start) >> PAGE_SHIFT); | 76 | pgoff_t endpg = next + hugepages; |
77 | 77 | ||
78 | pagevec_init(&pvec, 0); | 78 | pagevec_init(&pvec, 0); |
79 | while (next < endpg) { | 79 | while (next < endpg) { |