On Mar 19 14:13, Mark Geisert wrote:
> On 3/19/2025 2:59 AM, Corinna Vinschen wrote:
> > On Mar 19 08:56, Lionel Cons wrote:
> > > On Tue, 18 Mar 2025 at 20:51, Corinna Vinschen
> > > <corinna-cygwin-rdbxbdvo6bxqt0dzr+a...@public.gmane.org> wrote:
> > > > 
> > > > Fodder for future Cygwin development:
> > > 
> > > What about switching Cygwin's dlmalloc to use USE_LOCKS for better
> > > multi thread performance?
> > 
> > USE_LOCKS won't help multi threading performance.  It just adds a global
> > lock we already have.  We could probably get rid of the locking calls
> > in mm/malloc_wrapper.cc. Nice, but no help performancewise.
> > 
> > We could try to enable MSPACES (but not ONLY_MSPACES) and redirect
> > all malloc calls from user-space to per-thread mspace_malloc calls.
> > That may be worth a try.
> 
> Maybe something like
> https://cygwin.com/pipermail/cygwin-patches/2020q4/010905.html
> (Note that that won't apply now due to code re-arrangements since.)
> 
> I didn't have the bandwidth to follow up on why that wasn't accepted back at
> the time.

I did an MSPACES test quite a while ago as well.  I had a bit of code
which redirected all malloc calls in malloc_wrapper.cc to mspace_malloc
calls, if the caller thread was a pthread.  One mspace per thread.
However, any thread can call free on memory allocated by any other
thread, so per the descriptions in dlmalloc I had MSPACES, FOOTERS,
USE_LOCKS and USE_SPIN_LOCKS set to 1.  "Seomthing" didn't work right,
but I don't remember.


Corinna

Reply via email to