From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cross.elm.relay.mailchannels.net (cross.elm.relay.mailchannels.net [23.83.212.46]) by sourceware.org (Postfix) with ESMTPS id 8B2C43851C33; Fri, 18 Jun 2021 06:32:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8B2C43851C33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id E4C3654275E; Fri, 18 Jun 2021 06:32:54 +0000 (UTC) Received: from pdx1-sub0-mail-a91.g.dreamhost.com (100-96-133-115.trex.outbound.svc.cluster.local [100.96.133.115]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 6C68F5426F4; Fri, 18 Jun 2021 06:32:54 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a91.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.133.115 (trex/6.3.3); Fri, 18 Jun 2021 06:32:54 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Relation-Shade: 7253e39f67e13bdb_1623997974666_28908040 X-MC-Loop-Signature: 1623997974666:4063594413 X-MC-Ingress-Time: 1623997974666 Received: from pdx1-sub0-mail-a91.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a91.g.dreamhost.com (Postfix) with ESMTP id 325ED7E67C; Thu, 17 Jun 2021 23:32:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gotplt.org; h=subject:to :cc:references:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; s=gotplt.org; bh=taV8BD dvSUhuV2tWGr8cBRcrb7U=; b=Pqkn6zXkJ2r2N2hD9bNlclr5JoNvPHGpo1A2Su ePCOgBjamORKU+uu7q0/Q7sm3Zl8DuzfEnpbJJ+zgmF8wpt0KEMhCpMMGLTTF9OU u58QwnBaB2r6+USSmHCWCoG2/NxpqoN83yovNki2hCgR915OxT9x4g2asA+S/aKD nzNPc= Received: from [192.168.1.126] (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a91.g.dreamhost.com (Postfix) with ESMTPSA id EB3827E6CF; Thu, 17 Jun 2021 23:32:51 -0700 (PDT) Subject: Re: [PATCH] malloc: Ensure that ptmalloc_init runs only once To: Siddhesh Poyarekar , Florian Weimer Cc: Siddhesh Poyarekar via Libc-alpha References: <20210617103217.2633690-1-siddhesh@sourceware.org> <87a6no4l71.fsf@oldenburg.str.redhat.com> <68f4386f-9ae5-8791-31bf-7dcf14479847@sourceware.org> <87y2b7u3n5.fsf@oldenburg.str.redhat.com> <87tulvu36v.fsf@oldenburg.str.redhat.com> <6f4a7a10-85ca-db9c-f0de-b3d198fe3555@sourceware.org> X-DH-BACKEND: pdx1-sub0-mail-a91 From: Siddhesh Poyarekar Message-ID: <65bdfd68-fd63-a75f-74ce-b78b05dbcc0b@gotplt.org> Date: Fri, 18 Jun 2021 12:02:46 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <6f4a7a10-85ca-db9c-f0de-b3d198fe3555@sourceware.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3027.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2021 06:32:58 -0000 On 6/18/21 11:58 AM, Siddhesh Poyarekar via Libc-alpha wrote: > On 6/18/21 11:25 AM, Florian Weimer wrote: >> I think it's a three-state value to avoid calling >> __malloc_initialize_hook multiple times.=C2=A0 This is all a bit >> under-documented unfortunately. >=20 > How so?=C2=A0 It's only called from ptmalloc_init now AFAICT and runnin= g=20 > ptmalloc_init concurrently won't work anyway. To be clear what I'm suggesting is setting __malloc_initialized at the=20 entry of ptmalloc_init, which should ensure that the body is executed=20 only once as long as it is not called concurrently. Siddhesh