qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] iohandler: Add Linux implementation of iohandler GSource
Date: Thu, 25 Sep 2014 21:45:40 +0200	[thread overview]
Message-ID: <542470E4.6060402@redhat.com> (raw)
In-Reply-To: <1411665709-2052-3-git-send-email-famz@redhat.com>

Il 25/09/2014 19:21, Fam Zheng ha scritto:
> +    while (true) {
> +        r = epoll_pwait(s->epollfd.fd, events, MAX_EVENTS, 0, &origmask);

You can save a syscall by doing this just once.  You would just get a
readable epoll file descriptor on the next main loop iteration.  Also,
origmask is an input parameter, so you need to use epoll_wait.

Also, as an extra optimization perhaps you can make a second list with
iohandlers that were modified or have a read_poll handler, and only call
iohandler_get_events on that one.

Perhaps this together lowers the cost of epoll enough to more easily
reach the break-even point.

Though I wonder if it would be acceptable to make ioeventfd off by
default for virtio-serial...

Thanks,

Paolo

> +        if (r < 0) {
> +            break;
> +        } else if (r == 0) {
> +            break;
> +        } else {
> +            for (i = 0; i < r; i++) {
> +                iohandler_dispatch_event(s, &events[i]);
> +            }
> +            if (r < MAX_EVENTS) {
> +                break;
> +            }
> +        }
> +    }
> +

  reply	other threads:[~2014-09-25 19:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-25 17:21 [Qemu-devel] [PATCH 0/2] iohandler: Convert to GSource and use epoll on Linux Fam Zheng
2014-09-25 17:21 ` [Qemu-devel] [PATCH 1/2] iohandler: Convert I/O handler to GSource Fam Zheng
2014-09-25 17:21 ` [Qemu-devel] [PATCH 2/2] iohandler: Add Linux implementation of iohandler GSource Fam Zheng
2014-09-25 19:45   ` Paolo Bonzini [this message]
2014-09-26  1:23     ` Fam Zheng
2014-09-26  7:42       ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=542470E4.6060402@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).