Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jan 2002 13:14:52 -0800
From:      Alfred Perlstein <bright@mu.org>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        smp@freebsd.org, jhb@freebsd.org, dillon@freebsd.org
Subject:   Re: making malloc(9) smp safe?
Message-ID:  <20020113131452.T7984@elvis.mu.org>
In-Reply-To: <3C41F153.DCA0A4F3@mindspring.com>; from tlambert2@mindspring.com on Sun, Jan 13, 2002 at 12:42:59PM -0800
References:  <20020113050836.Q7984@elvis.mu.org> <3C41F153.DCA0A4F3@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
* Terry Lambert <tlambert2@mindspring.com> [020113 12:49] wrote:
> Alfred Perlstein wrote:
> > Malloc has its own mutex, however when it needs to do page allocations
> > via kmem_malloc() it drops the mutex and calls it.
> > 
> > kmem_malloc() needs giant.
> > 
> > what do I do?
> > 
> > Do I grab giant before calling malloc(9)?
> > Do I make malloc(9) aquire or recurse on giant automatically?
> >   (basically grab giant around kmem_malloc() call in malloc(9))
> > 
> > ?
> 
> 
> The way Dynix does this (see UNIX Internals: The New Frontiers,
> Uresh Vahalia, Chapter 12 Kernel Memory Allocation, 12.9 A
> Hierarchical Allocator for Multiprocessors) is to seperate the
> memory into a global pool, and per CPU pools, with a seperate
> Coelesce-to-Page layer.

I know dammit, I wanted a quick fix for malloc!

here:

http://www.freebsd.org/~alfred/memcache

:P

-Alfred

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020113131452.T7984>