From owner-freebsd-current@FreeBSD.ORG Sat Dec 3 21:10:19 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E72D216A44F; Sat, 3 Dec 2005 21:10:19 +0000 (GMT) (envelope-from jasone@canonware.com) Received: from lh.synack.net (lh.synack.net [204.152.188.37]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9984843D73; Sat, 3 Dec 2005 21:10:06 +0000 (GMT) (envelope-from jasone@canonware.com) Received: by lh.synack.net (Postfix, from userid 100) id 672EE5E48A3; Sat, 3 Dec 2005 13:10:04 -0800 (PST) Received: from [192.168.168.203] (moscow-cuda-gen2-68-64-60-20.losaca.adelphia.net [68.64.60.20]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by lh.synack.net (Postfix) with ESMTP id 4B0635E4885; Sat, 3 Dec 2005 13:09:55 -0800 (PST) In-Reply-To: <4391569A.7080808@freebsd.org> References: <0B746373-8C29-4ADF-9218-311AE08F3834@canonware.com> <4391569A.7080808@freebsd.org> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Jason Evans Date: Sat, 3 Dec 2005 13:08:51 -0800 To: David Xu X-Mailer: Apple Mail (2.746.2) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on lh.synack.net X-Spam-Level: * X-Spam-Status: No, score=1.8 required=5.0 tests=RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: current@freebsd.org Subject: Re: New libc malloc patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2005 21:10:20 -0000 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