summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi Li <yili@winhong.com>2020-09-11 08:56:52 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2020-09-28 14:57:08 +0300
commit2fc4f15dac952b9bbc2695c9040f2c17be70dabb (patch)
tree38c6d39d5fe56ee2ff7180da3eda78cbbf57b414
parentb9757a4b6f46560cdd65afdb0e44bc06b7e60340 (diff)
downloadlinux-2fc4f15dac952b9bbc2695c9040f2c17be70dabb.tar.xz
kvm/eventfd: move wildcard calculation outside loop
There is no need to calculate wildcard in each iteration since wildcard is not changed. Signed-off-by: Yi Li <yili@winhong.com> Message-Id: <20200911055652.3041762-1-yili@winhong.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--virt/kvm/eventfd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index d6408bb497dc..c2323c27a28b 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -853,15 +853,17 @@ kvm_deassign_ioeventfd_idx(struct kvm *kvm, enum kvm_bus bus_idx,
struct eventfd_ctx *eventfd;
struct kvm_io_bus *bus;
int ret = -ENOENT;
+ bool wildcard;
eventfd = eventfd_ctx_fdget(args->fd);
if (IS_ERR(eventfd))
return PTR_ERR(eventfd);
+ wildcard = !(args->flags & KVM_IOEVENTFD_FLAG_DATAMATCH);
+
mutex_lock(&kvm->slots_lock);
list_for_each_entry_safe(p, tmp, &kvm->ioeventfds, list) {
- bool wildcard = !(args->flags & KVM_IOEVENTFD_FLAG_DATAMATCH);
if (p->bus_idx != bus_idx ||
p->eventfd != eventfd ||