[prev in list] [next in list] [prev in thread] [next in thread]
List: git
Subject: Re: [PATCH] poll/select: prevent busy-waiting
From: Johannes Sixt <j.sixt () viscovery ! net>
Date: 2014-04-28 15:05:47
Message-ID: 535E6E4B.6070308 () viscovery ! net
[Download RAW message or body]
Am 4/28/2014 13:44, schrieb Erik Faye-Lund:
> On Mon, Apr 28, 2014 at 1:42 PM, Stepan Kasal <kasal@ucw.cz> wrote:
>> From: Paolo Bonzini <bonzini@gnu.org>
>> Date: Mon, 21 May 2012 09:52:42 +0200
>>
>> Backported from Gnulib.
>>
>> 2012-05-21 Paolo Bonzini <bonzini@gnu.org>
>>
>> poll/select: prevent busy-waiting. SwitchToThread() only gives away
>> the rest of the current time slice to another thread in the current
>> process. So if the thread that feeds the file decscriptor we're
>> polling is not in the current process, we get busy-waiting.
>> * lib/poll.c: Use SleepEx(1, TRUE) instead of SwitchToThread().
>> Patch from Theodore Leblond.
>> * lib/select.c: Split polling out of the loop that sets the output
>> fd_sets. Check for zero result and loop if the wait timeout is
>> infinite.
>>
>> Signed-off-by: Stepan Kasal <kasal@ucw.cz>
>> ---
>> compat/poll/poll.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/compat/poll/poll.c b/compat/poll/poll.c
>> index 31163f2..a9b41d8 100644
>> --- a/compat/poll/poll.c
>> +++ b/compat/poll/poll.c
>> @@ -605,7 +605,7 @@ restart:
>>
>> if (!rc && timeout == INFTIM)
>> {
>> - SwitchToThread();
>> + SleepEx (1, TRUE);
>> goto restart;
>> }
>>
>> --
>> 1.9.2.msysgit.0.158.g6070cee
>>
>
> Thanks for taking the effort!
>
> Acked-by: Erik Faye-Lund <kusmabite@gmail.com>
The patch text has my ACK, too (I've been using it since 2 years now), but
I very much prefer the commit message of the earlier post. GNU standards
w.r.t. commit messages are simply sub-par. ;-)
-- Hannes
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic