From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Cygwin multithreading performance
Date: Tue, 08 Dec 2015 17:02:00 -0000 [thread overview]
Message-ID: <20151208170244.GA10155@calimero.vinschen.de> (raw)
In-Reply-To: <20151208153438.GL22073@calimero.vinschen.de>
[-- Attachment #1: Type: text/plain, Size: 3257 bytes --]
On Dec 8 16:34, Corinna Vinschen wrote:
> On Dec 8 02:51, Mark Geisert wrote:
> > (Maybe cygwin-developers is a better list for this? It's pretty obscure.)
>
> Yes, cygwin-developers is fine since it's gory implementation details.
>
> > Here are some mutex lock stats I've been talking about providing. These are
> > from the OP's original testcase 'git repack -a -f' running over a clone of
> > the newlib-cygwin source tree. Run on a 2-core, 4-HT machine under Windows
> > 7 x64. I'm running a slightly modified cygwin1.dll that has 3 one-line mods
> > to thread.cc.
>
> Which I'd like to see a patch of, just to know what you mean.
>
> > I'm considering adding the tools that produced these displays to the
> > cygutils package. I'm unsure if the cygwin1.dll mods I've made locally
> > should be shipped generally; I don't know how much extra CPU they use, if
> > any.
>
> Well, let's have a look. This is open source after all :)
>
> > caller 0x018014CC77, count 1, L, /oss/src/winsup/cygwin/thread.cc:475
> > caller 0x018014CD00, count 1, U, /oss/src/winsup/cygwin/thread.cc:496
> > caller 0x018014CDAF, count 432, L, /oss/src/winsup/cygwin/thread.cc:971
> > caller 0x018014CDE6, count 432, U, /oss/src/winsup/cygwin/thread.cc:982
> > caller 0x018014D07E, count 1, L, /oss/src/winsup/cygwin/thread.cc:1946
> > caller 0x018014D090, count 1, U, /oss/src/winsup/cygwin/thread.cc:1951
> > caller 0x018014D7E6, count 1, L, /oss/src/winsup/cygwin/thread.cc:525
> > caller 0x018014D7FF, count 1, U, /oss/src/winsup/cygwin/thread.cc:533
> > caller 0x018014EDD7, count 1, U, /oss/src/winsup/cygwin/thread.cc:2400
> > caller 0x018014EE97, count 1, L, /oss/src/winsup/cygwin/thread.cc:2389
>
> This is interesting. I'm not sure if anything in the rest of the
> output shows how much is wasted on the above two calls, though.
>
> thread.cc:971 and thread.cc:982 are pthread_setcancelstate, and it's
> called pretty often as part of stdio functions. Every stdio function
> which has to lock the FILE structure also calls pthread_setcancelstate
> to disable and reenable cancellation before and after locking. That's
> almost any stdio function.
>
> This may be one of the problems which lower performance, but there's no
> easy or quick way around that, AFAICS.
>
> There's also the fact that, even for tools using __fsetlocking to disable
> stdio locking, pthread_setcancelstate will still be called unconditionally.
> The question here is, if that's wrong and pthread_setcancelstate should be
> skipped if the application sets FSETLOCKING_BYCALLER.
For a start, I simply removed the mutex lock/unlock in calls to
pthread_setcancelstate and pthread_setcanceltype. These locks are
completely unnecessary. These functions are only called for the current
thread anyway.
I'm just creating a developer snapshot which I'll upload to
https://cygwin.com/snapshots/ in half an hour at the latest. Please
have a look if your testcase behaves better now.
Thanks,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-12-08 17:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-14 0:24 Kacper Michajlow
2015-11-19 20:24 ` Mark Geisert
2015-11-20 14:25 ` Kacper Michajlow
2015-11-21 9:21 ` Mark Geisert
2015-11-21 10:53 ` Corinna Vinschen
2015-11-23 7:45 ` Mark Geisert
2015-11-23 10:27 ` John Hein
2015-11-24 1:05 ` Mark Geisert
2015-11-26 9:49 ` Corinna Vinschen
2015-11-26 10:49 ` Mark Geisert
2015-12-05 10:51 ` Mark Geisert
2015-12-05 13:07 ` Kacper Michajlow
2015-12-05 13:59 ` Kacper Michajlow
2015-12-05 22:40 ` Mark Geisert
2015-12-06 2:35 ` Kacper Michajlow
2015-12-06 8:02 ` Mark Geisert
2015-12-06 20:56 ` Kacper Michajlow
2015-12-08 10:51 ` Mark Geisert
2015-12-08 15:34 ` Corinna Vinschen
2015-12-08 17:02 ` Corinna Vinschen [this message]
2015-12-18 15:06 ` Achim Gratz
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=20151208170244.GA10155@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.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 read-only IMAP folder(s) and NNTP newsgroup(s).