--- x/mm/rmap.c +++ y/mm/rmap.c @@ -1466,6 +1466,7 @@ static __always_inline void __folio_add_ void folio_add_file_rmap_ptes(struct folio *folio, struct page *page, int nr_pages, struct vm_area_struct *vma) { + BUG_ON(!folio_test_locked(folio)); __folio_add_file_rmap(folio, page, nr_pages, vma, RMAP_LEVEL_PTE); }