New libc malloc patch

Jason Evans jasone at canonware.com
Sat Dec 3 13:10:20 PST 2005


On Dec 3, 2005, at 12:26 AM, David Xu wrote:
> I have a question about mutex used in the patch, you are using
> a spin loop, isn't it suboptimal ? and a thread library like  
> libpthread
> supports static priority scheduling, this mutex does not work, it
> will causes a dead lock, if a lower priority thread locked the mutex,
> and preempted by a higher priority thread, and the higher priority
> thread also calls malloc, it will spin there to wait lower
> priority thread to complete, but that will never happen.

David,

You are correct that this is a problem.  Thank you for pointing it  
out.  There's a new patch that uses the spinlocks that are provided  
by the threads libraries.  Please let me know if this looks okay.

Also, this patch removes/modifies the code that was causing build  
failures on amd64, so it's worth giving another try.  Hopefully, it  
will compile now...

http://www.canonware.com/~jasone/jemalloc/jemalloc_20051203a.diff

Thanks,
Jason


More information about the freebsd-current mailing list