From patchwork Wed Feb 10 21:39:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 581639 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 2163914031D for ; Thu, 11 Feb 2016 08:39:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=CZc6MOov; 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=WPRKZiycAcWOeNoLl6p2lZzpOVq66 2YY+5cIe8IhKx0yBtWP6K9swm15Eb7tspdnvHYf2PVOfvcPx8U9wAQH3WAiwEcfy bTP6N+H0l/B/UO2wDY0qIQtE2PaKbmho7bGAJEfejMW3mtLFlRUf9nDsZRPv+vf3 1eaT5lAiTeM6BQ= 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=1OMhThLHCm06YvHoAqsSBNgrbZ4=; b=CZc 6MOovMbn6JNdHO89OrzhRKfomJtULv/Nlby2079/JJgEs98Sr48WR4vX467YD4kX ul65OotKqR0toQTcSzJ7J8nitXKBWbMOc1nUftGghDveokt0s9LibNi7S57nGmyB bArQbfceUuKJr+/d+yhRazqZE4crNDiNibLcgsE4= Received: (qmail 57620 invoked by alias); 10 Feb 2016 21:39:17 -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 57602 invoked by uid 89); 10 Feb 2016 21:39:16 -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=acquired, Success, Hx-languages-length:2196 X-HELO: mx1.redhat.com To: GNU C Library From: Florian Weimer Subject: [PATCH] malloc: Remove arena_mem variable Message-ID: <56BBAE00.3060908@redhat.com> Date: Wed, 10 Feb 2016 22:39:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 The computed value is never used. The accesses were data races. Florian 2016-02-10 Florian Weimer * malloc/malloc.c (sysmalloc): Do not update arena_max. * malloc/arena.c (arena_max): Remove. (heap_trim, _int_new_arena): Do not update arena_max. diff --git a/malloc/arena.c b/malloc/arena.c index 1edb4d4..54cf086 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -91,9 +91,6 @@ static mstate free_list; acquired. */ static mutex_t list_lock = _LIBC_LOCK_INITIALIZER; -/* Mapped memory in non-main arenas (reliable only for NO_THREADS). */ -static unsigned long arena_mem; - /* Already initialized? */ int __malloc_initialized = -1; @@ -705,7 +702,6 @@ heap_trim (heap_info *heap, size_t pad) if (new_size + (HEAP_MAX_SIZE - prev_heap->size) < pad + MINSIZE + pagesz) break; ar_ptr->system_mem -= heap->size; - arena_mem -= heap->size; LIBC_PROBE (memory_heap_free, 2, heap, heap->size); delete_heap (heap); heap = prev_heap; @@ -743,7 +739,6 @@ heap_trim (heap_info *heap, size_t pad) return 0; ar_ptr->system_mem -= extra; - arena_mem -= extra; /* Success. Adjust top accordingly. */ set_head (top_chunk, (top_size - extra) | PREV_INUSE); @@ -793,7 +788,6 @@ _int_new_arena (size_t size) a->attached_threads = 1; /*a->next = NULL;*/ a->system_mem = a->max_system_mem = h->size; - arena_mem += h->size; /* Set up the top chunk, with proper alignment. */ ptr = (char *) (a + 1); diff --git a/malloc/malloc.c b/malloc/malloc.c index d20d595..86e2a03 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -2410,7 +2410,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av) && grow_heap (old_heap, MINSIZE + nb - old_size) == 0) { av->system_mem += old_heap->size - old_heap_size; - arena_mem += old_heap->size - old_heap_size; set_head (old_top, (((char *) old_heap + old_heap->size) - (char *) old_top) | PREV_INUSE); } @@ -2420,7 +2419,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av) heap->ar_ptr = av; heap->prev = old_heap; av->system_mem += heap->size; - arena_mem += heap->size; /* Set up the new top. */ top (av) = chunk_at_offset (heap, sizeof (*heap)); set_head (top (av), (heap->size - sizeof (*heap)) | PREV_INUSE);