git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stepan Kasal <kasal@ucw.cz>
To: Junio C Hamano <gitster@pobox.com>
Cc: kusmabite@gmail.com, Johannes Sixt <j.sixt@viscovery.net>,
	GIT Mailing-list <git@vger.kernel.org>,
	Theodore Leblond <theodore.leblond@gmail.com>
Subject: Re: [PATCH v2] Sleep 1 millisecond in poll() to avoid busy wait
Date: Tue, 29 Apr 2014 05:47:27 +0200	[thread overview]
Message-ID: <20140429034727.GB15181@camelia.ucw.cz> (raw)
In-Reply-To: <xmqqfvkxqo0l.fsf@gitster.dls.corp.google.com>

Hello Junio,

thank you for pointing out the problems.

Let me explain the background:

After some discussion a one line fix to win32/poll.c was accepted to msysgit/git
at 2012-05-16 https://github.com/msysgit/git/pull/7

The description of the commit looked like this:
> I played around with this [...]
> [...]
> I also tested the very fast local case, and didn't see any measurable
> difference. On a big repo with 4500 files, the upload-pack took about 2
> seconds with and without the fix.
... but there was no sign-off by Theodore.

Because poll.c comes from Gnulib, it was reported there as well.
Paolo Bonzini accepted the fix for poll.c and added a fix for select.
The combined commit got this changelog entry:

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

The patch that I (Stepan) submitted as "v2" combines things like this:
- subject by Theodore
- first paragraph by Paolo, concise problem description
- rest from Theodore's original commit ("I" = Theodore, I suppose)
- diff exctly as in gnulib commit

On Mon, Apr 28, 2014 at 11:58:50AM -0700, Junio C Hamano wrote:
>     Subject: compat/poll: sleep 1 millisecond to avoid busy wait

Thanks for improving it.

>     Signed-off-by: Theodore Leblond <theodore.leblond@gmail.com>
>     Signed-off-by: Stepan Kasal <kasal@ucw.cz>
>     Acked-by: Johannes Sixt <j6t@kdbg.org>
>     Acked-by: Erik Faye-Lund <kusmabite@gmail.com>

Sorry that I forgot to add my sign-off (Stepan).
But I'm afraid I cannot add Theodore's, it was not in the original
commit.  But it is one line change; the real work was the analysis.

Stepan

  reply	other threads:[~2014-04-29  3:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28  8:39 [PATCH] Sleep 1 millisecond in poll() to avoid busy wait Stepan Kasal
2014-04-28  9:07 ` Erik Faye-Lund
2014-04-28 11:38   ` Stepan Kasal
2014-04-28 11:42     ` [PATCH] poll/select: prevent busy-waiting Stepan Kasal
2014-04-28 11:44       ` Erik Faye-Lund
2014-04-28 14:29         ` [PATCH] Windows: Always normalize paths to Windows-style Stepan Kasal
2014-04-28 15:26           ` Stepan Kasal
2014-05-07 18:44           ` Heiko Voigt
2014-05-07 20:40             ` Junio C Hamano
2014-05-08 10:11               ` Stepan Kasal
2014-05-08 20:13                 ` Junio C Hamano
2014-05-08 20:36                   ` [PATCH] Revert "submodules: fix ambiguous absolute paths under Windows" Stepan Kasal
2014-04-28 15:05         ` [PATCH] poll/select: prevent busy-waiting Johannes Sixt
2014-04-28 15:35           ` [PATCH v2] Sleep 1 millisecond in poll() to avoid busy wait Stepan Kasal
2014-04-28 15:37             ` Erik Faye-Lund
2014-04-28 18:58               ` Junio C Hamano
2014-04-29  3:47                 ` Stepan Kasal [this message]
2014-04-29 16:51                   ` Junio C Hamano

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=20140429034727.GB15181@camelia.ucw.cz \
    --to=kasal@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=kusmabite@gmail.com \
    --cc=theodore.leblond@gmail.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).