From: Will Ziener-Dignazio <wdignazio@gmail.com>
To: sjenning@redhat.com
Cc: ddstreet@ieee.org, linux-mm@kvack.org,
Will Ziener-Dignazio <wdignazio@gmail.com>
Subject: [PATCH] Add option to configure default zswap compressor algorithm.
Date: Sat, 30 Jun 2018 23:56:16 -0700 [thread overview]
Message-ID: <20180701065616.3512-1-wdignazio@gmail.com> (raw)
- Add Kconfig option for default compressor algorithm
- Add the deflate and LZ4 algorithms as default options
Signed-off-by: Will Ziener-Dignazio <wdignazio@gmail.com>
---
mm/Kconfig | 35 ++++++++++++++++++++++++++++++++++-
mm/zswap.c | 11 ++++++++++-
2 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/mm/Kconfig b/mm/Kconfig
index ce95491abd6a..09df6650e96a 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -535,7 +535,6 @@ config MEM_SOFT_DIRTY
config ZSWAP
bool "Compressed cache for swap pages (EXPERIMENTAL)"
depends on FRONTSWAP && CRYPTO=y
- select CRYPTO_LZO
select ZPOOL
default n
help
@@ -552,6 +551,40 @@ config ZSWAP
they have not be fully explored on the large set of potential
configurations and workloads that exist.
+choice
+ prompt "Compressed cache cryptographic compression algorithm"
+ default ZSWAP_COMPRESSOR_DEFAULT_LZO
+ depends on ZSWAP
+ help
+ The default cyptrographic compression algorithm to use for
+ compressed swap pages.
+
+config ZSWAP_COMPRESSOR_DEFAULT_LZO
+ bool "lzo"
+ select CRYPTO_LZO
+ help
+ This option sets the default zswap compression algorithm to LZO,
+ the Lempel-Ziv-Oberhumer algorithm. This algorthm focuses on
+ decompression speed, but has a lower compression ratio.
+
+config ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
+ bool "deflate"
+ select CRYPTO_DEFLATE
+ help
+ This option sets the default zswap compression algorithm to DEFLATE.
+ This algorithm balances compression and decompression speed to
+ compresstion ratio.
+
+config ZSWAP_COMPRESSOR_DEFAULT_LZ4
+ bool "lz4"
+ select CRYPTO_LZ4
+ help
+ This option sets the default zswap compression algorithm to LZ4.
+ This algorithm focuses on high compression speed, but has a lower
+ compression ratio and decompression speed.
+
+endchoice
+
config ZPOOL
tristate "Common API for compressed memory storage"
default n
diff --git a/mm/zswap.c b/mm/zswap.c
index 7d34e69507e3..30f9f25da4d0 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -91,7 +91,16 @@ static struct kernel_param_ops zswap_enabled_param_ops = {
module_param_cb(enabled, &zswap_enabled_param_ops, &zswap_enabled, 0644);
/* Crypto compressor to use */
-#define ZSWAP_COMPRESSOR_DEFAULT "lzo"
+#if defined(CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZO)
+ #define ZSWAP_COMPRESSOR_DEFAULT "lzo"
+#elif defined(CONFIG_ZSWAP_COMPRESSOR_DEFAULT_DEFLATE)
+ #define ZSWAP_COMPRESSOR_DEFAULT "deflate"
+#elif defined(CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4)
+ #define ZSWAP_COMPRESSOR_DEFAULT "lz4"
+#else
+ #error "Default zswap compression algorithm not defined."
+#endif
+
static char *zswap_compressor = ZSWAP_COMPRESSOR_DEFAULT;
static int zswap_compressor_param_set(const char *,
const struct kernel_param *);
--
2.18.0
next reply other threads:[~2018-07-01 6:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-01 6:56 Will Ziener-Dignazio [this message]
2018-07-15 4:21 ` [PATCH] Add option to configure default zswap compressor algorithm Will Dignazio
2018-07-19 22:00 ` Dan Streetman
2018-07-21 5:10 ` William Ziener-Dignazio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180701065616.3512-1-wdignazio@gmail.com \
--to=wdignazio@gmail.com \
--cc=ddstreet@ieee.org \
--cc=linux-mm@kvack.org \
--cc=sjenning@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).