From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dog.birch.relay.mailchannels.net (dog.birch.relay.mailchannels.net [23.83.209.48]) by sourceware.org (Postfix) with ESMTPS id DFEBF3858C5E for ; Wed, 5 Jul 2023 10:46:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DFEBF3858C5E Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=sourceware.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=sourceware.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 55AA97A0B3F; Wed, 5 Jul 2023 10:46:12 +0000 (UTC) Received: from pdx1-sub0-mail-a286.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id C579E7A0203; Wed, 5 Jul 2023 10:46:11 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1688553971; a=rsa-sha256; cv=none; b=eA6koChBAmhBdSOoXnMqiaypkBlrK7kJHHrT/Y72r+ShFcuH4mprTSxE3WerFllQAxXVw5 mxrEFjzWUnjL+QGDBkLv0SsOzqxrVqAOSJp/bgy5Ev6KIGAi213ZSGZWv7I53gF+JkQuQc q9TUDjJwOzlIEz4/BneNO2K9eorXz4a8zxQCpt0HsLA++pnSL+UV5FzQP2AUic7v9+mXld 7LLKnL+tfV/dG3iI2SLTvZnEgU3w0M8Ng90v1zWCXX/UjYZyHi7E//AWhoyDk00z9XbYuh NxC0UoWyJ/yrI4iGta9twM4ZxhSLMMgv5MDvbpWKQYv50bQXDBdKS1d9Z0ueEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1688553971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J3/WffHL8PDf+fo30Cvijz9eNwC7t4bq4dSy9KV5nJ8=; b=in6IrNpzDm53hVgfILzRDhA4Tdg909TmMe0wKtEWejj6gXOYp7DgSStpwGD5JWuvnhtODU 84BXeCBhf2+ZLxSNH/IVc2yLOq31UG4VnpOysUxOalrgCMXyJCquUuyDzVPutAEXl1fLIV cLTgcwcaoHQdx8huzHQ8MdIEYYoTqDO9LzO8miUJRy/ewFVxlXA8Tbs6rzEYhAvoU9+Q0l EWfUfivXV/HmGR1LniHpm3aguKzBgVu3GmDvpwUhX3iZN9SKg0F8qGwUJ3ieapmo9PaY7u 2K8uY0WnXGRSW7YueF3YqfgMvXB+Ba9wmxqWuyU2U1kxnwkvvendCbNFg1r5zg== ARC-Authentication-Results: i=1; rspamd-7ccd4b867f-k4hrn; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@sourceware.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Sponge-Ski: 77e3027210839437_1688553972034_3106971794 X-MC-Loop-Signature: 1688553972034:2027686083 X-MC-Ingress-Time: 1688553972034 Received: from pdx1-sub0-mail-a286.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.118.14.145 (trex/6.9.1); Wed, 05 Jul 2023 10:46:12 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-09-174-91-45-44.dsl.bell.ca [174.91.45.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a286.dreamhost.com (Postfix) with ESMTPSA id 4QwxCl1qSlzFL; Wed, 5 Jul 2023 03:46:10 -0700 (PDT) Message-ID: Date: Wed, 5 Jul 2023 06:46:06 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] realloc: Limit chunk reuse to only growing requests [BZ #30579] Content-Language: en-US To: Nicolas Dusart , libc-alpha@sourceware.org Cc: Aurelien Jarno References: <20230704182402.1040962-1-siddhesh@sourceware.org> <911272453cd5141dbe1ccbcc1e195296c5573ca0.camel@freedelity.be> From: Siddhesh Poyarekar In-Reply-To: <911272453cd5141dbe1ccbcc1e195296c5573ca0.camel@freedelity.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1166.0 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_SOFTFAIL,TXREP,T_SCC_BODY_TEXT_LINE 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: On 2023-07-05 03:08, Nicolas Dusart wrote: > Siddhesh, if you happen to find an heuristic that is suitable and can > save reallocations for bigger shrinks, may I suggest to avoid reusing > an option if the new behavior of this option does not fit exactly in > the expectation of how it worked earlier ? FWIW, the original optimization was not for shrinks; the shrinks came in as a side-effect and I thought it would be clever to allow shrinking up to trim threshold and didn't anticipate the broad impact then. A number of distributions tend to rebase early and I had expected applications like redis to stumble over if anything was amiss, which didn't happen. I reckon the plasma desktop issue didn't get caught early because the proactive rebasers (Fedora, Suse Tumbleweed and Ubuntu) are primarily Gnome based. In any case, this patch limits the optimization to growths only, which is far more convenient to reason because it grows into existing unused padding. There's no real benefit to keeping parts of a block around in case of a shrinking allocation AFAICT. This growth-into-padding optimization is also useful only because it's a relatively lightweight check; if it gets any more complex then it's probably not worth the effort. Sid