From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8248 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: New optimized normal-type mutex? Date: Thu, 30 Jul 2015 09:46:49 -0400 Message-ID: <20150730134649.GC16376@brightrain.aerifal.cx> References: <8c49d81e.dNq.dMV.21.hNiSfA@mailjet.com> <1438207875.10742.3.camel@inria.fr> <20150729233054.GZ16376@brightrain.aerifal.cx> <1438213760.10742.5.camel@inria.fr> <20150730001014.GA16376@brightrain.aerifal.cx> <1438243654.10742.9.camel@inria.fr> <1438247427.10742.13.camel@inria.fr> <1438250459.10742.16.camel@inria.fr> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1438264027 19414 80.91.229.3 (30 Jul 2015 13:47:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 Jul 2015 13:47:07 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8261-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jul 30 15:47:05 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZKoAr-0001WO-BK for gllmg-musl@m.gmane.org; Thu, 30 Jul 2015 15:47:05 +0200 Original-Received: (qmail 25927 invoked by uid 550); 30 Jul 2015 13:47:02 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 25906 invoked from network); 30 Jul 2015 13:47:01 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:8248 Archived-At: On Thu, Jul 30, 2015 at 02:37:13PM +0300, Alexander Monakov wrote: > On Thu, 30 Jul 2015, Jens Gustedt wrote: > > Am Donnerstag, den 30.07.2015, 12:36 +0300 schrieb Alexander Monakov: > > > That sounds like your testcase simulates a load where you'd be better off with > > > a spinlock in the first place, no? > > > > Hm, this is not a "testcase" in the sense that this is the real code > > that I'd like to use for the generic atomic lock-full stuff. My test > > is just using this atomic lock-full thing, with a lot of threads that > > use the same head of a "lock-free" FIFO implementation. There the > > inner part in the critical section is just memcpy of some bytes. For > > reasonable uses of atomics this should be about 16 to 32 bytes that > > are copied. > > > > So this is really a use case that I consider important, and that I > > would like to see implemented with similar performance. > > I acknowledge that that seems like an important case, but you have not > addressed my main point. With so little work in the critical section, it does > not make sense to me that you would use something like a normal-type futex-y > mutex. Even a call/return to grab it gives you some overhead. I'd expect you > would use a fully inlined spinlock acquisition/release around the memory copy. No, spinlocks are completely unusable in a POSIX libc that implements priorities. They will deadlock whenever a lower-priority thread gets preempted by a higher-priority one while holding the lock. Rich