Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Apr 2002 13:26:46 -0800
From:      Alfred Perlstein <bright@mu.org>
To:        hackers@freebsd.org
Cc:        dillon@freebsd.org, jeffr@freebsd.org
Subject:   mpsafe malloc
Message-ID:  <20020402212646.GV93885@elvis.mu.org>

next in thread | raw e-mail | index | archive | help
Started looking at making malloc mpsafe.

First issue I came across was this brokenish code in
uma_core.c:page_alloc():

        if (lockstatus(&kernel_map->lock, NULL)) {
                *pflag = UMA_SLAB_KMEM;
                p = (void *) kmem_malloc(kmem_map, bytes, wait);
        } else {
                *pflag = UMA_SLAB_KMAP;
                p = (void *) kmem_alloc(kernel_map, bytes);
        }

using lockstatus won't work for smp.

I think a solution is to do a trylock on the kmem_map, then have
kmem_malloc either recurse on the lock, or take a flag to tell it
not to bother locking.

?



-- 
-Alfred Perlstein [alfred@freebsd.org]
'Instead of asking why a piece of software is using "1970s technology,"
 start asking why software is ignoring 30 years of accumulated wisdom.'
Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/

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




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