Skip to content

Commit

Permalink
kvm: exit halt polling on need_resched() as well
Browse files Browse the repository at this point in the history
single_task_running() is usually more general than need_resched()
but CFS_BANDWIDTH throttling will use resched_task() when there
is just one task to get the task to block. This was causing
long-need_resched warnings and was likely allowing VMs to
overrun their quota when halt polling.

Signed-off-by: Ben Segall <[email protected]>
Signed-off-by: Venkatesh Srinivas <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Cc: [email protected]
Reviewed-by: Jim Mattson <[email protected]>
  • Loading branch information
Benjamin Segall authored and bonzini committed May 3, 2021
1 parent d981dd1 commit 262de41
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2973,7 +2973,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
goto out;
}
poll_end = cur = ktime_get();
} while (single_task_running() && ktime_before(cur, stop));
} while (single_task_running() && !need_resched() &&
ktime_before(cur, stop));
}

prepare_to_rcuwait(&vcpu->wait);
Expand Down

0 comments on commit 262de41

Please sign in to comment.