From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7517 Path: news.gmane.org!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: Resuming work on new semaphore Date: Fri, 24 Apr 2015 18:47:45 +0300 (MSK) Message-ID: References: <20150405190214.GF6817@brightrain.aerifal.cx> <20150405202314.GG6817@brightrain.aerifal.cx> <20150423160624.GF17573@brightrain.aerifal.cx> <20150424024638.GO17573@brightrain.aerifal.cx> 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 1429890480 19601 80.91.229.3 (24 Apr 2015 15:48:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Apr 2015 15:48:00 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7530-gllmg-musl=m.gmane.org@lists.openwall.com Fri Apr 24 17:48:00 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 1Ylfpe-0003CR-Hx for gllmg-musl@m.gmane.org; Fri, 24 Apr 2015 17:47:58 +0200 Original-Received: (qmail 28441 invoked by uid 550); 24 Apr 2015 15:47:56 -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 28417 invoked from network); 24 Apr 2015 15:47:56 -0000 In-Reply-To: User-Agent: Alpine 2.11 (LNX 23 2013-08-11) Xref: news.gmane.org gmane.linux.lib.musl.general:7517 Archived-At: One more thought. In the original proposal, val[1] was a "wake count". By now we have drifted away a bit from that concept, with val[1] being used not only in post/timedwait, but also in trywait/getvalue, trywait explicitely performing post-stealing, and getvalue accounting for that. So how about we try to stick with the original vision, and say that val[1] is strictly for waiters leaving futex wait via non-error path? The kernel tells the poster via the return value of futex_wake whether the wake has caused any waiter to resume execution. The kernel already knows if any waiter was there to accept a wake, and lets us know. Can we somehow use that to implement non-stealing wakeups? Alexander