From patchwork Wed Feb 10 21:41:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 581661 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 E661614031D for ; Thu, 11 Feb 2016 08:41:19 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=KdP8eoSn; 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:to:from:subject:message-id:date:mime-version :content-type; q=dns; s=default; b=AKUyVmQVwh5P1oVHeg6pqn7a+IXqm TQu86H4CfE9puc/PoytNamMm7s7NsCXifDtX9KmEavxe0+EXoy5fURafWtRRp65f p5Goqs8azvb3H169Q2eRYSBlQlbPP0zufFx+QwmEIBTDC42iRWIP4Z6P4YW9r2iy yxfknG9WSm+A9w= 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:to:from:subject:message-id:date:mime-version :content-type; s=default; bh=NWEi6YJ90CfeANxgwB5+XHOgFH4=; b=KdP 8eoSnjtwUdFBy9OjFKDBgzpYaim5xLpdt5+MmbrBPB0CWB25NqAo45F2YK/Zi2Dh mAbWSAOZelZ0qjo/ZIxbFKcabS5uFHoLGAvj9jUOzHgdL4JS1kW+OqdMfSrxARON KQ/T0o12lKUcDIUDfDhXGP9eBSoA0CyewNku9MuE= Received: (qmail 89726 invoked by alias); 10 Feb 2016 21:41:12 -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 89716 invoked by uid 89); 10 Feb 2016 21:41:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=statistics, trimming, 6497, hblks X-HELO: mx1.redhat.com To: GNU C Library From: Florian Weimer Subject: [PATCH] malloc: Remove max_total_mem member form struct malloc_par Message-ID: <56BBAE73.3090502@redhat.com> Date: Wed, 10 Feb 2016 22:41:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 Also note that sumblks in struct mallinfo is always 0. No functional change. Florian 2016-02-10 Florian Weimer * malloc/malloc.c (__libc_mallinfo): Update comment. (struct malloc_par): Remove max_total_mem member, it was always 0. (int_mallinfo): Store 0 into usmblks (no functional change). * malloc/hooks.c (struct malloc_state): Document that max_total_mem is always 0. * malloc/malloc.h (struct mallinfo): Dcoument that usmblks is always 0. * manual/memory.texi (Statistics of Malloc): Likewise. diff --git a/malloc/hooks.c b/malloc/hooks.c index 7a85136..0d2bb96 100644 --- a/malloc/hooks.c +++ b/malloc/hooks.c @@ -480,7 +480,7 @@ struct malloc_save_state unsigned long mmap_threshold; int check_action; unsigned long max_sbrked_mem; - unsigned long max_total_mem; + unsigned long max_total_mem; /* Always 0, for backwards compatibility. */ unsigned int n_mmaps; unsigned int max_n_mmaps; unsigned long mmapped_mem; diff --git a/malloc/malloc.c b/malloc/malloc.c index 86e2a03..1038df4 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -649,8 +649,7 @@ libc_hidden_proto (__libc_mallopt) have been freed but not use resused or consolidated) hblks: current number of mmapped regions hblkhd: total bytes held in mmapped regions - usmblks: the maximum total allocated space. This will be greater - than current total if trimming has occurred. + usmblks: always 0 fsmblks: total bytes held in fastbin blocks uordblks: current total allocated space (normal or mmapped) fordblks: total free space @@ -1743,10 +1742,7 @@ struct malloc_par /* Statistics */ INTERNAL_SIZE_T mmapped_mem; - /*INTERNAL_SIZE_T sbrked_mem;*/ - /*INTERNAL_SIZE_T max_sbrked_mem;*/ INTERNAL_SIZE_T max_mmapped_mem; - INTERNAL_SIZE_T max_total_mem; /* only kept for NO_THREADS */ /* First address handed out by MORECORE/sbrk. */ char *sbrk_base; @@ -4665,7 +4661,7 @@ int_mallinfo (mstate av, struct mallinfo *m) { m->hblks = mp_.n_mmaps; m->hblkhd = mp_.mmapped_mem; - m->usmblks = mp_.max_total_mem; + m->usmblks = 0; m->keepcost = chunksize (av->top); } } diff --git a/malloc/malloc.h b/malloc/malloc.h index f65e18a..d95a315 100644 --- a/malloc/malloc.h +++ b/malloc/malloc.h @@ -83,7 +83,7 @@ struct mallinfo int smblks; /* number of fastbin blocks */ int hblks; /* number of mmapped regions */ int hblkhd; /* space in mmapped regions */ - int usmblks; /* maximum total allocated space */ + int usmblks; /* always 0, preserved for backwards compatibility */ int fsmblks; /* space available in freed fastbin blocks */ int uordblks; /* total allocated space */ int fordblks; /* total free space */ diff --git a/manual/memory.texi b/manual/memory.texi index 700555e..3d99147 100644 --- a/manual/memory.texi +++ b/manual/memory.texi @@ -1520,7 +1520,7 @@ This is the total number of chunks allocated with @code{mmap}. This is the total size of memory allocated with @code{mmap}, in bytes. @item int usmblks -This field is unused. +This field is unused and always 0. @item int fsmblks This field is unused.