From owner-freebsd-current@FreeBSD.ORG Sat Dec 3 08:26:02 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 1593616A420 for ; Sat, 3 Dec 2005 08:26:02 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C593743D5A; Sat, 3 Dec 2005 08:26:00 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from [127.0.0.1] (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id jB38Pw2K081891; Sat, 3 Dec 2005 08:25:59 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4391569A.7080808@freebsd.org> Date: Sat, 03 Dec 2005 16:26:02 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20050928 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jason Evans References: <0B746373-8C29-4ADF-9218-311AE08F3834@canonware.com> In-Reply-To: <0B746373-8C29-4ADF-9218-311AE08F3834@canonware.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 08:26:02 -0000 Jason Evans wrote: > On Nov 29, 2005, at 12:06 PM, Jon Dama wrote: > >> There exists a problem right now--localized to i386 and any other arch >> based on 32-bit pointers: address space is simply too scarce. >> >> Your decision to switch to using mmap as the exclusive source of malloc >> buckets is admirable for its modernity but it simply cannot stand unless >> someone steps up to change the way mmap and brk interact within the >> kernel. > > > There's a new version of the patch available at: > > http://www.canonware.com/~jasone/jemalloc/jemalloc_20051202b.diff > > This version of the patch adds the following: > > * Prefer to use sbrk() rather than mmap() for the 32-bit platforms. > > * Lazily create arenas, so that single-threaded applications don't > dedicate space to arenas they never use. > > * Add the '*' and '/' MALLOC_OPTIONS flags, which allow control over > the number of arenas. > > As of this patch, all of the issues that were brought to my attention > have been addressed. This is a good time for additional review and > serious benchmarking. > > Thanks, > Jason 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 Xu