From patchwork Wed Oct 30 22:11:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 35488 Received: (qmail 24426 invoked by alias); 30 Oct 2019 22:11:32 -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 24418 invoked by uid 89); 30 Oct 2019 22:11:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572473488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QJcU6WIiUIHIXSrvwhJE8KkeVEqrZyVB+2P57drfEGA=; b=SxOnF66J8lbdoOG53NPeaTZZ8hL/Av11LeUzWAHmfj3VOn5ZqjDVL31UxkYLauQ07tv4si DZVjgI0g+3viC1/1A+VHEZbllacGXRH72s9SNfKHQsNFjIozwhlhLczKYsP3tdSCyjYuqx jiBg18Krkkcmjms7nsTc48dpFFKG/zY= Date: Wed, 30 Oct 2019 18:11:23 -0400 Message-Id: From: DJ Delorie To: libc-alpha@sourceware.org Subject: [patch v1] malloc: fix set_max_fast "impossibly small" value X-Mimecast-Spam-Score: 0 From 83035919da9208a7e6666bdde60e110e2e301553 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Wed, 30 Oct 2019 18:03:14 -0400 Subject: Base max_fast on alignment, not width, of bins set_max_fast set the "impossibly small" value based on, eventually, MALLOC_ALIGNMENT. The comparisons for the smallest chunk used, eventuall, MIN_CHUNK_SIZE. Note that i386 is the only platform where these are the same, so a smallest chunk *would* be put in a no-fastbins fastbin. This change calculates the "impossibly small" value based on MIN_CHUNK_SIZE instead, so that we can know it will always be impossibly small. diff --git a/malloc/malloc.c b/malloc/malloc.c index 5d3e82a8f6..70cc35a473 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1621,7 +1621,7 @@ static INTERNAL_SIZE_T global_max_fast; #define set_max_fast(s) \ global_max_fast = (((s) == 0) \ - ? SMALLBIN_WIDTH : ((s + SIZE_SZ) & ~MALLOC_ALIGN_MASK)) + ? MIN_CHUNK_SIZE / 2 : ((s + SIZE_SZ) & ~MALLOC_ALIGN_MASK)) static inline INTERNAL_SIZE_T get_max_fast (void)