This is the mail archive of the glibc-bugs@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]

[Bug malloc/19048] malloc: arena free list can become cyclic, increasing contention


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

--- Comment #19 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.22/master has been updated
       via  f95984beb2d3d61c71c14c10cdc5ab8fda321dec (commit)
       via  13a601a0dfb468552c1eebf5c225392260f0bda2 (commit)
       via  eb8c932bac2e6c1273107b8a2721f382575b002a (commit)
       via  00cd4dad175f648783f808aef681d16c10fc34fa (commit)
       via  c252c193e2583e4506b141d052df29a0987ac290 (commit)
      from  f664b663118642490b8776dcf4f30524a646dcbc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f95984beb2d3d61c71c14c10cdc5ab8fda321dec

commit f95984beb2d3d61c71c14c10cdc5ab8fda321dec
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed Apr 13 14:11:42 2016 -0500

    malloc: Update comment for list_lock

    (cherry picked from commit 7962541a32eff5597bc4207e781cfac8d1bb0d87)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=13a601a0dfb468552c1eebf5c225392260f0bda2

commit 13a601a0dfb468552c1eebf5c225392260f0bda2
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed Apr 13 14:11:27 2016 -0500

    tst-malloc-thread-exit: Use fewer system resources

    (cherry picked from commit 2a38688932243b5b16fb12d84c7ac1138ce50363)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=eb8c932bac2e6c1273107b8a2721f382575b002a

commit eb8c932bac2e6c1273107b8a2721f382575b002a
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed Apr 13 14:10:49 2016 -0500

    malloc: Fix list_lock/arena lock deadlock [BZ #19182]

        * malloc/arena.c (list_lock): Document lock ordering requirements.
        (free_list_lock): New lock.
        (ptmalloc_lock_all): Comment on free_list_lock.
        (ptmalloc_unlock_all2): Reinitialize free_list_lock.
        (detach_arena): Update comment.  free_list_lock is now needed.
        (_int_new_arena): Use free_list_lock around detach_arena call.
        Acquire arena lock after list_lock.  Add comment, including FIXME
        about incorrect synchronization.
        (get_free_list): Switch to free_list_lock.
        (reused_arena): Acquire free_list_lock around detach_arena call
        and attached threads counter update.  Add two FIXMEs about
        incorrect synchronization.
        (arena_thread_freeres): Switch to free_list_lock.
        * malloc/malloc.c (struct malloc_state): Update comments to
        mention free_list_lock.

    (cherry picked from commit 90c400bd4904b0240a148f0b357a5cbc36179239)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=00cd4dad175f648783f808aef681d16c10fc34fa

commit 00cd4dad175f648783f808aef681d16c10fc34fa
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed Apr 13 14:08:24 2016 -0500

    malloc: Fix attached thread reference count handling [BZ #19243]

    reused_arena can increase the attached thread count of arenas on the
    free list.  This means that the assertion that the reference count is
    zero is incorrect.  In this case, the reference count initialization
    is incorrect as well and could cause arenas to be put on the free
    list too early (while they still have attached threads).

        * malloc/arena.c (get_free_list): Remove assert and adjust
        reference count handling.  Add comment about reused_arena
        interaction.
        (reused_arena): Add comments abount get_free_list interaction.
        * malloc/tst-malloc-thread-exit.c: New file.
        * malloc/Makefile (tests): Add tst-malloc-thread-exit.
        (tst-malloc-thread-exit): Link against libpthread.

    (cherry picked from commit 3da825ce483903e3a881a016113b3e59fd4041de)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c252c193e2583e4506b141d052df29a0987ac290

commit c252c193e2583e4506b141d052df29a0987ac290
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed Apr 13 14:07:58 2016 -0500

    malloc: Prevent arena free_list from turning cyclic [BZ #19048]

        [BZ# 19048]
        * malloc/malloc.c (struct malloc_state): Update comment.  Add
        attached_threads member.
        (main_arena): Initialize attached_threads.
        * malloc/arena.c (list_lock): Update comment.
        (ptmalloc_lock_all, ptmalloc_unlock_all): Likewise.
        (ptmalloc_unlock_all2): Reinitialize arena reference counts.
        (deattach_arena): New function.
        (_int_new_arena): Initialize arena reference count and deattach
        replaced arena.
        (get_free_list, reused_arena): Update reference count and deattach
        replaced arena.
        (arena_thread_freeres): Update arena reference count and only put
        unreferenced arenas on the free list.

    (cherry picked from commit a62719ba90e2fa1728890ae7dc8df9e32a622e7b)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                       |   58 ++++++++++
 NEWS                            |   13 ++-
 malloc/Makefile                 |    4 +-
 malloc/arena.c                  |  129 +++++++++++++++++++++--
 malloc/malloc.c                 |   11 ++-
 malloc/tst-malloc-thread-exit.c |  218 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 418 insertions(+), 15 deletions(-)
 create mode 100644 malloc/tst-malloc-thread-exit.c

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

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