diff options
author | Adam Litke <agl@us.ibm.com> | 2007-11-14 19:59:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-14 21:45:40 -0500 |
commit | c79fb75e5a514a5a35f22c229042aa29f4237e3a (patch) | |
tree | 012e5610e814ed938628af84ffa7c4775db113e2 /fs | |
parent | 348ea204cc23cda35faf962414b674c57da647d7 (diff) |
hugetlb: fix quota management for private mappings
The hugetlbfs quota management system was never taught to handle MAP_PRIVATE
mappings when that support was added. Currently, quota is debited at page
instantiation and credited at file truncation. This approach works correctly
for shared pages but is incomplete for private pages. In addition to
hugetlb_no_page(), private pages can be instantiated by hugetlb_cow(); but
this function does not respect quotas.
Private huge pages are treated very much like normal, anonymous pages. They
are not "backed" by the hugetlbfs file and are not stored in the mapping's
radix tree. This means that private pages are invisible to
truncate_hugepages() so that function will not credit the quota.
This patch (based on a prototype provided by Ken Chen) moves quota crediting
for all pages into free_huge_page(). page->private is used to store a pointer
to the mapping to which this page belongs. This is used to credit quota on
the appropriate hugetlbfs instance.
Signed-off-by: Adam Litke <agl@us.ibm.com>
Cc: Ken Chen <kenchen@google.com>
Cc: Ken Chen <kenchen@google.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: David Gibson <hermes@gibson.dropbear.id.au>
Cc: William Lee Irwin III <wli@holomorphy.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hugetlbfs/inode.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 12aca8ed605f..6513f5655861 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -364,7 +364,6 @@ static void truncate_hugepages(struct inode *inode, loff_t lstart) | |||
364 | ++next; | 364 | ++next; |
365 | truncate_huge_page(page); | 365 | truncate_huge_page(page); |
366 | unlock_page(page); | 366 | unlock_page(page); |
367 | hugetlb_put_quota(mapping); | ||
368 | freed++; | 367 | freed++; |
369 | } | 368 | } |
370 | huge_pagevec_release(&pvec); | 369 | huge_pagevec_release(&pvec); |