Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1239291lqh; Mon, 6 May 2024 01:03:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWV+jPYuXwJtCnAjf1sixe42NUCYr7eIkAu+BPAncoMc2EW2nJGQvjoVxDzHpmT1O0J4Wt/DPFi8TZY0/i7WaDA1vJo05nW0t+C5NydFg== X-Google-Smtp-Source: AGHT+IHFK0o6k6LxV0WpJO4iCosmo3YBWWWE1QPbGDdyVwKt6kwG9ywPUsLSGM09+85dxztdqjfc X-Received: by 2002:a50:9b57:0:b0:56e:238e:372c with SMTP id a23-20020a509b57000000b0056e238e372cmr5907420edj.26.1714982592525; Mon, 06 May 2024 01:03:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714982592; cv=pass; d=google.com; s=arc-20160816; b=CXAIF2jXmgRj9j9FV8K6yI+oV7BCLR4KNlwrNuRIJOp9+pj7QBcy1vyyj9z7yNXhyq oGYg+3zR01DIfvH1qr+IksdULXlAbjqiQOgBK26+1iOPm1PILsKZnHGreq2ooKyG1486 iRk/VD02iucI/2mfSHZKZKijkuPLgOeypCYRRv6I65vSNWNdpvTb3MjxtbZI7bN72Bx7 AFVHuR05qNMY/sBGyL2m3mrAUwcudsu4nZgMYQZqonmEuXI1Px/fOQT1dhFVcTaIzRia 7f0vXnldKwlE5srLEJYSSSTyMZjOLRLGudLo2FzFpnPK9oosFyYc3pOTJ8bQKfshxX3H Fu/Q== 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=O5y2cbjB6+FfWOH9WtivfQWmrfdIq8TCDh8QqjiDZxop6DZZh35LjAYNSNfzTfG1jc kTEcOYTvio0cYbpn022iHcwnfyMH5iw9THtAN68f6mcKxtzOkhGHxClfrgUpOf8Vdxq/ 3VSZPjdHJpfBW2j7rzqfqrpj7lNoSTbKiXENZ0D9L/6hiwhIzQBZ0Jwtl/0DUDSUQYPu MlFxZUnEA8LVk7i/adsSzqcN9FqFhoay9lEkM2igTqHybn0WiIrQEud5A/s6T91tkyxk kTj1pKYbc14+dWa9tx/FEtbnAZkB7JGLTKKtY/+i1l2DSmlDthfeYEjuLSE3tmfIjrxK 32Dg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HNK33Wdi; 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-169460-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169460-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q22-20020aa7da96000000b005726a3aaf82si4863193eds.73.2024.05.06.01.03.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 01:03:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169460-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HNK33Wdi; 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-169460-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169460-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 208EB1F225C2 for ; Mon, 6 May 2024 08:03:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCF8B144D27; Mon, 6 May 2024 07:59:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HNK33Wdi" Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.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 913231448FB for ; Mon, 6 May 2024 07:59:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714982367; cv=none; b=A+bkwhfOKx4FaX2tfQlwhfau9u9Hu1io8FCkbrBO/0nCdBaWm3S8k71BaM/EuTGZdV13h+nP/25viN8PTM9ikKrwwP2COcPLgxtD0UniA3jTTR5Bi00qIOi8rohYlQbqpxGSf815f40qpHe61P7LbkWuceHClgZeP2pynaF0CNI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714982367; c=relaxed/simple; bh=0QKD/VRLqE4UJhTMThwx4W0GPaxzgatlvvK+3EE9Gd0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PzVoeSy/W6fsfQOKHGkDapZmGnAkJ9cOTVv+7MeyCW6gRjUFEllqszc+WjboaLHLmMoHuLSmit1r+ezYRfXbJQMPl3A1qTBVj4FZta5VIJgjFXndF/7CR0GMWJm4NkrFDfU91rFAAAIGsh6pvZcOsBa2J3RX3G9378B4Yk2zw30= 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=HNK33Wdi; arc=none smtp.client-ip=209.85.214.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-pl1-f173.google.com with SMTP id d9443c01a7336-1edf506b216so3883995ad.2 for ; Mon, 06 May 2024 00:59:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714982366; x=1715587166; 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=HNK33WdiJNKGrbAzcZCJfzRSc2z/Ri2zshCOD6DA24APChdR3JA0J5CAzCO7q1SU87 PUfREEHBg1dSMqwo1vbGueiEI+jU798eebatD2M/LbL2cTIp/61JNGN0+ycnumaFZHfX mQ1cPkJlCyCjPahkp/6LsvqX+18eBNHB3+oxk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714982366; x=1715587166; 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=iRgOcTBTzbMLLzUOSNlb2csuY7MhhQvuTl5LYgqtU5fpf8XJlOemiyFyf7h403PtI+ u/P+IE01H1h95/o/tQ+vWYlxM5qLzGOTt1OT0eg67kvcpsNURVL05315cVPwnLdEEs4g 02ds3HG6sxbRd/PDzWdPFwVNrHxmQNZPr0qTsm7qxS8XVftoWHDs+7WC+kltUlvFbK8Z 4sUbXetskqBzvPioPDVfefHKWH+XUANZYXTgpi8SL8cy9s8mon/wxW4m1zWMtZ26Ewb/ SkfCnflX+A4/bU7fTTcL0rdYAwt0PUiHDPw3eI2IH2AEehrQompnbeFfJGJLxAaOdX6I ODKA== X-Gm-Message-State: AOJu0Yzf1nt3+POH0ariQ5z1blSwoWPN4LpMOPcEXye63QlBC80fb2cn CiB94S73XlRhSw7Q1WU2xqQkbK5jrm7JDimL5yG9mj/Gjoph0/0tInAQlXjiUg== X-Received: by 2002:a17:902:e749:b0:1e3:cf2b:7151 with SMTP id p9-20020a170902e74900b001e3cf2b7151mr12883681plf.59.1714982365968; Mon, 06 May 2024 00:59:25 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:4e24:10c3:4b65:e126]) by smtp.gmail.com with ESMTPSA id h6-20020a170902f54600b001ec64b128dasm7633772plf.129.2024.05.06.00.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 00:59:25 -0700 (PDT) From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv2 17/17] Documentation/zram: add documentation for algorithm parameters Date: Mon, 6 May 2024 16:58:30 +0900 Message-ID: <20240506075834.302472-18-senozhatsky@chromium.org> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog In-Reply-To: <20240506075834.302472-1-senozhatsky@chromium.org> References: <20240506075834.302472-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