X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=mm%2Fksm.c;h=cb272b6fde5979ac7814842074462b9fee526c68;hb=refs%2Fheads%2Fsandbox%2Flstelmach%2Fvirgl;hp=c19fcca9bc03dcd9511486000c6cadb11d724c29;hpb=f2e44139f3e0edb8be8821fe4dc93afd7b034182;p=platform%2Fkernel%2Flinux-starfive.git diff --git a/mm/ksm.c b/mm/ksm.c index c19fcca..cb272b6 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -960,9 +960,15 @@ static int unmerge_and_remove_all_rmap_items(void) mm = mm_slot->slot.mm; mmap_read_lock(mm); + + /* + * Exit right away if mm is exiting to avoid lockdep issue in + * the maple tree + */ + if (ksm_test_exit(mm)) + goto mm_exiting; + for_each_vma(vmi, vma) { - if (ksm_test_exit(mm)) - break; if (!(vma->vm_flags & VM_MERGEABLE) || !vma->anon_vma) continue; err = unmerge_ksm_pages(vma, @@ -971,6 +977,7 @@ static int unmerge_and_remove_all_rmap_items(void) goto error; } +mm_exiting: remove_trailing_rmap_items(&mm_slot->rmap_list); mmap_read_unlock(mm);