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: 1186996 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-106489-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="vGtTFhMh"; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="SxOnF66J"; dkim-atps=neutral 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 473N2y1PMkz9sPh for ; Thu, 31 Oct 2019 09:11:37 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:message-id:from:to:subject:content-type :content-transfer-encoding; q=dns; s=default; b=MhKQ12ULtjal5uWh mJr5I7FmM8QGqGThKhddL5swMdAjPIKnNlLpfScqSmQztUsPK/B7PzLxdSS9hPgP ZO7/wYxp5goG04WQ0x4kJuyX1IFqRr73LGFkgqSQHn2AVGGGEftprAXbR+BLdZYd vnZiZKpJTHfeGzgZGAjrV4yhRtE= 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:date:message-id:from:to:subject:content-type :content-transfer-encoding; s=default; bh=lZs4yKTBgkZlk+rr1e2KR9 ucwtw=; b=vGtTFhMhfuRFZntuJfrten6nciuOevqBB4Y10LhO1dyvD1kbKyU5M9 abWcB+EayF1IRndWtPkxUK/4bu3FSQgjvhwDWTxHLf6gp3h3WDOZPhhQ5uw0vk9D E/DSiNcV87Tt9LL0gMVLAY9DuHTgugi5RlUyYOxwSN8YchS1K/KCU= 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)