From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 662DB348C54 for ; Tue, 28 Jul 2026 06:40:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785220835; cv=none; b=tUPunsoSXB85pi/qs4xhos5o/J0m/JJC3uetsK9GBLdv3KEraXBnpd5Tkaj2uRN3mYL0nJCCcDbaiTZmAEyzL6T0Gf3JeliB5ySBzTokJlMZ7IAZbnPrlRzN3u/NxfLuBz6KaKfBxL/dk9xJsghkcKvbE1lJP05HRpOqc3pN3Ac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785220835; c=relaxed/simple; bh=ULAeKuJ9tsVyz6Nfc1zNI/lk7yPenkt5rrvSBwERRI4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bFJrr89a7od2NE7zpi8F2IIiefkGqdNJXGUFQobIlP3ec34oMPmvlJkHRBgIbtj03grupOZy7bMrcIN717MyUqjVTOWw5xabWy/s8REFusI0QStxgXQFptfAQyy80YzMlDxW5D8OIiGRraUnArKWJYPDkudl6v1aMs2IFDxnDvA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jtAo+eAQ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jtAo+eAQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA0F61F000E9; Tue, 28 Jul 2026 06:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785220834; bh=ACxJe4D3rHkXg7y6V5XBMY94uTUMOyCLNCijYgiSQv4=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=jtAo+eAQkSMkmijUYpDMRcJ6cCKJfby3aNMi0KRQ8RjVVcA/QkLw7chMpKoDxC0AX 4Z1+9lz8EuhlPN4zQR1bbKYjcUP5fUF02DEXSeqBEfqjOjVjInQp2jfYkhstSj5oFI 0q30FbUjtJi2YPWjnRnUGg3JjpfnANcjlylBKm7Ue6m7ycLFV9fz2Dj0eTZtMK4+Kr Usl5Ziaax4NbglTNiE9JSXdo9L8O0m3hsf1Gy1kue1WXUZQhvBicqn5yX0yog4c2bo Zf2BV5I5tLgA1++9KRzE73dQDi+BiwCRr4ONGYerSK7cGU9Wr0pLW/tq+tcdLBO6Hn b6/oxICrsBp+g== Date: Tue, 28 Jul 2026 14:40:26 +0800 From: Gao Xiang To: Zhan Xusheng Cc: Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale , Hongbo Li , Chunhai Guo , Nick Terrell , David Sterba , linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, Zhan Xusheng Subject: Re: [PATCH] erofs: cap Zstandard stream pool size Message-ID: Mail-Followup-To: Zhan Xusheng , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale , Hongbo Li , Chunhai Guo , Nick Terrell , David Sterba , linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, Zhan Xusheng References: <20260728021831.1532541-1-zhanxusheng1024@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260728021831.1532541-1-zhanxusheng1024@gmail.com> Hi Xusheng, On Tue, Jul 28, 2026 at 10:18:31AM +0800, Zhan Xusheng wrote: > From: Zhan Xusheng > > fs/erofs/decompressor_zstd.c sizes the module-global Zstandard stream > pool from num_possible_cpus() when the zstd_streams module parameter is > unset, and z_erofs_load_zstd_config() then preallocates one workspace per > stream, grown to the largest dictionary of any mounted image (up to > Z_EROFS_ZSTD_MAX_DICT_SIZE, i.e. Z_EROFS_PCLUSTER_MAX_SIZE). On high-CPU > systems this can pin a large amount of vmalloc-backed decoder state until > the erofs module is unloaded, mirroring the LZMA case fixed in commit > c9b47e6b2311 ("erofs: cap LZMA stream pool size"). > > Bound the default stream count by a new > CONFIG_EROFS_FS_ZIP_ZSTD_DEFAULT_MAX_STREAMS option, default 16, while > preserving the per-image workspace sizing. An explicit zstd_streams > module parameter is still honoured as-is. > > Fixes: 7c35de4df105 ("erofs: Zstandard compression support") > Signed-off-by: Zhan Xusheng Thanks for the patch. Unlike LZMA, each Zstandard only takes 1MiB at most (although erofs-utils only generates 4MiB LZ77 dictionary at most for LZMA, but on-disk format allows 8MiB so just in case.) So I think for Zstandard, 1MiB each stream should fulfill to most platforms (and for embedded systems for example, the vendors should control the dictionary size when generating the image; but for servers, I think 1MiB at most for each server CPU is OK). Unless there is a particular need, I don't expect every decompressor need a strict customized Kconfig for this (of course, DEFLATE and LZ4 takes 32k/64k so it doesn't matter.) Thanks, Gao Xiang