public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Mark Geisert <mark@maxrnd.com>
To: cygwin-developers@cygwin.com
Subject: Maybe consider rpmalloc -- Was: Re: Cygwin malloc tune-up status
Date: Thu, 1 Apr 2021 22:45:49 -0700	[thread overview]
Message-ID: <ed2ba744-2d89-e9a5-2f1f-9ac4d4ca8898@maxrnd.com> (raw)
In-Reply-To: <CAEHcbmdj=TeUhO+MVwf6QcKZTRX6d2_bHwaPF6Yu1iWMy0fsEw@mail.gmail.com>

Hi Teemu,

Teemu Nätkinniemi via Cygwin-developers wrote:
> Hi!
> 
> I encounter a problem with Cygwin's malloc and remembered this thread.
> Sorry if this is off-topic.

New topic, so new thread :-)

> I have been trying to port bwa aligner to Cygwin. Initially everything
> seemed to work but for some reason in some cases threading didn't seem
> to work properly. I got a fix recently from a third party which was to
> force bwa to use rpmalloc.
> 
> This got me thinking if there is a problem with Cygwin's malloc in
> some cases and if there were people in this list who might be
> interested in knowing that the problem exists. >
> Here's a link to the rpmalloc fix.
> 
> https://github.com/WGSExtract/bwa/commit/3087fa876b079fcb6a0a58f1e01757f4820094a8
> 
> Here's a test case:
> 
> bwa_original mem -t 10 bwa_reference/hs37d5.fa ERS4238880_1.fastq > test.sam
> 
> bwa_working mem -t 10 bwa_reference/hs37d5.fa ERS4238880_1.fastq > test.sam
> 
> Files:
> 
> https://drive.google.com/drive/folders/1waICih51f4mHZEyWY1onyEcKqm0kj3Yt?usp=sharing

I'm not aware of anything actually being broken in the current Cygwin malloc 
(which is just the most recent dlmalloc), even in multi-threaded workloads.  It's 
only that there has long been interest around possibilities of making it faster. 
So far I've been unsuccessful: though I can get the Cygwin-level malloc operation 
faster by using other malloc's, it has always been overshadowed by a lot more time 
being spent in ntdll.dll underneath.  There's no point releasing something 
cosmetically better but slower in practice.

Thanks for mentioning rpmalloc; that's a new one to me.  It does appear to be 
coded nicely, like most of the other malloc's I've looked at.  I'll see if I can 
get that to work with Cygwin; the big issue tends to be fork() having to replicate 
the parent malloc layout, book-keeping as well as app data, in the child.

I will point out that you're not using rpmalloc as it would work on Cygwin, you've 
got a Windows-flavored rpmalloc because you've #defined _WIN32 and such via the 
Makefile.cygwin.  But it appears to be a clean break with Cygwin's malloc in your 
application, so congrats on that.

I understand that you've solved what you think was a Cygwin malloc issue by using 
rpmalloc, but I don't see how you came to the conclusion that it was a malloc 
issue, as opposed to something else with threads or beyond that.
Thanks again,

..mark

  reply	other threads:[~2021-04-02  5:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25  6:01 Mark Geisert
2020-09-27 16:54 ` Johannes Schindelin
2020-09-29  2:22   ` Mark Geisert
2021-04-01  9:19     ` Teemu Nätkinniemi
2021-04-02  5:45       ` Mark Geisert [this message]
2021-04-03  2:53         ` Maybe consider rpmalloc Mark Geisert
2021-04-03  6:46           ` Teemu Nätkinniemi
2021-04-03  6:48             ` Teemu Nätkinniemi
2021-04-11  9:28               ` Mark Geisert
2021-04-12  8:48                 ` Teemu Nätkinniemi
2021-04-13  8:24                   ` Mark Geisert
2021-04-13 13:05                     ` Teemu Nätkinniemi
2021-04-14  8:19                       ` Mark Geisert
2021-04-14 18:36                         ` Teemu Nätkinniemi
2021-04-14 18:53                         ` Jon Turney
2021-04-19  5:16                           ` Mark Geisert
2021-04-20 19:34                             ` Jon Turney

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=ed2ba744-2d89-e9a5-2f1f-9ac4d4ca8898@maxrnd.com \
    --to=mark@maxrnd.com \
    --cc=cygwin-developers@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).