From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from hall.aurel32.net (hall.aurel32.net [IPv6:2001:bc8:30d7:100::1]) by sourceware.org (Postfix) with ESMTPS id A292F3858C5E; Wed, 5 Jul 2023 11:55:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A292F3858C5E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=aurel32.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aurel32.net ; s=202004.hall; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Content-Transfer-Encoding:From:Reply-To: Subject:Content-ID:Content-Description:X-Debbugs-Cc; bh=bCLsVdggdBDID6HWxkcYQHGrssWaV7NNXO+NohdBxf0=; b=0j6eSul1TUvxwKGdzaICxvDwIA wLJ6d6hnvGoHIip9ZP/OzviOiHbMJycAQqJ1/pLSAIc7E1mqHioOqoxUBl/aUmEwDnlUunP7TDV03 DZcA3Q+TIeU7g8gA2ZjBLepJkdW2iG9R/BS8qMPJW4woSNWTyG8T86RGL6GT3VyI5SQHPZWRh680b 9GleMHHGeSJPiDv2sTiV1iGlswcnP8MASnaW54t8cAJwY8qIHSV1BMClAEfdBAFhAScgIyJJHwHAg 5kKfXGR+fXZtf4kb4pqzGnVmSjYMGa+P6bXt4UJFLjNgMkT/mQEjg9Z+19xoA9/prqCrnXgu0knB9 0W5GDUzg==; Received: from [2a01:e34:ec5d:a741:8a4c:7c4e:dc4c:1787] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qH16U-000asS-Ng; Wed, 05 Jul 2023 13:55:26 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.96) (envelope-from ) id 1qH16U-0014br-0p; Wed, 05 Jul 2023 13:55:26 +0200 Date: Wed, 5 Jul 2023 13:55:26 +0200 From: Aurelien Jarno To: Siddhesh Poyarekar Cc: libc-alpha@sourceware.org, Nicolas Dusart Subject: Re: [PATCH] realloc: Limit chunk reuse to only growing requests [BZ #30579] Message-ID: Mail-Followup-To: Siddhesh Poyarekar , libc-alpha@sourceware.org, Nicolas Dusart References: <20230704182402.1040962-1-siddhesh@sourceware.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230704182402.1040962-1-siddhesh@sourceware.org> User-Agent: Mutt/2.2.9 (2022-11-12) X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham 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, On 2023-07-04 14:24, Siddhesh Poyarekar via Libc-alpha wrote: > The trim_threshold is too aggressive a heuristic to decide if chunk > reuse is OK for reallocated memory; for repeated small, shrinking > allocations it leads to internal fragmentation and for repeated larger > allocations that fragmentation may blow up even worse due to the dynamic > nature of the threshold. > > Limit reuse only when it is within the alignment padding, which is 2 * > size_t for heap allocations and a page size for mmapped allocations. > There's the added wrinkle of THP, but this fix ignores it for now, > pessimizing that case in favor of keeping fragmentation low. > > This resolves BZ #30579. > > Signed-off-by: Siddhesh Poyarekar > Reported-by: Nicolas Dusart > Reported-by: Aurelien Jarno > --- > > The test case in the bz seems fixed with this, bringing VSZ and RSS back > to ~40M from ~1G. Aurelien, can you please test with plasma desktop? Thanks for the quick fix. I confirm that this patch fixes the issue with plasma desktop. Regards Aurelien -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://aurel32.net