]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm/rmap: try_to_migrate() skip zone_device !device_private
authorHugh Dickins <hughd@google.com>
Wed, 7 Jul 2021 20:13:33 +0000 (13:13 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 11 Jul 2021 22:05:15 +0000 (15:05 -0700)
I know nothing about zone_device pages and !device_private pages; but if
try_to_migrate_one() will do nothing for them, then it's better that
try_to_migrate() filter them first, than trawl through all their vmas.

Signed-off-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Reviewed-by: Alistair Popple <apopple@nvidia.com>
Link: https://lore.kernel.org/lkml/1241d356-8ec9-f47b-a5ec-9b2bf66d242@google.com/
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/rmap.c

index 1235368f06282a3061cfaf90eca4b87df6fae58a..795f9d5f8386360be2eed9d7a31345aa7803f04b 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1703,9 +1703,6 @@ static bool try_to_migrate_one(struct page *page, struct vm_area_struct *vma,
        struct mmu_notifier_range range;
        enum ttu_flags flags = (enum ttu_flags)(long)arg;
 
-       if (is_zone_device_page(page) && !is_device_private_page(page))
-               return true;
-
        /*
         * When racing against e.g. zap_pte_range() on another cpu,
         * in between its ptep_get_and_clear_full() and page_remove_rmap(),
@@ -1944,6 +1941,9 @@ void try_to_migrate(struct page *page, enum ttu_flags flags)
                                        TTU_SYNC)))
                return;
 
+       if (is_zone_device_page(page) && !is_device_private_page(page))
+               return;
+
        /*
         * During exec, a temporary VMA is setup and later moved.
         * The VMA is moved under the anon_vma lock but not the