Skip to content

Commit 2fc4f15

Browse files
cybertanbonzini
authored andcommitted
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>
1 parent b9757a4 commit 2fc4f15

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

virt/kvm/eventfd.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -853,15 +853,17 @@ kvm_deassign_ioeventfd_idx(struct kvm *kvm, enum kvm_bus bus_idx,
853853
struct eventfd_ctx *eventfd;
854854
struct kvm_io_bus *bus;
855855
int ret = -ENOENT;
856+
bool wildcard;
856857

857858
eventfd = eventfd_ctx_fdget(args->fd);
858859
if (IS_ERR(eventfd))
859860
return PTR_ERR(eventfd);
860861

862+
wildcard = !(args->flags & KVM_IOEVENTFD_FLAG_DATAMATCH);
863+
861864
mutex_lock(&kvm->slots_lock);
862865

863866
list_for_each_entry_safe(p, tmp, &kvm->ioeventfds, list) {
864-
bool wildcard = !(args->flags & KVM_IOEVENTFD_FLAG_DATAMATCH);
865867

866868
if (p->bus_idx != bus_idx ||
867869
p->eventfd != eventfd ||

0 commit comments

Comments
 (0)