summaryrefslogtreecommitdiffstats
path: root/mm/memory-failure.c
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2022-08-30 20:36:02 +0800
committerAndrew Morton <akpm@linux-foundation.org>2022-09-26 19:46:04 -0700
commit36537a67d3561bfe2b3654161d6c9008fff84d43 (patch)
treee934fba765591216b9d95fbde6f99f2d9e728488 /mm/memory-failure.c
parent21c9e90ab9a4c991d21dd15cc5163c99a885d4a8 (diff)
downloadlinux-36537a67d3561bfe2b3654161d6c9008fff84d43.tar.gz
linux-36537a67d3561bfe2b3654161d6c9008fff84d43.tar.bz2
linux-36537a67d3561bfe2b3654161d6c9008fff84d43.zip
mm, hwpoison: avoid unneeded page_mapped_in_vma() overhead in collect_procs_anon()
If vma->vm_mm != t->mm, there's no need to call page_mapped_in_vma() as add_to_kill() won't be called in this case. Move up the mm check to avoid possible unneeded calling to page_mapped_in_vma(). Link: https://lkml.kernel.org/r/20220830123604.25763-5-linmiaohe@huawei.com Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memory-failure.c')
-rw-r--r--mm/memory-failure.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 01ce87f5706a..cca8264dda1b 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -521,11 +521,11 @@ static void collect_procs_anon(struct page *page, struct list_head *to_kill,
anon_vma_interval_tree_foreach(vmac, &av->rb_root,
pgoff, pgoff) {
vma = vmac->vma;
+ if (vma->vm_mm != t->mm)
+ continue;
if (!page_mapped_in_vma(page, vma))
continue;
- if (vma->vm_mm == t->mm)
- add_to_kill(t, page, FSDAX_INVALID_PGOFF, vma,
- to_kill);
+ add_to_kill(t, page, FSDAX_INVALID_PGOFF, vma, to_kill);
}
}
read_unlock(&tasklist_lock);