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: 610422 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qlyKl51Lxz9sD9 for ; Thu, 14 Apr 2016 20:56:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=Qk306GpO; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type; q=dns; s=default; b=rseG 5ijn7rNUoy+Q2Pjn2mneeIXn/i+4ZIMe/3Yj/H5VTQUnP2wlj4BZ/hLDhrm0eXs6 QyCldfjSCy8mcFZQsP+z8+hzgkUZBoDCIX0gxuKNspheQTcr83Y4PRkSq3eux96w 6R7JxEALRnJIX2VtXo5tA5HiNvPwtT5krEIYIKM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type; s=default; bh=B7r1AqJx4C HlSKFX1HxYEUovqKI=; b=Qk306GpOxmgITlSR5p24Pk11HxhRanxJEzeWKJM0EO jl+7uk/zUAVz+76xvjImjs7M3kPX1cOeXpH9eIlUqNFBys5wqazXq+CzfWfdQoYT J+8P348879HFYF93OGz7NaHJOwWudx/aGROd9GDMdnaYRaUsVNidLlZYjco2+qoe Y= 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)