Remove several uses of mlock_drain_local(): they were workarounds for when that sequence of operations tended to leave folios in mlock_fbatch with debilitating raised refcount (and no good if the task changed CPU). Signed-off-by: Hugh Dickins --- mm/huge_memory.c | 2 -- mm/migrate.c | 2 -- mm/rmap.c | 4 ---- 3 files changed, 8 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index c7bd99592195..df6bf69a066b 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3568,8 +3568,6 @@ static bool __discard_anon_folio_pmd_locked(struct vm_area_struct *vma, folio_remove_rmap_pmd(folio, pmd_page(orig_pmd), vma); zap_deposited_table(mm, pmdp); add_mm_counter(mm, MM_ANONPAGES, -HPAGE_PMD_NR); - if (vma->vm_flags & VM_LOCKED) - mlock_drain_local(); folio_put(folio); return true; diff --git a/mm/migrate.c b/mm/migrate.c index 8aaafcea7bc1..6b71b2415d00 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -448,8 +448,6 @@ static bool remove_migration_pte(struct folio *folio, folio_add_file_rmap_pte(folio, new, vma); set_pte_at(vma->vm_mm, pvmw.address, pvmw.pte, pte); } - if (READ_ONCE(vma->vm_flags) & VM_LOCKED) - mlock_drain_local(); trace_remove_migration_pte(pvmw.address, pte_val(pte), compound_order(new)); diff --git a/mm/rmap.c b/mm/rmap.c index 1f72d279ba68..e76823ec4d5e 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -2390,8 +2390,6 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, } finish_unmap: folio_remove_rmap_ptes(folio, page, nr_pages, vma); - if (vma->vm_flags & VM_LOCKED) - mlock_drain_local(); folio_put_refs(folio, nr_pages); /* @@ -2765,8 +2763,6 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, hugetlb_remove_rmap(folio); else folio_remove_rmap_pte(folio, subpage, vma); - if (vma->vm_flags & VM_LOCKED) - mlock_drain_local(); folio_put(folio); } -- 2.51.0