Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp335635lqo; Wed, 8 May 2024 00:48:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUL4HGICdYsoNzdk1eDaNH35S3Rj+Sw8GrbNe/hHxqd4pA3te9iuFbNYmXspdVM5PIb3uDLuNs/p5/BJlFdsPx95gzm+2sB04iz3Ej2Zg== X-Google-Smtp-Source: AGHT+IEZoCAaRsEqVdMh7snHsCJ7Up4dpAmWal/+l3IzVA7EYOXeRWcSByf7BRhFO3j7R00tMRKC X-Received: by 2002:ad4:4eac:0:b0:6a0:c707:1bed with SMTP id 6a1803df08f44-6a1514c0001mr18681806d6.42.1715154503476; Wed, 08 May 2024 00:48:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715154503; cv=pass; d=google.com; s=arc-20160816; b=0Hs1URdGsNHiS8wYGO2CGfawrZC/ZiP8CFlH+sMjgIMQV0i77L46LZkMINuusdsdjt OybNcdEgFUBwqsCsXfRobOlnpDIt+du9dAQOSspqi5RT9RmWlzOjFVcXhTmaU3sIxzPA NjjsUe1KgXGxvNBk5k/O2J4aCHF4WtQy5VkiDJKWWsH/MGwWFk6ZmwOWpEfRq35bbPD2 CL+sy8T6eYHGTvxlRW7AqFaTJpQPcf28kFqSPoE5QiunmKO0z/3hogZE5iW1rkPGhQAG 9LTaifrpK0yGekxxzTIQrT+4hHAp7VrtQPKzryE4G+NEWsCCHe45CxWkSsuP/VRswcVJ 1dgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ow2rUHFnrcYhlTotFbBj4Gwxyq4hSnuB9nn9e+mMxIY=; fh=UKstJvjqAQ3P/Vkvglih02Z8FmmRnlaJbql9clnU9dw=; b=0PmnIYO8ZYUCINJPbrTb016HkF0PRcg8KhrwH95LKCuTxQxGOg/MF5w4nUgARckWIE ScGerH4k9j5e74PBiCuv1xdpxuBtOGY80qG1h7fOa88T9JOlf2dhJiU9bWrDYCgKtw+d JWZjLaRtAw96QkZYGdVCPygUYX2gxzRh1Nz7v0FExPuXZZ71aNCkTDb/rAxr/fz8YaIo prstuzYR/D6qfJLmsYsCczqRyBYcQ5KpcobinNNr5rphIlAI5w5YRKZfv0fMJ9A9rmI3 +wE84LDi8DIUJOMIQewp4CfEM5aeYK+/y7KSzsUkvZ+iul+ay008yjmBUJU5nObgv3oh CNIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UGL7O0Si; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-172851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172851-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id iy6-20020a0562140f6600b0069b66fdd254si13699644qvb.309.2024.05.08.00.48.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 00:48:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UGL7O0Si; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-172851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172851-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 08AC21C2265A for ; Wed, 8 May 2024 07:48:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F337D71B24; Wed, 8 May 2024 07:43:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="UGL7O0Si" Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6CDE7F7CA for ; Wed, 8 May 2024 07:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715154207; cv=none; b=uzppPTLgi3oXvbvYr76pirS2JOHgbQudbZJ+QTxPfDzd2Pz13FLv5oVgXqpM8yPIq4JoB0HyKICVCPl7zgzizKP78mkeIoUyILR6c2CYUdqPNNKGb0guypHneYzTmIswKufkOEJq694vdZDfrxx3z1MnmK2b277+hvDe7Vf9BlE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715154207; c=relaxed/simple; bh=0QKD/VRLqE4UJhTMThwx4W0GPaxzgatlvvK+3EE9Gd0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BSfPD5NTAKyeCcKD8ubXUL+JudfjopAiunfn2QEmeaThn18o8l1zzGvVWGkQoJuzJ2tEUqLCpP+PD+zNB3PoaaT7vhtSGyqL4HtUE2rOymIYeVVs73+4yDew0PYe12evhu3HHd41gRT6a4hoa3K/UiZpC/CCEtFEJ99U2Eh6jfM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=UGL7O0Si; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-5e8470c1cb7so2695213a12.2 for ; Wed, 08 May 2024 00:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715154205; x=1715759005; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ow2rUHFnrcYhlTotFbBj4Gwxyq4hSnuB9nn9e+mMxIY=; b=UGL7O0SiV6EoBU3l0lP0gPA1waybDambjYpwsSAgQUqgoCrPnL+Ua8eE+bWKvouG31 jUfZDMHyVx1ImFpR4VjxdHwJ5Ix+Y2rebf/zuV8BTXY5pdk7JPvmq5SPjZ5CyaZXMjDO 5P76Sb+vvENpJ4XFgtgxGNZl9S5SDghCRGGKQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715154205; x=1715759005; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ow2rUHFnrcYhlTotFbBj4Gwxyq4hSnuB9nn9e+mMxIY=; b=NIRFTFVj4Ahf+UnxWymLDGDWvZB5YmPtcxA+hQiMjaMFYZuKwS1SwtT68fV4CbikiO rzRPlr2eXP7SvcWQx1edoEKrBvVEEkmwaZBsKw1hJOiZSfsBrgh+fLPQH8szhMTO0a4Q ys6JyaHyQZqMpZKwdkwzmK+lrpYZRZCLyVefV3ufss1iI8RhVf9FRsaF94gdb9nKYKBm H8VghfYG4NQeirMacCVhPxfb+7oeFvaAjaU97mdU7phwMDAMACfAI8EowOO44OQfWJaE W6viyAX3jqRakwqquH2y8nfS0/qODjWqn8Ong7TcPVRvDWmtXOChC++JGf/k9NraW8G3 WgTg== X-Gm-Message-State: AOJu0YxFPknjuPDkKJmQc1AzOHO+VBp9UCMQbX71Vx6+FK6bhWZCHT29 b9VBZIYNd+TkIX7CWm5HiCNRBsWuojQ4UUdiLMs28atnhPrtMd98jfeUvbR0+g== X-Received: by 2002:a17:90a:440f:b0:2ae:e1e0:3d8f with SMTP id 98e67ed59e1d1-2b6163a22cdmr1679910a91.2.1715154205219; Wed, 08 May 2024 00:43:25 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:ad4d:5f6c:6699:2da4]) by smtp.gmail.com with ESMTPSA id l5-20020a17090aec0500b002b328adaa40sm780011pjy.17.2024.05.08.00.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 00:43:24 -0700 (PDT) From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv3 19/19] Documentation/zram: add documentation for algorithm parameters Date: Wed, 8 May 2024 16:42:12 +0900 Message-ID: <20240508074223.652784-20-senozhatsky@chromium.org> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240508074223.652784-1-senozhatsky@chromium.org> References: <20240508074223.652784-1-senozhatsky@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Document brief description of compression algorithms' parameters: compression level and pre-trained dictionary. Signed-off-by: Sergey Senozhatsky --- Documentation/admin-guide/blockdev/zram.rst | 38 ++++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/Documentation/admin-guide/blockdev/zram.rst b/Documentation/admin-guide/blockdev/zram.rst index 091e8bb38887..58d79f9099e3 100644 --- a/Documentation/admin-guide/blockdev/zram.rst +++ b/Documentation/admin-guide/blockdev/zram.rst @@ -102,15 +102,26 @@ Examples:: #select lzo compression algorithm echo lzo > /sys/block/zram0/comp_algorithm -For the time being, the `comp_algorithm` content does not necessarily -show every compression algorithm supported by the kernel. We keep this -list primarily to simplify device configuration and one can configure -a new device with a compression algorithm that is not listed in -`comp_algorithm`. The thing is that, internally, ZRAM uses Crypto API -and, if some of the algorithms were built as modules, it's impossible -to list all of them using, for instance, /proc/crypto or any other -method. This, however, has an advantage of permitting the usage of -custom crypto compression modules (implementing S/W or H/W compression). +For the time being, the `comp_algorithm` content shows only compression +algorithms that are supported by zram. + +It is also possible to pass algorithm specific configuration parameters:: + + #set compression level to 8 + echo "zstd level=8" > /sys/block/zram0/comp_algorithm + +Note that `comp_algorithm` also supports `algo=name` format:: + + #set compression level to 8 + echo "algo=zstd level=8" > /sys/block/zram0/comp_algorithm + +Certain compression algorithms support pre-trained dictionaries, which +significantly change algorithms' characteristics. In order to configure +compression algorithm to use external pre-trained dictionary, pass full +path to the dictionary along with other parameters:: + + #pass path to pre-trained dictionary + echo "algo=zstd dict=/etc/dictioary" > /sys/block/zram0/comp_algorithm 4) Set Disksize =============== @@ -442,6 +453,15 @@ configuration::: #select deflate recompression algorithm, priority 2 echo "algo=deflate priority=2" > /sys/block/zramX/recomp_algorithm +The `recomp_algorithm` also supports algorithm configuration parameters, e.g. +compression level and pre-trained dircionary:: + + #pass compression level + echo "algo=zstd level=8" > /sys/block/zramX/recomp_algorithm + + #pass path to pre-trained dictionary + echo "algo=zstd dict=/etc/dictioary" > /sys/block/zramX/recomp_algorithm + Another device attribute that CONFIG_ZRAM_MULTI_COMP enables is recompress, which controls recompression. -- 2.45.0.rc1.225.g2a3ae87e7f-goog