Re: [syzbot] [mm?] WARNING in __folio_rmap_sanity_checks

From: Yin, Fengwei
Date: Fri Jan 05 2024 - 23:36:36 EST




On 1/5/2024 11:45 PM, David Hildenbrand wrote:
vm_normal_page() works on these mappings, so we'd also have to skip rmap
code when unmapping these pages etc. Maybe that's the whole reason we
have the rmap handling here: to not special-case the unmap path.

vm_insert_page() will set VM_MIXEDMAP and vm_normal_page() will skip
the page if CONFIG_ARCH_HAS_PTE_SPECIAL is enabled (it's enabled for
x86).  So the unmap path will skip these kind of folios?

I think we run into the
    if (likely(!pte_special(pte)))
        goto check_pfn;

first and return these folios. That also matches the comment of vm_normal_page: "VM_MIXEDMAP mappings can likewise contain memory with or without ... _all_ pages with a struct page (that is, those where pfn_valid is true) are refcounted and considered normal pages by the VM."
Oh. Yes. This is the path. Thanks a lot for pointing it out to me.


Regards
Yin, Fengwei