From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2083.outbound.protection.outlook.com [40.107.7.83]) by sourceware.org (Postfix) with ESMTPS id CD51F3864A0B for ; Tue, 6 Dec 2022 13:29:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CD51F3864A0B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DrA8IEVWCZKfAjTdsQGupRhSmvRD66Vsl1g8xBmVeAU=; b=x+0x1E77qOPkd+awUtI4V4vEYqE6xzdex4PeEn0mGCwJvUXk7opkc/lk0aCjP7XPLsw2uaEZbrq6Ibf2I95hA1hLqOBLO6V1ofttU1qni4UG8kmE0rYWA/VPbbalwApbd/M/MWc2nW4gsHLacPko8SQU0hsao+wotAEXWIs7PUI= Received: from DB7PR05CA0058.eurprd05.prod.outlook.com (2603:10a6:10:2e::35) by PAWPR08MB10133.eurprd08.prod.outlook.com (2603:10a6:102:35f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Tue, 6 Dec 2022 13:29:18 +0000 Received: from DBAEUR03FT024.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2e:cafe::4b) by DB7PR05CA0058.outlook.office365.com (2603:10a6:10:2e::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8 via Frontend Transport; Tue, 6 Dec 2022 13:29:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT024.mail.protection.outlook.com (100.127.142.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5901.14 via Frontend Transport; Tue, 6 Dec 2022 13:29:18 +0000 Received: ("Tessian outbound b4aebcc5bc64:v130"); Tue, 06 Dec 2022 13:29:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9014e17c632dc942 X-CR-MTA-TID: 64aa7808 Received: from 91503078a243.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id CBB85E5F-FE55-4243-8BE4-33939B9F93DE.1; Tue, 06 Dec 2022 13:29:11 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 91503078a243.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 06 Dec 2022 13:29:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=duCSNyZLAv4Om3aGPhq59DOibJxfgsP+EJzeAhilyjx0zKFGL75pgQlCpJzx7Ql3KsM7wIWg/ZeVFoJA95xPEcDE2koZmX3B5eSo9YIpOJ8NJ/Qke07aWds7ikP7LUptUf/JHAQSIIXauaNT++q25eQl8AoaaS0d+aKF99XFx/ltgHI+uA29kvlEo22jamm+VAULLzS2nc9V6gyHKScK1PWqHrb016tweMDBjjO3VBlQNxfMs57i2rnYOhP00vaVe/V49DXm3Q4bK9ufgeUSs8KOlDlnpipgHraoFlcvfh97ctClILw5Khj7XijNuzleEvHfkvHOuWqZnZmDgfl9jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DrA8IEVWCZKfAjTdsQGupRhSmvRD66Vsl1g8xBmVeAU=; b=CJacfM4iKpnKeFmMezpQJiQDhPR2CRd6qYpi+M7HMZJrMNp0ppdwthsZvPmPN1cbfPp8hXhnzwfaD2hvlRb8PnEh1oEyRzAEjikjVIIAZN/XutTpTw1EJ4k629V5ne5fYaO9A2hCWU9Q5OSZ9wzMO11h2b8bACIA1MWY7WmV+x0uQtbj++VFt2pbi1KcdgArd5FiTQ2oJST9IWXK4Ceq0dG+Lk0kjLIPspJwtfshNCjgeAC6FVwnfHodP3cGs+sYsz5qDHQ+QnV9/Td7pF3aXLMS+hpIK6k+sDoBbZqadW1bxlUCX6zFylkoaXAMfp1C+cgARaL6zL7dChVYbEbIWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DrA8IEVWCZKfAjTdsQGupRhSmvRD66Vsl1g8xBmVeAU=; b=x+0x1E77qOPkd+awUtI4V4vEYqE6xzdex4PeEn0mGCwJvUXk7opkc/lk0aCjP7XPLsw2uaEZbrq6Ibf2I95hA1hLqOBLO6V1ofttU1qni4UG8kmE0rYWA/VPbbalwApbd/M/MWc2nW4gsHLacPko8SQU0hsao+wotAEXWIs7PUI= Received: from PAWPR08MB8982.eurprd08.prod.outlook.com (2603:10a6:102:33f::20) by GVXPR08MB7821.eurprd08.prod.outlook.com (2603:10a6:150:4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.13; Tue, 6 Dec 2022 13:29:09 +0000 Received: from PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::66e4:4940:d096:4f7]) by PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::66e4:4940:d096:4f7%8]) with mapi id 15.20.5880.008; Tue, 6 Dec 2022 13:29:09 +0000 From: Wilco Dijkstra To: DJ Delorie , "zack@owlfolio.org" CC: "fweimer@redhat.com" , "libc-alpha@sourceware.org" Subject: Re: [PATCH] malloc: Use correct C11 atomics for fastbin Thread-Topic: [PATCH] malloc: Use correct C11 atomics for fastbin Thread-Index: AQHY/cJS/cK/f0PorUWetLVbA8LI1q5aHYIAgAAXvhOAAEQcRYAADGLggAAHw+SAAHYsAIAF5wRG Date: Tue, 6 Dec 2022 13:29:09 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: PAWPR08MB8982:EE_|GVXPR08MB7821:EE_|DBAEUR03FT024:EE_|PAWPR08MB10133:EE_ X-MS-Office365-Filtering-Correlation-Id: 91132328-de3d-469b-fdac-08dad78de0c6 x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: jQSNaIE1FjQbSzt5l3Z8/Rl9uMGOeOkeiVppP+lwvikaMH7fXSz1DZ78fm7aZ8UJeWI2Xmu82jTrjVu5eMfQpU89Yt2Ls271zJNxL54p49iGD/HgHoGii8I+Auiz/ccLgvtfvau55QS+iYTrCVXXUSB58NfI/V1wLMLW8S1a6fq/ozePy+1Zro6Y6ybLuyF9RqlOUlB/CElBxrprLdX9ycYCdjmZFhfGuR33dnEY1VdvEgSbur2tBjf7St3c19k2GaHavRN03HaV2WXM2Jsn1/dkSJWP2u3WSpy0xXrzi7viWXxIpHnaPmTmrfSrONnwDVjuVBvvTUvXKS6EnjSC+tdoC9DIZzQ7L0prZBL9Hf0TPyGmOF+qu72MgfA/+e6eMFBBIlB0l1dnBieJ5LzpbwJK1YKFVsvGyr8blmtihxWntKL9Qub4WRL/PnE9jeCmtae/+xwaqkh0ndFnRYTLht17qdVHmd2CPgomibA+D68evRoOnXlCzRMI2yUSGAVXJponj4UWyxhfw0ndV8ThMYP3Srdni2Epls1yVfg7jsBCdGi3O9MerScFaryadWYeaiFmDmtXChsn53QMCD6IEboSg/5ALJTomEUAjcLitDkCy/S9h2XxYyFbSXBQa79B/QdKZTomvSbUvjOihpnhJsjkWIrL07WNdP5o7hf0ot4Wt6fo+LblGXEr3KiZNRGS/yJrinObXeGApInIdLQ1CA== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAWPR08MB8982.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(346002)(366004)(39860400002)(376002)(396003)(451199015)(64756008)(478600001)(7696005)(6506007)(71200400001)(53546011)(26005)(66446008)(66476007)(91956017)(110136005)(66946007)(54906003)(9686003)(66556008)(76116006)(4326008)(316002)(8676002)(52536014)(33656002)(5660300002)(122000001)(41300700001)(8936002)(86362001)(55016003)(186003)(2906002)(38100700002)(38070700005);DIR:OUT;SFP:1101; Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB7821 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT024.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 464f3334-2033-407d-fc2b-08dad78ddb3c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sXCNYIxMlcHLbwXLUUDoFXpm3Cni8V23eCZlN/fq/FjHI6nr5F4PSa25/0J5CLxB/TG3ehhxv2CpHLqsqUWqTgSZv1MYXNHohOFOU8YLOKTwNcyDz3jQvETEWi226rIZ5j4bN46qfeXAvULPjEtvsKH0ocyvW1P2kKrAqUrzmgdO7gh09LOeIbJj3P9FO4Qutcl1AQ3qkdVkag5jeais9A7i4AnC732tlG9WjC6+ik9rjfyhW8tYf4byAVOeHsI7wqMYZAJqdYrP5PB2iN+Z4/WCNJtxs3SGSP/tOTpGsb0FBC1wxfHg+wqCu7+OCersqU5xuoN/eu5c3t9OBhVmNU2XsKylUTW3vudURkVRQbkgo0kUsLT6cierYEUmcLFxAGT7+uGLN5A7OcxReh9atADVYHTC7+pzUfvTLIBXtT7XkH9ofF03X6WFdsS1B5W9Bbis18xG5bK6PYvAbK+fr9eDI5jpzCKIOh+DLPwb3xLehSwn15sbqnl/DvgMeiznNyQNbuRYZc93wB7pC3fIMoaBKYQrZWx036HzQCIUAUimmQ9I6LIBYtbTJWYWxoc0t4SrzKRghfnunoSSypfC7se6XlZnsJsPAiLEGV8CD046mcj58SO6Dh4efK1HorR/+/c49HqbccKgZd7wjnQV5Sp9n2/Jol72RX63v5iEhHOTxeiNemtvv8gP6z6sMhR8zPZoeWtPgKhZ8TLPoaQK0g== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230022)(4636009)(136003)(346002)(396003)(39860400002)(376002)(451199015)(36840700001)(46966006)(40470700004)(47076005)(7696005)(9686003)(36860700001)(2906002)(6506007)(26005)(82740400003)(40460700003)(53546011)(82310400005)(336012)(186003)(33656002)(5660300002)(478600001)(8936002)(52536014)(40480700001)(70586007)(70206006)(4326008)(41300700001)(8676002)(54906003)(81166007)(316002)(356005)(86362001)(110136005)(55016003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 13:29:18.7844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91132328-de3d-469b-fdac-08dad78de0c6 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT024.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB10133 X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi,=0A= =0A= On 2022-12-02 1:55 PM, DJ Delorie via Libc-alpha wrote:=0A= >> Wilco Dijkstra writes:=0A= >>> If we want to make tcache actually work, it will have to support far mo= re=0A= >>> allocations, particularly for smaller sizes.=0A= >> =0A= >> You can test that with a tunable; the max count per bin is runtime=0A= >> tunable.=0A= =0A= Yes you can use tunables, but how many applications actually use more=0A= optimized settings? It's the default that is the problem.=0A= =0A= >> But yeah, the point of tcache is to have a few of many sizes for fast=0A= >> allocations. Fastbins has a lot of a few small sizes. Testing showed= =0A= >> that both were required for best performance with the average=0A= >> application.=0A= =0A= Yes, that's due the tiny size of tcache (let's call it tiny-cache!). Once e= xhausted,=0A= you mostly end up using the fastbins.=0A= =0A= > Every time we start talking about fastbins vs tcache again I start =0A= > wondering, again, what's stopping us from replacing the entire malloc =0A= > implementation with jemalloc, or any other implementation designed less = =0A= > than 20 years ago.=0A= =0A= I can't see any technical reason why not. It's either that or completely re= writing=0A= the current implementation and getting rid of decades of accumulated cruft.= ..=0A= =0A= Modern allocators are not only much faster than GLIBC in their default sett= ings=0A= but also have lower memory usage. The two best allocators seem to be mimall= oc=0A= and jemalloc.=0A= =0A= Cheers,=0A= Wilco=