All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Alex Bligh <alex@alex.org.uk>
Subject: Re: [Qemu-devel] [PATCH] main-loop: Don't lock starve io-threads when main_loop_tlg has pending events
Date: Tue, 08 Oct 2013 21:21:40 +0200	[thread overview]
Message-ID: <52545B44.70005@redhat.com> (raw)
In-Reply-To: <52545950.5070403@redhat.com>

Hi,

On 10/08/2013 09:13 PM, Paolo Bonzini wrote:
> Il 08/10/2013 21:10, Hans de Goede ha scritto:
>> @@ -480,6 +480,11 @@ int main_loop_wait(int nonblocking)
>>                                         timerlistgroup_deadline_ns(
>>                                             &main_loop_tlg));
>>
>> +    /* When not non-blocking always allow io-threads to acquire the lock */
>> +    if (timeout != 0 && timeout_ns == 0) {
>> +        timeout_ns = 1;
>> +    }
>> +
>
> This _is_ an I/O thread, so I guess this should be changed to "other
> threads".

Ok.

> Also, perhaps timeout_ns can be changed to a higher value
> such as 250 us that were used up to the offending commit?

Wasn't it 1 ms until the offending commit (note 250 us does
sound better to me). More over I wonder how useful is this, if threads
are waiting for the lock at his point, they should all get it and do
work (and then release it) before this thread will be able to re-aquire it.

The only case which I can see where going to sleep will help is when a
thread takes the lock, does some thing, releases it, then does something
else quite quickly (so within 250 us), and then tries to re-aquire the lock
to do more work.

Note either solution (1 ns versus 250 us) is fine with me, I'm by no means
the expert on this, just let me know which one you think is better and I'll
do a v2.

Regards,

Hans

  reply	other threads:[~2013-10-08 19:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08 19:10 [Qemu-devel] [PATCH] main-loop: Don't lock starve io-threads when main_loop_tlg has pending events Hans de Goede
2013-10-08 19:13 ` Paolo Bonzini
2013-10-08 19:21   ` Hans de Goede [this message]
2013-10-08 19:33     ` Alex Bligh
2013-10-08 19:41       ` Hans de Goede
2013-10-08 20:01         ` Alex Bligh
2013-10-08 20:07           ` Alex Bligh
2013-10-08 20:16           ` Hans de Goede
2013-10-08 20:32             ` Alex Bligh
2013-10-08 20:50             ` Paolo Bonzini
2013-10-09 12:58               ` Hans de Goede
2013-10-09 13:18                 ` Alex Bligh
2013-10-09 18:03                   ` Hans de Goede
2013-10-09 18:15                     ` Hans de Goede
2013-10-09 18:28                     ` Alex Bligh
2013-10-09 18:36                       ` Alex Bligh
2013-10-09 18:49                         ` Hans de Goede
2013-10-09 19:03                           ` Paolo Bonzini
2013-10-09 19:15                             ` Hans de Goede
2013-10-09 14:37                 ` Paolo Bonzini
2013-10-09 16:19                   ` Alex Bligh
2013-10-09 16:26                     ` Paolo Bonzini
2013-10-09 16:33                       ` Alex Bligh
2013-10-09 17:53                       ` Hans de Goede
2013-10-09 18:09                   ` Hans de Goede
2013-10-08 19:48 ` Alex Bligh
2013-10-08 20:01   ` Hans de Goede
2013-10-08 21:25     ` Alex Bligh

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=52545B44.70005@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=alex@alex.org.uk \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.