From patchwork Mon Oct 10 17:33:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 680510 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 3st6gB4CbQz9s9N for ; Tue, 11 Oct 2016 04:33:58 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=UWEltUjC; 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:from:to:subject:date:message-id; q=dns; s= default; b=cmwynmD+AR7l8+fDrgkessFXx6PJMrA7woKug/KnX822pSlnCxg6Z ehfW+JtgBVCmiKQtdQVEVUeRyWdwA2c207TN09FMM4gRoDGQbZC8gvKc0cwJGA91 XQLvUVtsc4f7Z8/byeXQ2vh4xUCzb5pYm351Eqir0dXsSvlo7g8wdg= 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:from:to:subject:date:message-id; s=default; bh=CSs27G+mOOoHT3ZFBc8nVH319rw=; b=UWEltUjCJM+fdrkRr6N00UzEhloL w003T/Izgn3Poc651rVhpMEmsZkOOOLQ9au8yf1lx+vWxi9xu1/MOH2yKQWZS2JC gWbr83kxabrarLnkiwu00Jdr1PkGJf4djmQ785cKTwihdL2zGm3VQwr+Pm1dOv2L N0UpZwcD2f6PHyQ= Received: (qmail 37419 invoked by alias); 10 Oct 2016 17:33:48 -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 37353 invoked by uid 89); 10 Oct 2016 17:33:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL autolearn=no version=3.3.2 spammy=strategies, arena, Hx-languages-length:2353 X-HELO: homiemail-a91.g.dreamhost.com From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Subject: [PATCH] Remove references to sbrk to grow/shrink arenas Date: Mon, 10 Oct 2016 23:03:36 +0530 Message-Id: <1476120816-26989-1-git-send-email-siddhesh@sourceware.org> The manual incorrectly references sbrk as the method used to grow and shrink heaps and the fact that M_TRIM_THRESHOLD and M_TOP_PAD control that behavior. In reality, a heap may be grown or shrunk through multiple methods depending on whether it is the main arena (in which case sbrk is correct) or not (in which case, there are a number of strategies including allocating an additional heap to grow an arena and/or 'mprotect' a region to make it available for allocation). Remove references to sbrk so that it covers the behavior more accurately. * manual/memory.texi (M_TOP_PAD): Remove reference to sbrk. (M_TRIM_THRESHOLD): Likewise. --- manual/memory.texi | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/manual/memory.texi b/manual/memory.texi index b98dcf2..8ef2bbd 100644 --- a/manual/memory.texi +++ b/manual/memory.texi @@ -1138,18 +1138,16 @@ overwritten. This parameter can also be set for the process at startup by setting the environment variable @code{MALLOC_MMAP_PERTURB_} to the desired value. @item M_TOP_PAD -This parameter determines the amount of extra memory to obtain from the -system when a call to @code{sbrk} is required. It also specifies the -number of bytes to retain when shrinking the heap by calling @code{sbrk} -with a negative argument. This provides the necessary hysteresis in -heap size such that excessive amounts of system calls can be avoided. +This parameter determines the amount of extra memory to obtain from the system +when an arena needs to be extended. It also specifies the number of bytes to +retain when shrinking an arena. This provides the necessary hysteresis in heap +size such that excessive amounts of system calls can be avoided. This parameter can also be set for the process at startup by setting the environment variable @code{MALLOC_TOP_PAD_} to the desired value. @item M_TRIM_THRESHOLD This is the minimum size (in bytes) of the top-most, releasable chunk -that will cause @code{sbrk} to be called with a negative argument in -order to return memory to the system. +that will trigger a system call in 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.