public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/28670] New: fix bug of d672a98a1af106bd68deb15576710cd61363f7a6
@ 2021-12-08  1:33 wangxuszcn at foxmail dot com
  2021-12-10  8:33 ` [Bug nptl/28670] " wangxuszcn at foxmail dot com
  0 siblings, 1 reply; 2+ messages in thread
From: wangxuszcn at foxmail dot com @ 2021-12-08  1:33 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28670

            Bug ID: 28670
           Summary: fix bug of d672a98a1af106bd68deb15576710cd61363f7a6
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: wangxuszcn at foxmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

In commit d672a98a1af106bd68deb15576710cd61363f7a6, we want to do an atomic
load  
instead of CAS. As a matter of fact, d672a98a1af106bd68deb15576710cd61363f7a6
will execute both LLL_MUTEX_READ_LOCK() and LLL_MUTEX_TRYLOCK().
So the following patch try to sovle it.
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index 5a49763..1d7a80b 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -140,6 +140,7 @@ PTHREAD_MUTEX_LOCK (pthread_mutex_t *mutex)
                             mutex->__data.__spins * 2 + 10);
          do
            {
+again:
              if (cnt++ >= max_cnt)
                {
                  LLL_MUTEX_LOCK (mutex);
@@ -147,7 +148,7 @@ PTHREAD_MUTEX_LOCK (pthread_mutex_t *mutex)
                }
              atomic_spin_nop ();
              if (LLL_MUTEX_READ_LOCK (mutex) != 0)
-           continue;
+         goto;
            }
          while (LLL_MUTEX_TRYLOCK (mutex) != 0);
 unlock:

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug nptl/28670] fix bug of d672a98a1af106bd68deb15576710cd61363f7a6
  2021-12-08  1:33 [Bug nptl/28670] New: fix bug of d672a98a1af106bd68deb15576710cd61363f7a6 wangxuszcn at foxmail dot com
@ 2021-12-10  8:33 ` wangxuszcn at foxmail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: wangxuszcn at foxmail dot com @ 2021-12-10  8:33 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28670

wangxu <wangxuszcn at foxmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from wangxu <wangxuszcn at foxmail dot com> ---
the same as https://sourceware.org/bugzilla/show_bug.cgi?id=28164

*** This bug has been marked as a duplicate of bug 28164 ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-10  8:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08  1:33 [Bug nptl/28670] New: fix bug of d672a98a1af106bd68deb15576710cd61363f7a6 wangxuszcn at foxmail dot com
2021-12-10  8:33 ` [Bug nptl/28670] " wangxuszcn at foxmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).