Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 18 Jun 2017 19:31:11 +0200
From: Jens Gustedt <jens.gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] a new lock algorithm with lock value and CS
 counts in the same atomic int

Hello,

On Sun, 18 Jun 2017 12:04:59 -0400 Rich Felker <dalias@...c.org> wrote:

> On Sun, Jun 18, 2017 at 06:05:55PM +0300, Alexander Monakov wrote:
> > On Sun, 18 Jun 2017, Rich Felker wrote:  
>  [...]  
> > > 
> > > I think this can be dropped entirely for musl's purposes and
> > > essentially for all practical purposes.  
> > 
> > In any case, the second half of that suggestion stands: using
> > INT_MAX consistently everywhere should be better for clarity.  
> 
> Yes, that seems better.

I would slightly prefer to go with a version that uses INT_MIN
everywhere. This would make it clearer that the value is composed as
"INT_MIN + CScount" if the lock is held, and just "CScount" if it
isn't. Sort of sign and magnitude representation.

> > > Is there a reason __wait doesn't work?  
> > 
> > __wait doesn't fit here at all, for instance it manipulates a
> > separate int with waiters count.  
> 
> It accepts a null pointer for the waiters count, so that it can be
> used in contexts with or without one. Any cost of the additional
> conditional branches is dominated by syscall time.

Ah, ok, I'll look into that.

Thanks
Jens

-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.