Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3140916lqo; Wed, 15 May 2024 00:23:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVe10ZEGv6NZjywQ6xNCC8qdzbq0XYnjWPS7b54WQiNGp2NQHs3N8ltCwMmHnP6zxhXH948umZLU2E0olot/Le8cKIvFSri6k/0RFJUVw== X-Google-Smtp-Source: AGHT+IFJx7uAvNVOaLYo9guDyWchyrX3K0eU6lXUUR4iYvLJx3BWnOSQ0z6sNb5jqGbzba7RjOU1 X-Received: by 2002:a05:620a:1902:b0:790:f03a:243f with SMTP id af79cd13be357-792c75aceb1mr1902790685a.46.1715757785476; Wed, 15 May 2024 00:23:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715757785; cv=pass; d=google.com; s=arc-20160816; b=lJvQETvf3zyMIY92jmzq7oyOvBq/83InYDNcvCtQtXqKv+7YMjzTyLQ13jEUo44v4U VSHj1eBwiFSnaO6WllJB7CuItBzAC689BWv9uIy2SY1is+oBZ5BiYqSkBtkSkrXfp15m xigGSlV12XU3dPjq8TbIaMrxzI8XnWScm7fx4k3cN2mFeJ9UGk6nzWK7x2X9oHFil6jn x4QCXNKQnSXpqIYVudi7CA5xLuEtNnQgL8EuvDyuGkVI6SAL0mNXYW4oM7Md8gWO2g0/ KDTMTR9GxU7fRdXmmNiaU5DYp2bAa+YGSNfEXtXyAR0GhaQfhLPrX2po/leB3oph/3p+ jqqA== 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=QGICHI/0dlYhGvwrelcmQNFXV9PnrvcNeex2dnYz6FvsypofkP0cyTBeIa1toqv/F5 LQdowCODhSQ1cdyIIiwHgjr17iPHRtcVW7MtUP+geDOkNTOIBo2J5u20Odzl7JIG4QDl LDerAVcbEDBFxpOmPKdLndTbWz7PdzA3K7gfA299wliVlCibnTgrUKxa6nZCS0NmDodo nkh2HJ6Hgah5ftsT0ktNtTNGyAAJRtr4QeF8HNMaxAs3cHSuVk6tCpDxerwKCkNH+HMy tBMKxegRlVctbXgjZoDFOqKO+/RsDOcDTqP3lzHcdFY3vYdVo2ucHZV7vLGjiBWYWeob mc4A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YHQzgsw2; 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-179573-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179573-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 af79cd13be357-792bf36653dsi1293592585a.641.2024.05.15.00.23.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:23:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179573-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=YHQzgsw2; 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-179573-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179573-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 385CF1C2177A for ; Wed, 15 May 2024 07:23:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DEF1E78C67; Wed, 15 May 2024 07:17:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="YHQzgsw2" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 9E34F4C631 for ; Wed, 15 May 2024 07:17:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715757469; cv=none; b=kqvTr073vN6SEEO5bejkxo2nzYXdsew+sGczcQCNVy2TKYr2IFZNgcdPC3zDlQWR5f2Vd73jEb4CWL6/qSfg5YQdK6kGUtxU7KAzuRFqy2BakybKqSZd1kXiu/0SSRTKcSworXIibmRx0C93xj5y7bpYEBlJ6r1EY0p2WQHVlSM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715757469; c=relaxed/simple; bh=0QKD/VRLqE4UJhTMThwx4W0GPaxzgatlvvK+3EE9Gd0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ictz6hF1GcdpUj9PRkuzQX6jmRtVoFxCkqHAqI7beLai8ojoEvnWrh3uqAfgvRTc9unZ8FdWu/rp2fagtY3VRuFrfNO+uykk5q+6N0PHn0cIGsgTKc2r7rHe36SZGWCQzvpr1ElfDfOVJa/XEsHguYHIpQ3BmamfbQ0s1UyEsas= 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=YHQzgsw2; arc=none smtp.client-ip=209.85.214.169 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-pl1-f169.google.com with SMTP id d9443c01a7336-1f05b669b6cso36652445ad.3 for ; Wed, 15 May 2024 00:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715757467; x=1716362267; 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=YHQzgsw2miaw+A94pdrS9zbw6+Yen4uDKAHCSsd+5Pv/WyQAA41PeR3hs1rChZ6Yc9 CPSflOIuyfyGCdPWV0kx5WKzNQ/E8BsOREcSthOX/Vb58PcCkQ7RNy/on1u5NRyRWuxV 10TMPfYFcNtQe4w9M+ZBzIRuCTEv6/IFvkLd8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715757467; x=1716362267; 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=LcGpkSi1fgpdMZzjx1GCunGr9GuZvEf0KPWu45tdKq6w0nJDP+GspK2elR6Hq9e3Bi V7eEv/aNFVf8moQg9u2uwP2twKEbgrF8qHU1Uh3hfv6D/6w4YUYhmCm5uam5cFN3ZV3n cIRaIIgJ2qZ0Do1+nXubils2mMEPEPztNjKybkPpcyGbEBQdsOVB+4CaveI2HzI9zuSI yQY11/d+pN+Hi3SVRYIL7Rpn2xiqrbXqQ8KYMkodLhP8NQSgoDQ8DFFDtLEDrdmxJzGQ Ke9KlVr/wzw/YYFBqz6v6Gaeqq/IUOp9s8+Zk0tTAIbPUT7eETax5Z3kXf1Tv2GACU4l iiiw== X-Gm-Message-State: AOJu0Yy9Gii8ux7khGQWJSOrUgyUwDrhh/2PRPEsRZNh7EBQZLrF9T5E nlSlwgBjuxiF2rjdpC9mpavC4CrsN5Nl0NtUlCaaKIdpWA2JZp3s3tfGqQA66HkcRizijtyl6QI = X-Received: by 2002:a17:903:984:b0:1eb:7746:4248 with SMTP id d9443c01a7336-1ef440495abmr176201825ad.54.1715757466991; Wed, 15 May 2024 00:17:46 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:111d:a618:3172:cd5b]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c136d53sm110941605ad.254.2024.05.15.00.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:17:46 -0700 (PDT) From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv4 21/21] Documentation/zram: add documentation for algorithm parameters Date: Wed, 15 May 2024 16:12:58 +0900 Message-ID: <20240515071645.1788128-22-senozhatsky@chromium.org> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240515071645.1788128-1-senozhatsky@chromium.org> References: <20240515071645.1788128-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