This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Improve comments in elision-(try)lock.c
- From: Torvald Riegel <triegel at redhat dot com>
- To: libc-alpha at sourceware dot org
- Cc: andi at firstfloor dot org
- Date: Fri, 20 Sep 2013 14:33:12 +0200
- Subject: Re: [PATCH] Improve comments in elision-(try)lock.c
- Authentication-results: sourceware.org; auth=none
- References: <20130918063706 dot GA4220 at linux dot vnet dot ibm dot com>
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.