Skip to content

Commit

Permalink
kvm/eventfd: move wildcard calculation outside loop
Browse files Browse the repository at this point in the history
There is no need to calculate wildcard in each iteration
since wildcard is not changed.

Signed-off-by: Yi Li <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
cybertan authored and bonzini committed Sep 28, 2020
1 parent b9757a4 commit 2fc4f15
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion virt/kvm/eventfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down

0 comments on commit 2fc4f15

Please sign in to comment.