[rh7,4/2] kvm: use _safe version of list iteration in mmu_shrink_scan()

Submitted by Konstantin Khorenko on June 7, 2019, 12:51 p.m.

Details

Message ID 20190607125140.13593-1-khorenko@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Konstantin Khorenko June 7, 2019, 12:51 p.m.
As we skip some VMs during shrink and don't want to iterate them again
and again on each shrink, we move those skipped VMs to the list's tail,
thus we need to use _safe version of list iteration.

Fixes: bb2d7ab43eba ("kvm: move VMs which we skip during shrink to vm_list
tail")
https://jira.sw.ru/browse/PSBM-95077

Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 arch/x86/kvm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 18c7f63fcccd..bd87077b3ad5 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -5349,7 +5349,7 @@  mmu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 
 	spin_lock(&kvm_lock);
 
-	list_for_each_entry(kvm, &vm_list, vm_list) {
+	list_for_each_entry_safe(kvm, &vm_list, vm_list) {
 		int idx;
 		LIST_HEAD(invalid_list);