From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2047.outbound.protection.outlook.com [40.107.247.47]) by sourceware.org (Postfix) with ESMTPS id 7E5133858D38 for ; Fri, 12 Apr 2024 15:19:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7E5133858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7E5133858D38 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.247.47 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1712935171; cv=pass; b=bWo8TyDz8q8wbj6grH78LjJJfLjCORLmaqW3gGjabyYu6JBQQDcHWM4xemI/LdJne2sFtrDcv2vFhbtl9awZ6R+1MoENaCKMNnQrLMRrah65FxGFcMaQZR9xWFTM1Zzd1D9ooYVG03geQdyBflq0/It30J8h55P/R2MwvfJDYVY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1712935171; c=relaxed/simple; bh=kUgvRk0tfNdlnARyLeStlCTdWt7zTtUhoMovRcGqrsg=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=ArPCqd0xeJzGAh2SXnOaIv9DgeIZqkvbB+5GxImItU5N/znOXNho29IeqHkooRvUpqH5M7mhYsCAHjasiq0SQwFT3F3jlHwBZvUc5nQvUyQ+FxIzT0Yjg3yjFrsckyOFmQ2N8jyqPJaI4DoRJydLVyV9jE+An7KuhfiMlQVaLtM= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=NDus9jM291cfDwzG7mUvxFoW+c9ZgSfiwmd3x5FtXwgPoAOGoX3f6MC7q0RtRPRA7nsWrG7JwCcaZ+dsz6YCiouBXKHmK8ivnd+19cxjw2mAU3Slo004Z1VZC7QpOit77Bv/TEPTltI3TpoO/jQ4U9WdagcWSdF03Hxr/Kqs5gxiKZtmCfu7Cfre1sx4Y18o659v4c3Uso0nEQm2+V+lxXBkuxB3yg4B52RI6vq10aozgyUunCKm+7np5LTSWLx4iLKlBE/5OweQiU45NqyL/XuvxmnurJDe6Wr8nm8uDOPSB1iAQO89QDeW+BgF5ddMdqJ+yLDENYTz1294/3Hv6w== ARC-Message-Signature: i=2; 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=kUgvRk0tfNdlnARyLeStlCTdWt7zTtUhoMovRcGqrsg=; b=n0M5ui37xgG24+ewXtcYLN0dAP7s17kGjDRCZoEwfZgv++OVB+qsPJpbssUGDQtN4l4439C1bWv8wtpV/U6dm0rtnQ4CLISHJ/nYZgtNs2rOWTuaV/fbqoA8YJI7nW7J9RLyKE4EEyfjUxKVpoiDwCm4WmydU8AuZBHaDcjFZqyABWr6NFa3VHgLQNxgbsF2HHPhDz+B02Rwin2PVxdFQ7+OAVmarBCYSkDZmmSFFqYEUGigoYNL+YhH5h8e5gx5AXnoWhIPNtdpCkREkHTryJ5Ux5IZ1nMyTMlYwXFcH2WM01GeXWdPegFbGc+DxAROHcQrfgS1npyDwURmol+42A== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=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=kUgvRk0tfNdlnARyLeStlCTdWt7zTtUhoMovRcGqrsg=; b=UnNFZpqG+u88YnG4gs4+9tUCQDjvLJjuTOuhDZbqkXsy6lBAQ7uYpYJQg8x9xgOGUS0aBLaxnsRJ5vr8aXK9H3NfujvUeJepB8We6EJ9rv9zScgPUt8a9lIESgUJzILDgs+FE+Iybk+86cMbcZzeSO2Y3Hbv1BkJMN1DQd7gNo0= Received: from AM6PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:20b:b2::26) by DB9PR08MB8410.eurprd08.prod.outlook.com (2603:10a6:10:3d6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.55; Fri, 12 Apr 2024 15:19:25 +0000 Received: from AMS0EPF00000199.eurprd05.prod.outlook.com (2603:10a6:20b:b2:cafe::34) by AM6PR08CA0014.outlook.office365.com (2603:10a6:20b:b2::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.26 via Frontend Transport; Fri, 12 Apr 2024 15:19:25 +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 AMS0EPF00000199.mail.protection.outlook.com (10.167.16.245) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Fri, 12 Apr 2024 15:19:24 +0000 Received: ("Tessian outbound 93e51b94fd50:v313"); Fri, 12 Apr 2024 15:19:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 09e8265bc63eda87 X-CR-MTA-TID: 64aa7808 Received: from 250c48649f0c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2ED9FFEF-348E-4B50-B0B4-764F1844F2BE.1; Fri, 12 Apr 2024 15:19:16 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 250c48649f0c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Apr 2024 15:19:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ua8+kksUeMjx/cJefHqcn9MUkoYIj4KU7Z1XRIWmkXyNe8upRhR9+/V8TMQRFzQLwkN848KoCkTpkIcFPtHlBVp254ne6rns5B4c8vVj8kboqyHoaosxR6tZwswcUg9d7rvdV9cCvAFDY681LkqNDtuQ5ZEZ8mig4dTHVh8CDFBgPXQ9DytrgGk9bEPRbQ2pqPDVfY82DWm9Ni49O1n0GpBPducii8X9SakRKdjMkmpXJCbUkVFW2xGXsKDyQU6B3FIQg8r//mUvFk4p/yOoXJN/b3oD9tJu3B/c/tx67LjDI5LeDD1hqU02qxb5YHJtI3Cr28HrfzK8yX0jC7MHdw== 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=kUgvRk0tfNdlnARyLeStlCTdWt7zTtUhoMovRcGqrsg=; b=dnlhdAJW3xJaeDeZmi7dIDWGL2EquyozF5+7nkkP+MKIqaBcwRQr8BjMv1h2fNuCb3Ji+fkBQPmijHxaPUnEWIUOZTqUNQWxry+Gxy4F2loQ0MwbDQcuRNtKtiMA2bqqNla8Y5lHpyv1GORFrqyRH1KAgDDPBJnSjbVUC2BWUivI/2Q2mhug2YwgkqlI03Osm8zV7jyrzF+YD+gnYylYIQ9onMNGNp+mWPMXx72tuNwwpHwtyPUKXAdtoaREgxT8UabIci/wLo+meEjfMkm+fIraykW/CgdHwM2+EECo5X8pFoRLCwOeqqEA+acKwQYqHK71vV3Lg2HTsbjYXTA8Fg== 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=kUgvRk0tfNdlnARyLeStlCTdWt7zTtUhoMovRcGqrsg=; b=UnNFZpqG+u88YnG4gs4+9tUCQDjvLJjuTOuhDZbqkXsy6lBAQ7uYpYJQg8x9xgOGUS0aBLaxnsRJ5vr8aXK9H3NfujvUeJepB8We6EJ9rv9zScgPUt8a9lIESgUJzILDgs+FE+Iybk+86cMbcZzeSO2Y3Hbv1BkJMN1DQd7gNo0= Received: from PAWPR08MB8982.eurprd08.prod.outlook.com (2603:10a6:102:33f::20) by PA4PR08MB5998.eurprd08.prod.outlook.com (2603:10a6:102:e9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.54; Fri, 12 Apr 2024 15:19:12 +0000 Received: from PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::8b1b:5f28:5006:ac18]) by PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::8b1b:5f28:5006:ac18%4]) with mapi id 15.20.7409.053; Fri, 12 Apr 2024 15:19:12 +0000 From: Wilco Dijkstra To: "e@80x24.org" CC: 'GNU C Library' Subject: [RFT] malloc: reduce largebin granularity to reduce fragmentation Thread-Topic: [RFT] malloc: reduce largebin granularity to reduce fragmentation Thread-Index: AQHajOb/8Fwbx9+Fwk6rIA3j2yoEaA== Date: Fri, 12 Apr 2024 15:19:12 +0000 Message-ID: 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_|PA4PR08MB5998:EE_|AMS0EPF00000199:EE_|DB9PR08MB8410:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f3c2472-efd3-44aa-5749-08dc5b03ef80 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: UiBsrllr60HUWXpHo/Gl03m4xFrDZJi8vstdSZrwNaCjYAB26sZ7NxS+s4LpqeIybtvImrf9u5tTbLRPZJiwAk1zmPDXQyjI1ITJYYk5Wxd5ogeREclEcSPabvfy/NfekLs1m4e9ICSDXBPtC0moMUXif/HAHWCXSoMsY1vPED8sjvuY8wBq/v35aQwz8VK1HtquOaZMXS/Ma3CHPnBzk/yqMsp1mxmO2YoPQCfM3CRLRt6nCkLbkm1Oz9SIADCIc0hFiykHz1VN+drIHeu4nIPKDLKfMkegMhWTOhe0FpL4Wp+mulryjOpmQbS1j3ne0zNHd/G6PtsxHTBovhn8OOBVwm6f3kTOUSOyaScucMIuTpDodEtRYw0bYNamTVfHlHHpyDzFMXYzoAKnP9xK5Hn2EKNNuWbrn3llJ6a97/oacRbdtDEltoSngnZkYBK+UX6M7L83TElZyFfQnd8gbAwjxhWyTxPQpu6ovyhRgp9RlctkbBaw5fk/23wIFuYiQWDrwGa85DBryaR/dLYJ9gTNU68QSSVnEaiiegQDbHHSpV6El6FFMyO5/jv4X/OA3HtEoQKu7kM+pNxCWk5Tddyp+DHIYz94O/CZjwvPaLOSxfuuTVKQVPeO9/V0fucg+S2b5cIgbddFDTNYXtPFELz+n88tWPFkeREsRy97howDj9dgIP+6RteY5wBwnCX8QQu/R3A1nx0XxyBAlbMkcsglcqEr4OwOzwf+RpzLP84= 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:(13230031)(376005)(1800799015)(366007)(38070700009);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: PA4PR08MB5998 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: AMS0EPF00000199.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 35a3cfd4-3962-4c64-f16e-08dc5b03e8d8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZIP0hEJP9oq3CrJbDUxLHFPQZJ3Z1Kpbmzpbqlh9SV7xrUUQu/v1JQkeH+AkvN/GLS8XVM2cqV0RM0h7EMpefa8Gxc3kt9xGMpOSUJ+JTe5FjNLfMFkZPk0elOVqgiA8EwHFjTJAxGAG4oihnd9Tq6vHZ8LIRFjEIq72i+FoZ0Yvo684XjX2X3/xXrWbl7RCGwnQwe0lmRt9eSV+DoI9PyG0lwbS/R7I4aB6kx3GwsMh9cu4wZaHBJLvvDAoM80SBgpHMZOZKvNj/xaEalCS12UihL+rsyD2V0vrwJYMvm/lGvSOnXRqQ+udw2ezyj8NuCy+OlMv9IqXOkFj/svfVkVEUcX0YQeFwcoqugoxVCQWejoqUGnVAlPcnQeZHpYcXvEmk/lhq1rlYXOsPLUBEMymuqQDYBJ7FKgyV311pYNlGt9so/Yphbf6Ck+LvOlf04jUywryB+QSRNYwm40L6rBlyhr6p+UVsOc5sdyjJnGx4A9nVdJ44AUGOTluipE6PC1K6vMeUsuaKPUWBb7iMyPwmXdThTk8sO1QGax1uV/N3kbR3U5bHMR/4hJCxvhJQjNNAQH/VqUEmvW5c8lzc8uatCw91AXZE0F6PZlwhQukBjOgOHgMUHFy+yCJ/qJdF/w+JIroMW3p9dyL310Ff6GWZxrhbuxkSxtRAZ2pP/uH+fR3TZNf4mRsvL9T96VeMQeN0SNFSgiswhHKEAoJ+huoqw/mF8YK07se5nQdd5yqk5mg8Sguq9ru1t9e3Jhe 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:(13230031)(82310400014)(376005)(36860700004)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2024 15:19:24.0494 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f3c2472-efd3-44aa-5749-08dc5b03ef80 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: AMS0EPF00000199.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8410 X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_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 Eric,=0A= =0A= I agree that limiting size classes will help with fragmentation. However=0A= you need more than this: when it finds a block that is larger than requeste= d=0A= it will always split off the end even if it is a much smaller block. As a r= esult=0A= large blocks get smaller over time. Additionally allocations that can't be= =0A= satisfied by the free lists are taken from the large remainder of the arena= ,=0A= thus interleaving allocations of all sizes rather than grouping similar siz= es=0A= together in separate regions like modern allocators.=0A= =0A= The tcache and smallbin freelist also keeps freed block listed as 'allocate= d',=0A= thus blocking merging of free blocks into larger ones - this is only done= =0A= every now and again during a consolidation pass. Threads that free blocks= =0A= but never allocate a large block again may never really free their freed=0A= blocks.=0A= =0A= So to reduce fragmentation you also have to address all these issues too.= =0A= My general feeling is that this allocator is way too ancient and hacked up = to=0A= compete with modern allocators like jemalloc or mimalloc.=0A= =0A= Cheers,=0A= Wilco=0A= =0A=