From owner-freebsd-hackers Thu Mar 7 11:27:30 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 2EFFF37B4BD for ; Thu, 7 Mar 2002 11:26:45 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id g27JQhU68778; Thu, 7 Mar 2002 11:26:43 -0800 (PST) (envelope-from dillon) Date: Thu, 7 Mar 2002 11:26:43 -0800 (PST) From: Matthew Dillon Message-Id: <200203071926.g27JQhU68778@apollo.backplane.com> To: Terry Lambert Cc: "Rogier R. Mulhuijzen" , Mike Silbersack , Tom , Dimitar Peikov , cjp , freebsd-hackers@FreeBSD.ORG Subject: Re: Swapping performance References: <20020307095452.D18855-100000@frond.minions.com> <5.1.0.14.0.20020307193205.01c3b0f0@mail.drwilco.net> <3C87BD3D.49BE8105@mindspring.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :> ptr = (char *) malloc(MALLOC_SIZE); :> bzero(ptr, MALLOC_SIZE); : :The bzero is unnecessary on FreeBSD. Allocated pages start out :zero'ed. Part of the performance issue might be that FreeBSD is :being asked to zero the pages twice, instead of once. malloc() does not guarentee a zero'd page, even though the side effect of a malloc() that large could very well be to map demand-zero-fill space. The bzero() will have the effect of force-instantiating the storage for the malloc'd space. It's appropriate for the test, I suppose, since the test is trying to test swap performance. :It might be more interesting to mmap() anonymous memory :(e.g. out of /dev/zero), rather than using malloc, and :then use that memory the same way, instead (it's swap :backed, as well). Giving it an madvise, to tell it your :intended access pattern would also be useful. Just mmap(... MAP_ANON...). It will make no difference, though, because that is effectively what a malloc() of that size will do anyway. -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message