Skip to content
  • Mel Gorman's avatar
    hugetlb: fix a hugepage reservation check for MAP_SHARED · 7f09ca51
    Mel Gorman authored
    
    
    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: default avatarMel Gorman <mel@csn.ul.ie>
    Acked-by: default avatarAdam Litke <agl@us.ibm.com>
    Acked-by: default avatarAndy Whitcroft <apw@shadowen.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7f09ca51