kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm/eventfd:do wildcard calculation before list_for_each_entry_safe
@ 2020-09-11  5:56 Yi Li
  2020-09-11 17:23 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Yi Li @ 2020-09-11  5:56 UTC (permalink / raw)
  To: pbonzini; +Cc: yilikernel, linux-kernel, kvm, Yi Li

There is no need to calculate wildcard in each loop
since wildcard is not changed.

Signed-off-by: Yi Li <yili@winhong.com>
---
 virt/kvm/eventfd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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  ||
-- 
2.25.3




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kvm/eventfd:do wildcard calculation before list_for_each_entry_safe
  2020-09-11  5:56 [PATCH] kvm/eventfd:do wildcard calculation before list_for_each_entry_safe Yi Li
@ 2020-09-11 17:23 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-09-11 17:23 UTC (permalink / raw)
  To: Yi Li; +Cc: yilikernel, linux-kernel, kvm

On 11/09/20 07:56, Yi Li wrote:
> There is no need to calculate wildcard in each loop
> since wildcard is not changed.
> 
> Signed-off-by: Yi Li <yili@winhong.com>
> ---
>  virt/kvm/eventfd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 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  ||
> 

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-11 17:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11  5:56 [PATCH] kvm/eventfd:do wildcard calculation before list_for_each_entry_safe Yi Li
2020-09-11 17:23 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).