On Wed, Dec 20, 2023 at 11:44:27PM +0100, David Hildenbrand wrote: > hugetlb rmap handling differs quite a lot from "ordinary" rmap code. > For example, hugetlb currently only supports entire mappings, and treats > any mapping as mapped using a single "logical PTE". Let's move it out > of the way so we can overhaul our "ordinary" rmap. > implementation/interface. > > Right now we're using page_dup_file_rmap() in some cases where "ordinary" > rmap code would have used page_add_file_rmap(). So let's introduce and > use hugetlb_add_file_rmap() instead. We won't be adding a > "hugetlb_dup_file_rmap()" functon for the fork() case, as it would be > doing the same: "dup" is just an optimization for "add". > > What remains is a single page_dup_file_rmap() call in fork() code. > > Add sanity checks that we end up with the right folios in the right > functions. > > Reviewed-by: Yin Fengwei <fengwei.yin@xxxxxxxxx> > Reviewed-by: Ryan Roberts <ryan.roberts@xxxxxxx> > Signed-off-by: David Hildenbrand <david@xxxxxxxxxx> Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>