diff options
author | Mel Gorman <mel@csn.ul.ie> | 2008-07-24 00:27:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 13:47:19 -0400 |
commit | 7f09ca51e925ba62e9ebfd4979f093e97e38adeb (patch) | |
tree | 58d34768289dce10e32019657c550912fbb37bad /mm/hugetlb.c | |
parent | 0d9ea75443dc7e37843e656b8ebc947a6d16d618 (diff) |
hugetlb: fix a hugepage reservation check for MAP_SHARED
When removing a huge page from the hugepage pool for a fault the system checks
to see if the mapping requires additional pages to be reserved, and if it does
whether there are any unreserved pages remaining. If not, the allocation
fails without even attempting to get a page. In order to determine whether to
apply this check we call vma_has_private_reserves() which tells us if this vma
is MAP_PRIVATE and is the owner. This incorrectly triggers the remaining
reservation test for MAP_SHARED mappings which prevents allocation of the
final page in the pool even though it is reserved for this mapping.
In reality we only want to check this for MAP_PRIVATE mappings where the
process is not the original mapper. Replace vma_has_private_reserves() with
vma_has_reserves() which indicates whether further reserves are required, and
update the caller.
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Acked-by: Adam Litke <agl@us.ibm.com>
Acked-by: Andy Whitcroft <apw@shadowen.org>
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 | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 3e1506b808a..8c20aed62b9 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -342,13 +342,13 @@ void reset_vma_resv_huge_pages(struct vm_area_struct *vma) | |||
342 | } | 342 | } |
343 | 343 | ||
344 | /* Returns true if the VMA has associated reserve pages */ | 344 | /* Returns true if the VMA has associated reserve pages */ |
345 | static int vma_has_private_reserves(struct vm_area_struct *vma) | 345 | static int vma_has_reserves(struct vm_area_struct *vma) |
346 | { | 346 | { |
347 | if (vma->vm_flags & VM_SHARED) | 347 | if (vma->vm_flags & VM_SHARED) |
348 | return 0; | 348 | return 1; |
349 | if (!is_vma_resv_set(vma, HPAGE_RESV_OWNER)) | 349 | if (is_vma_resv_set(vma, HPAGE_RESV_OWNER)) |
350 | return 0; | 350 | return 1; |
351 | return 1; | 351 | return 0; |
352 | } | 352 | } |
353 | 353 | ||
354 | static void clear_huge_page(struct page *page, | 354 | static void clear_huge_page(struct page *page, |
@@ -420,7 +420,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, | |||
420 | * have no page reserves. This check ensures that reservations are | 420 | * have no page reserves. This check ensures that reservations are |
421 | * not "stolen". The child may still get SIGKILLed | 421 | * not "stolen". The child may still get SIGKILLed |
422 | */ | 422 | */ |
423 | if (!vma_has_private_reserves(vma) && | 423 | if (!vma_has_reserves(vma) && |
424 | h->free_huge_pages - h->resv_huge_pages == 0) | 424 | h->free_huge_pages - h->resv_huge_pages == 0) |
425 | return NULL; | 425 | return NULL; |
426 | 426 | ||