Date: Sat, 2 Mar 2002 10:15:00 -0800 (PST) From: Matthew Dillon <dillon@apollo.backplane.com> To: Alfred Perlstein <bright@mu.org> Cc: Jeff Roberson <jroberson@chesapeake.net>, Poul-Henning Kamp <phk@critter.freebsd.dk>, Julian Elischer <julian@elischer.org>, arch@FreeBSD.ORG Subject: Re: Slab allocator update Message-ID: <200203021815.g22IF0e55311@apollo.backplane.com> References: <20020302081728.GR77980@elvis.mu.org> <20020302055809.B43446-100000@mail.chesapeake.net> <20020302113459.GU77980@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
:As I said this is the right thing to do, make the tradeoff for speed.
:using .1% of the system memory in order to effeciently manage the pool
:seems like a worthwhile tradeoff.
:
:You could halve this requirement by doing roundoffs to 2xPAGE_SIZE
:and half it again by making it a 16 bit integer pointing into an
:indirect array, but that's over optimizing for space imo.
:
:I think that the overhead and inconvience to store the size of the
:allocations may be too much for us to deal with.
I have to disagree here. I have a lot of experience converting
malloc()/free() based systems to other types of memory allocators
where the 'free' requires a size. It's utterly trivial. The size
is known trivially in 99% of the cases.
The vast majority of malloc()/free()'s in the kernel that could
be said to require performance are malloc()'s and free()'s of structures,
for which the size is known.
:Anyhow, you said you had some performance issues, using the simple
:hash will hopefully make the code smaller and more simple thereby
:speeding it up some.
Hash tables are reasonable solutions but they have downsides too.
The biggest one is L1 cache pollution since you are essentially
calculating a pseudo-random index. The other is storage. It is well
worth it if one can avoid the storage requirement.
:Lastly it might make sense to have a double map, so you have an array
:of pointers to pages that contain pointers to your slab meta-data,
:then you only need to allocate another page for this when you grow
:the arena, this may cause too much complication though, but it may
:offer an improvement over hash chaining.
:
:--
:-Alfred Perlstein [alfred@freebsd.org]
Careful, all these features are going to increase the per-allocation
overhead by a lot more then just a few bytes! Yuch!
-Matt
Matthew Dillon
<dillon@backplane.com>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203021815.g22IF0e55311>
