1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00

Use rel semantics of cas instead of acq semantics with full barrier before it in _int_free

The following patch fixes catomic_compare_and_exchange_*_rel definitions
(which were never used and weren't correct) and uses
catomic_compare_and_exchange_val_rel in _int_free.  Comparing to the
pre-2009-07-02 --enable-experimental-malloc state the generated code should
be identical on all arches other than ppc/ppc64 and on ppc/ppc64 should use
lwsync instead of isync barrier.
This commit is contained in:
Jakub Jelinek
2009-07-16 07:24:50 -07:00
committed by Ulrich Drepper
parent 55c4ce6885
commit bea0ac1d87
3 changed files with 35 additions and 13 deletions

View File

@@ -4822,9 +4822,8 @@ _int_free(mstate av, mchunkptr p)
goto errout;
}
p->fd = fd = old;
atomic_full_barrier ();
}
while ((old = catomic_compare_and_exchange_val_acq (fb, p, fd)) != fd);
while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
#else
/* Another simple check: make sure the top of the bin is not the
record we are going to add (i.e., double free). */