From patchwork Thu Apr 14 10:56:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 11742 Received: (qmail 22864 invoked by alias); 14 Apr 2016 10:56:51 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 22847 invoked by uid 89); 14 Apr 2016 10:56:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=1747, 1367, 156, 6, 172, 6 X-HELO: mx1.redhat.com Subject: Re: [PATCH] malloc: Run fork handler as late as possible [BZ #19431] To: Andreas Schwab References: <56BBAF3D.5030905@redhat.com> <1455559833.20971.11.camel@localhost.localdomain> <56C5EE32.1020605@redhat.com> <1460485015.3869.267.camel@localhost.localdomain> <570D4944.7070501@redhat.com> <1460552111.3869.362.camel@localhost.localdomain> <570E5362.7070300@redhat.com> Cc: Torvald Riegel , GNU C Library From: Florian Weimer Message-ID: <570F776E.1050802@redhat.com> Date: Thu, 14 Apr 2016 12:56:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: On 04/14/2016 12:26 PM, Andreas Schwab wrote: > Florian Weimer writes: > >> 2016-04-13 Florian Weimer >> >> [BZ #19431] >> Run the malloc fork handler as late as possible to avoid deadlocks. >> * malloc/malloc-internal.h: New file. >> * malloc/malloc.c: Include it. >> * malloc/arena.c (ATFORK_MEM): Remove. >> (__malloc_fork_lock_parent): Rename from ptmalloc_lock_all. >> Update comment. >> (__malloc_fork_unlock_parent): Rename from ptmalloc_unlock_all. >> (__malloc_fork_unlock_child): Rename from ptmalloc_unlock_all2. >> Remove outdated comment. >> (ptmalloc_init): Do not call thread_atfork. Remove >> thread_atfork_static. > > In file included from malloc.c:1889:0: > arena.c:139:1: error: conflicting types for '__malloc_fork_lock_parent' > __malloc_fork_lock_parent (void) > ^ > In file included from malloc.c:247:0: > ../malloc/malloc-internal.h:23:6: note: previous declaration of '__malloc_fork_lock_parent' was here > void __malloc_fork_lock_parent (void) internal_function attribute_hidden; > ^ Fixed with the attached patch. Sorry about that. Florian 2016-04-14 Florian Weimer * malloc/arena.c (__malloc_fork_lock_parent) (__malloc_fork_unlock_parent, __malloc_fork_unlock_child): Add internal_function attribute. diff --git a/malloc/arena.c b/malloc/arena.c index 8bf8171..1dd9dee 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -136,6 +136,7 @@ int __malloc_initialized = -1; subsystem. */ void +internal_function __malloc_fork_lock_parent (void) { if (__malloc_initialized < 1) @@ -156,6 +157,7 @@ __malloc_fork_lock_parent (void) } void +internal_function __malloc_fork_unlock_parent (void) { if (__malloc_initialized < 1) @@ -172,6 +174,7 @@ __malloc_fork_unlock_parent (void) } void +internal_function __malloc_fork_unlock_child (void) { if (__malloc_initialized < 1)