Skip to content

Commit

Permalink
mm/migration: use helper function vma_lookup() in add_page_for_migration
Browse files Browse the repository at this point in the history
We could use helper function vma_lookup() to lookup the needed vma to
simplify the code.

Link: https://lkml.kernel.org/r/20220318111709.60311-6-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Miaohe Lin authored and akpm committed Apr 29, 2022
1 parent b75454e commit cb1c37b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1604,8 +1604,8 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr,

mmap_read_lock(mm);
err = -EFAULT;
vma = find_vma(mm, addr);
if (!vma || addr < vma->vm_start || !vma_migratable(vma))
vma = vma_lookup(mm, addr);
if (!vma || !vma_migratable(vma))
goto out;

/* FOLL_DUMP to ignore special (like zero) pages */
Expand Down

0 comments on commit cb1c37b

Please sign in to comment.