+ * Check for and remove any found folios. + * Take hugetlb fault mutex for a set of inode indicies. + if (unlikely(hugetlb_unreserve_pages(inode, index, + hugetlb_delete_from_page_cache(&folio->page) + VM_BUG_ON(HPageRestoreReserve(&folio->page)) + * reserve usage count can need to be adjusted. + * rare out of memory conditions, removal of the region/reserve + * the region/ reserve map (hugetlb_unreserve_pages). + * We must remove the folio from page cache before removing + * We could have raced with page fault populate and + * After locking page, make sure mapping is the same. + hugetlb_vmdelete_list(&mapping->i_mmap, + * If folio is mapped, it was faulted in after being View detailed information about property County Road B-28 Bernal Area, Bernal, NM 87569 including listing details, property photos, school and neighborhood data, and much more. +static bool remove_inode_single_folio(struct hstate *h, struct inode *inode, + * Returns true if page was actually removed, false otherwise. + * Called with hugetlb fault mutex held. +++ -411,6 +411,95 hugetlb_vmdelete_list(struct rb_root_cached *root, pgoff_t start, pgoff_t end, The bulk lookup, it will need to lookup individual folios to check forįs/hugetlbfs/inode.c | 184 +++++++++++++++++++++++++++++++-Ģ files changed, 152 insertions(+), 73 deletions(-)ĭiff -git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c Note, for performance reasons remove_inode_hugepages will still useįilemap_get_folios for bulk folio lookups. Truncate code will remove page when it obtains fault mutex. If fault codeĭoes not see updated i_size, it will add page beyond i_size and Ifįault code sees updated i_size it will abort early. truncate updates i_size, but fault code obtains mutex first. When truncate code takes mutex for page/index, it will remove the fault code obtains mutex, and truncate updates i_size after earlyĬhecks in fault code. After fault code takes mutex, it will notice fault beyond ![]() truncate code updates i_size and takes fault mutex before a racingįault. ![]() Is called in the truncate path after updating i_size, we can experience Range (or hole in the case of hole punch). Such that it will take the fault mutex for EVERY index in the truncated Significant change is modification of the routine remove_inode_hugepages Instead of trying to catch and backout all such races, use the hugetlbįault mutex to handle truncate racing with page faults. However, it becomes much more difficult to handle whenĭiscovered later after allocating the page and consuming reservationsĪnd adding to the page cache. When discovered early, it is easy to abort the fault and Page (huegtlb_no_page), it checks early to determine if the fault isīeyond i_size. When page fault code needs to allocate and instantiate a new hugetlb Shutemov", Davidlohr Bueso, Prakash Sangappa, James Houghton, Mina Almasry, Pasha Tatashin, Axel Rasmussen, Ray Fucillo, Andrew Morton, Mike Kravetz Cc: Muchun Song, Miaohe Lin, David Hildenbrand, Michal Hocko, Peter Xu, Naoya Horiguchi, "Aneesh Kumar K.To: Subject: hugetlb: handle truncate racing with page faults.Hugetlb: handle truncate racing with page faults - Linux Kernel hugetlb: handle truncate racing with page faults
0 Comments
Leave a Reply. |