From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45641 invoked by alias); 17 Oct 2016 16:09:11 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 45618 invoked by uid 89); 17 Oct 2016 16:09:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.2 spammy=3226, Hx-languages-length:2893, 115327, act X-HELO: mail-qk0-f175.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding; bh=LeH77H8OcKklAFvhNl4LD6vOir16SsVvKl9XRjaPy6s=; b=hBCfcTL3ffgl7xQv0KZXF1Sf1x0pJIqRGiUUjc6vMfrbZbB5t8wV7YuR2NbaEqgjnJ O8zhCD+nSbkeORFvzNiCJaFCcnTCmz7EosmOYdXYBPS+7nJlT7wafEMbSAtgFCE8ZLPj 4djJTeszG9hol+NLR+RoP1UbeKhSzgsMkXo3FXmdpTzJZnzbCMuTfhRr+cUX+L/LEjmZ jQ/vqYT5Q8CCh0l5Eag0GzuDMgt8m14hETUmxHianqe9fMp3Zn7ZUiFbbiQXQfT7lss5 iIBJxmG5emQJcvy46POGry9GonXkSvbYSgt0t2XWTizDas4QBGsetJzRsG0+yv2J4vMv EnbA== X-Gm-Message-State: AA6/9RlZgnc8PY2GW73klv9LjL9CfthZ1cUUuShZY0/Nx4IL28NWMcOGlRBVgxV4N2IO6BEV X-Received: by 10.55.10.12 with SMTP id 12mr23403925qkk.209.1476720539259; Mon, 17 Oct 2016 09:08:59 -0700 (PDT) Subject: Re: [PATCH 2/2] Document the M_ARENA_* mallopt parameters To: Siddhesh Poyarekar , libc-alpha@sourceware.org References: <1476120388-26662-1-git-send-email-siddhesh@sourceware.org> <1476120388-26662-2-git-send-email-siddhesh@sourceware.org> From: Carlos O'Donell Message-ID: <8183dc36-7d6a-bbfc-b6ff-568a2de8af28@redhat.com> Date: Mon, 17 Oct 2016 16:09:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1476120388-26662-2-git-send-email-siddhesh@sourceware.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-10/txt/msg00269.txt.bz2 On 10/10/2016 01:26 PM, Siddhesh Poyarekar wrote: > The M_ARENA_* mallopt parameters are in wide use in production to > control the number of arenas that a long lived process creates and > hence there is no point in stating that this interface is non-public. > Document this interface and remove the obsolete comment. > > * manual/memory.texi (M_ARENA_TEST): Add documentation. > (M_ARENA_MAX): Likewise. > * malloc/malloc.c: Remove obsolete comment. > --- > malloc/malloc.c | 1 - > manual/memory.texi | 21 +++++++++++++++++++++ > 2 files changed, 21 insertions(+), 1 deletion(-) > > diff --git a/malloc/malloc.c b/malloc/malloc.c > index 09e004b..0011a6d 100644 > --- a/malloc/malloc.c > +++ b/malloc/malloc.c > @@ -1718,7 +1718,6 @@ static struct malloc_par mp_ = > }; > > > -/* Non public mallopt parameters. */ > #define M_ARENA_TEST -7 > #define M_ARENA_MAX -8 > > diff --git a/manual/memory.texi b/manual/memory.texi > index 222f126..b98dcf2 100644 > --- a/manual/memory.texi > +++ b/manual/memory.texi > @@ -1153,6 +1153,27 @@ order to return memory to the system. > > This parameter can also be set for the process at startup by setting the > environment variable @code{MALLOC_TRIM_THRESHOLD_} to the desired value. > + > +@item M_ARENA_TEST This description of an arena doesn't belong here, it belongs higher up in the manual, and in fact I would suggest the following: - Move 3.2.2.6 "Efficiency considerations for malloc" up to just under "Dynamic Memory allocation" and put it under a new subsection "The GNU allocator". - Under "The GNU allocator" give a brief 1 paragraph description of how the allocator works e.g. https://sourceware.org/glibc/wiki/MallocInternals and talk about arenas. > +An arena is a memory pool that is allocated to act as a heap alongside the > +system heap that the kernel creates for the process. This is to provide > +multiple heap structures for multiple threads of a process to reduce contention > +between them. The limit to the number of such arenas per process is determined > +by the number of cores of the system and whether it is a 32-bit or a 64-bit > +processor. You don't say what M_ARENA_TEST is for? > + > +The value is ignored if @code{M_ARENA_MAX} is set either via @code{mallopt} or > +via the @code{MALLOC_ARENA_MAX} environment variable. > + > +This parameter can also be set for the process at startup by setting the > +environment variable @code{MALLOC_ARENA_TEST} to the desired value. What is the default? > + > +@item M_ARENA_MAX > +This parameter sets the number of arenas to use regardless of the number of > +cores in the system. > + > +This parameter can also be set for the process at startup by setting the > +environment variable @code{MALLOC_ARENA_MAX} to the desired value. What is the default? > @end table > > @end deftypefun > -- Cheers, Carlos.