Do not account for hugetlbfs quota at mmap() time if mapping [SHM|MAP]_NORESERVE
authorMel Gorman <mel@csn.ul.ie>
Wed, 11 Feb 2009 16:34:16 +0000 (16:34 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Feb 2009 20:38:09 +0000 (12:38 -0800)
commit17c9d12e126cb0de8d535dc1908c4819d712bc68
treea1a9a07e2eb70e8c474d3bd040d724413bde9718
parent6c6f1f0f4db31a192916eaa31ec2f114fda7d5e5
Do not account for hugetlbfs quota at mmap() time if mapping [SHM|MAP]_NORESERVE

Commit 5a6fe125950676015f5108fb71b2a67441755003 brought hugetlbfs more
in line with the core VM by obeying VM_NORESERVE and not reserving
hugepages for both shared and private mappings when [SHM|MAP]_NORESERVE
are specified.  However, it is still taking filesystem quota
unconditionally.

At fault time, if there are no reserves and attempt is made to allocate
the page and account for filesystem quota.  If either fail, the fault
fails.  The impact is that quota is getting accounted for twice.  This
patch partially reverts 5a6fe125950676015f5108fb71b2a67441755003.  To
help prevent this mistake happening again, it improves the documentation
of hugetlb_reserve_pages()

Reported-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Acked-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/hugetlb.c