Skip to content

Commit 48c963e

Browse files
Jiang YiMarc Zyngier
authored andcommitted
KVM: arm/arm64: Release kvm->mmu_lock in loop to prevent starvation
Do cond_resched_lock() in stage2_flush_memslot() like what is done in unmap_stage2_range() and other places holding mmu_lock while processing a possibly large range of memory. Signed-off-by: Jiang Yi <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 892713e commit 48c963e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/arm64/kvm/mmu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ static void stage2_flush_memslot(struct kvm *kvm,
422422
next = stage2_pgd_addr_end(kvm, addr, end);
423423
if (!stage2_pgd_none(kvm, *pgd))
424424
stage2_flush_puds(kvm, pgd, addr, next);
425+
426+
if (next != end)
427+
cond_resched_lock(&kvm->mmu_lock);
425428
} while (pgd++, addr = next, addr != end);
426429
}
427430

0 commit comments

Comments
 (0)