[m-rev.] for review: thread-local allocation

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Apr 20 21:07:27 AEST 2006


On Thu, 20 Apr 2006, Peter Wang wrote:

> Estimated hours taken: 4
> Branches: main

Should this go on the release branch?

> This patch enables the thread-local memory allocation feature of Boehm GC in
> parallel grades on Linux hosts; without it, performance is terrible.

Can you quantify the improvement?

> It may work on other operating systems using pthreads, but I haven't tested.

I'm sure you left the word "yet" off that sentence ;-)

> Mmake.common.in:
> configure.in:
> boehm_gc/Makefile:
> 	Build Boehm GC with the THREAD_LOCAL_ALLOC preprocessor symbol in
> 	parallel grades on Linux.
>
> 	Add -DGC_REDIRECT_TO_LOCAL to CFLAGS_FOR_THREADS to redirect
> 	calls to GC_malloc() to GC_local_malloc().
>
> runtime/mercury_memory.c:
> 	Work around a bug in the garbage collector when using thread-local
> 	allocation.  Hans Boehm says, "A size zero GC_local_malloc allocation
> 	currently just returns a fixed address outside the real heap."
> 	This leads to a crash when we later try to GC_free() the address.
>
>
> The size zero allocation is due to calls like
> "MR_GC_NEW_ARRAY(MR_TypeInfo, expand_info->arity);" in
> mercury_ml_expand_body.h, where the arity is zero.  There may be others.
> I've emailed the gclist today about the problem.

Assuming the compiler still bootchecks in hlc.par.gc and in one of the
lowlevel .par grades that's fine.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list