From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 2 19:56:44 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0B1B16A468; Sat, 2 Feb 2008 19:56:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id E58AB13C442; Sat, 2 Feb 2008 19:56:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) X-Spam-Flag: SKIP X-Spam-Yversion: Spamooborona 1.7.0 Received: from [212.86.226.226] (account mav@alkar.net HELO [192.168.3.2]) by cmail.optima.ua (CommuniGate Pro SMTP 5.1.14) with ESMTPA id 72230425; Sat, 02 Feb 2008 21:56:43 +0200 Message-ID: <47A4CAFA.5040708@FreeBSD.org> Date: Sat, 02 Feb 2008 21:56:42 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Peter Jeremy References: <47A25412.3010301@FreeBSD.org> <47A25A0D.2080508@elischer.org> <47A2C2A2.5040109@FreeBSD.org> <20080201185435.X88034@fledge.watson.org> <47A43873.40801@FreeBSD.org> <20080202193656.GR35170@server.vk2pj.dyndns.org> In-Reply-To: <20080202193656.GR35170@server.vk2pj.dyndns.org> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 8bit Cc: freebsd-hackers@freebsd.org, freebsd-performance@freebsd.org Subject: Re: Memory allocation performance X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Feb 2008 19:56:44 -0000 Peter Jeremy пишет: > On Sat, Feb 02, 2008 at 11:31:31AM +0200, Alexander Motin wrote: >> To check UMA dependency I have made a trivial one-element cache which in my >> test case allows to avoid two for four allocations per packet. > > You should be able to implement this lockless using atomic(9). I haven't > verified it, but the following should work. I have tried this, but man 9 atomic talks: The atomic_readandclear() functions are not implemented for the types ``char'', ``short'', ``ptr'', ``8'', and ``16'' and do not have any variants with memory barriers at this time. -- Alexander Motin