On 13.04.22 20:28, Vlastimil Babka wrote: > On 4/13/22 18:39, David Hildenbrand wrote: >>>> @@ -3035,10 +3083,19 @@ void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw, >>>> >>>> flush_cache_range(vma, address, address + HPAGE_PMD_SIZE); >>>> pmdval = pmdp_invalidate(vma, address, pvmw->pmd); >>>> + >>>> + anon_exclusive = PageAnon(page) && PageAnonExclusive(page); >>>> + if (anon_exclusive && page_try_share_anon_rmap(page)) { >>>> + set_pmd_at(mm, address, pvmw->pmd, pmdval); >>>> + return; >>> >>> I am admittedly not too familiar with this code, but looks like this means >>> we fail to migrate the THP, right? But we don't seem to be telling the >>> caller, which is try_to_migrate_one(), so it will continue and not terminate >>> the walk and return false? >> >> Right, we're not returning "false". Returning "false" would be an >> optimization to make rmap_walk_anon() fail faster. > > Ah right, that's what I missed, it's an optimization and we will realize > elsewhere afterwards that the page has still mappings and we can't migrate... I'll include that patch in v4 (to be tested):