From owner-freebsd-performance@freebsd.org Thu Jun 23 22:31:47 2016 Return-Path: Delivered-To: freebsd-performance@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F9E0B74D45 for ; Thu, 23 Jun 2016 22:31:47 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 071252BB6 for ; Thu, 23 Jun 2016 22:31:47 +0000 (UTC) (envelope-from jilles@stack.nl) Received: by mailman.ysv.freebsd.org (Postfix) id 023E0B74D42; Thu, 23 Jun 2016 22:31:47 +0000 (UTC) Delivered-To: performance@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0193BB74D40; Thu, 23 Jun 2016 22:31:47 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BC4CE2BB3; Thu, 23 Jun 2016 22:31:46 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id DE525358C5A; Fri, 24 Jun 2016 00:31:43 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id CC6BE28494; Fri, 24 Jun 2016 00:31:43 +0200 (CEST) Date: Fri, 24 Jun 2016 00:31:43 +0200 From: Jilles Tjoelker To: Maxim Sobolev Cc: Konstantin Belousov , John Baldwin , Adrian Chadd , Alan Somers , Alan Cox , Alan Cox , freebsd-current , performance@freebsd.org, "current@freebsd.org" Subject: Re: PostgreSQL performance on FreeBSD Message-ID: <20160623223143.GC5381@stack.nl> References: <20140627125613.GT93733@kib.kiev.ua> <1603235.2ShtoCfSqO@ralph.baldwin.cx> <20160622100241.GM38613@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Thu, 23 Jun 2016 22:34:42 +0000 X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 22:31:47 -0000 On Wed, Jun 22, 2016 at 07:26:52AM -0700, Maxim Sobolev wrote: > Konstantin, > Not if you do sem_unlink() immediately, AFAIK. And that's what PG does. So > the window of opportunity for the leakage is quite small, much smaller than > for SYSV primitives. Sorry for missing your status update message, I've > missed it somehow. True, but if your process architecture supports that, you can also put unnamed process-shared semaphores into a piece of shared memory (pad sem_t to a cache line if contention is expected). This is more natural API use (fully avoiding the leak) and uses less memory. It has been supported for a long time, at least since FreeBSD 9.0. Process-shared mutexes, condition variables, reader/writer locks, etc. are available in FreeBSD 11 but use more memory (a 1-page object per synchronization object), somewhat like named semaphores. -- Jilles Tjoelker