mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]> Cc: Ken Chen <[email protected]> Cc: Ken Chen <[email protected]> Cc: Andy Whitcroft <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David Gibson <[email protected]> Cc: William Lee Irwin III <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
348ea204cc
commit
c79fb75e5a
2 changed files with 10 additions and 4 deletions
|
|
@ -364,7 +364,6 @@ static void truncate_hugepages(struct inode *inode, loff_t lstart)
|
|||
++next;
|
||||
truncate_huge_page(page);
|
||||
unlock_page(page);
|
||||
hugetlb_put_quota(mapping);
|
||||
freed++;
|
||||
}
|
||||
huge_pagevec_release(&pvec);
|
||||
|
|
|
|||
Loading…
Reference in a new issue