This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Improve comments in elision-(try)lock.c


On Wed, 2013-09-18 at 08:37 +0200, Dominik Vogt wrote:
> --- a/nptl/sysdeps/unix/sysv/linux/x86/elision-lock.c
> +++ b/nptl/sysdeps/unix/sysv/linux/x86/elision-lock.c
> @@ -86,7 +86,8 @@ __lll_lock_elision (int *futex, short *adapt_count,
> EXTRAARG int private)
>    else
>      {
>        /* Use a normal lock until the threshold counter runs out.
> -        Lost updates possible.  */
> +        Lost updates possible.  Due to races this might lead
> +        to *adapt_count becoming less than zero.  */
> 
I would point out the specific race condition, in particular that the
load of adapt_count at the beginning of the function is not atomic with
respect to the later change of it.  Otherwise, this looks fine to me.
Thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]