From owner-freebsd-arch Fri Mar 1 19:55:28 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 EC8BA37B416 for ; Fri, 1 Mar 2002 19:55:25 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id g223tOn49150; Fri, 1 Mar 2002 19:55:24 -0800 (PST) (envelope-from dillon) Date: Fri, 1 Mar 2002 19:55:24 -0800 (PST) From: Matthew Dillon Message-Id: <200203020355.g223tOn49150@apollo.backplane.com> To: Jeff Roberson Cc: Poul-Henning Kamp , Julian Elischer , Subject: Re: Slab allocator update References: <20020301214243.B43446-100000@mail.chesapeake.net> 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 : :I lost a lot of my performance gains when I replaced malloc. malloc(9) is :extremely fast. I finally cought up to it again with the per cpu queues, :but there is still extra overhead. There is an extra function call, and :then in the free path I have to do a hash lookup on the page. This is :because I don't have the freed size when the data is returned, and I need :to find out what zone it came from. The hash table is slightly smaller :than the original kmemusage array and should have minimum collisions. I've found that free(ptr) can usually be turned into blahblah_free(ptr, bytes) almost universally in programs, and the kernel MALLOC is no exception. The size is known at free time in virtually all cases, even for strings. But that would mean a change in the API. It might be beneficial to introduce two versions of your free function, one which does not require the size and another, faster version which does, and then slowly adjust the kernel to use the new function as well as add sanity checks for INARIANTS to ensure we don't accidently leak or corrupt memory by specifying the wrong size. -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message