- if (flags & RMAP_EXCLUSIVE)
- SetPageAnonExclusive(page);
- /* While PTE-mapping a THP we have a PMD and a PTE mapping. */
- VM_WARN_ON_FOLIO((atomic_read(&page->_mapcount) > 0 ||
- (folio_test_large(folio) && folio_entire_mapcount(folio) > 1)) &&
- PageAnonExclusive(page), folio);
+
+ if (flags & RMAP_EXCLUSIVE) {
+ switch (mode) {
+ case RMAP_MODE_PTE:
+ for (i = 0; i < nr_pages; i++)
+ SetPageAnonExclusive(page + i);
+ break;
+ case RMAP_MODE_PMD:
+ SetPageAnonExclusive(page);
Just to check; I suppose only setting this on the head is ok, because it's an
exclusive mapping and therefore by definition it can only be mapped by pmd?
Yes. And when PTE-remapping, we will push the flag to all tail pages. No
change in behavior :)
--
Cheers,
David / dhildenb