mm: convert folio_estimated_sharers() to folio_likely_mapped_shared()
[linux-2.6-block.git] / mm / migrate.c
index 63c97bb639d75fc9a3716f99f9d11963cfdfce32..a31aa75d223d045715ba48a9b76453f6611fd7ff 100644 (file)
@@ -2593,11 +2593,11 @@ int migrate_misplaced_folio(struct folio *folio, struct vm_area_struct *vma,
        /*
         * Don't migrate file folios that are mapped in multiple processes
         * with execute permissions as they are probably shared libraries.
-        * To check if the folio is shared, ideally we want to make sure
-        * every page is mapped to the same process. Doing that is very
-        * expensive, so check the estimated mapcount of the folio instead.
+        *
+        * See folio_likely_mapped_shared() on possible imprecision when we
+        * cannot easily detect if a folio is shared.
         */
-       if (folio_estimated_sharers(folio) != 1 && folio_is_file_lru(folio) &&
+       if (folio_likely_mapped_shared(folio) && folio_is_file_lru(folio) &&
            (vma->vm_flags & VM_EXEC))
                goto out;