From owner-freebsd-arch Sat Mar 2 10:15:11 2002 Delivered-To: freebsd-arch@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 6103E37B400 for ; Sat, 2 Mar 2002 10:15:04 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id g22IF0e55311; Sat, 2 Mar 2002 10:15:00 -0800 (PST) (envelope-from dillon) Date: Sat, 2 Mar 2002 10:15:00 -0800 (PST) From: Matthew Dillon Message-Id: <200203021815.g22IF0e55311@apollo.backplane.com> To: Alfred Perlstein Cc: Jeff Roberson , Poul-Henning Kamp , Julian Elischer , arch@FreeBSD.ORG Subject: Re: Slab allocator update References: <20020302081728.GR77980@elvis.mu.org> <20020302055809.B43446-100000@mail.chesapeake.net> <20020302113459.GU77980@elvis.mu.org> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message