linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/9] zram: introduce crypto decompress noctx API and use it on zram
@ 2015-09-18  5:19 Joonsoo Kim
  2015-09-18  5:19 ` [PATCH v3 1/9] crypto: introduce decompression API that can be called via sharable tfm object Joonsoo Kim
                   ` (10 more replies)
  0 siblings, 11 replies; 45+ messages in thread
From: Joonsoo Kim @ 2015-09-18  5:19 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Minchan Kim, Nitin Gupta, Sergey Senozhatsky, linux-kernel,
	linux-crypto, Herbert Xu, David S. Miller, Stephan Mueller,
	Joonsoo Kim

This patchset makes zram to use crypto API in order to support
more compression algorithm.

The reason we need to support vairous compression algorithms is that
zram's performance is highly depend on workload and compression algorithm
and architecture. Every compression algorithm has it's own strong point.
For example, zlib is the best for compression ratio, but, it's
(de)compression speed is rather slow. Against my expectation, in my kernel
build test with zram swap, in low-memory condition on x86, zlib shows best
performance than others. In this case, I guess that compression ratio is
the most important factor. Unlike this situation, on ARM, maybe fast
(de)compression speed is the most important because it's computation speed
is slower than x86.

Anyway, there is a concern from Sergey to use crypto API in zram. Current
crypto API has a limitation that always require tfm object to (de)compress
something because some of (de)compression function requires scratch buffer
embedded on tfm even if some of (de)compression function doesn't
require it. Due to above reason, using crypto API rather than calling
compression library directly causes more memory footprint and this is
why zram doesn't use crypto API before.

In this patchset, crypto compress noctx API is introduced to reduce memory
footprint caused by maintaining multiple tfm and zram uses it. Before
noctx API, zram's performace is down-graded if tfm is insufficient. But,
after applying noctx API, performace is restored.

This addresses Sergey's concern perfectly and provides possibility to use
various compression algorithm in zram.

Following is zram's read performance number.

* iozone -t 4 -R -r 16K -s 60M -I +Z -i 0 -i 1
* max_stream is set to 1
* Output is in Kbytes/sec

zram-base vs zram-crypto vs zram-crypto-noctx

Read		10411701.88	6426911.62	9423894.38 
Re-read		10017386.62	6428218.88	11000063.50 

Thanks.

Joonsoo Kim (7):
  crypto: introduce decompression API that can be called via sharable
    tfm object
  crypto/lzo: support decompress_noctx
  crypyo/lz4: support decompress_noctx
  crypto/lz4hc: support decompress_noctx
  crypto/842: support decompress_noctx
  zram: use crypto API for compression
  zram: use crypto decompress_noctx API

Sergey Senozhatsky (2):
  zram: make stream find and release functions static
  zram: pass zstrm down to decompression path

 crypto/842.c                   |   9 +++-
 crypto/compress.c              |  36 +++++++++++++++
 crypto/crypto_null.c           |   3 +-
 crypto/deflate.c               |   3 +-
 crypto/lz4.c                   |   9 +++-
 crypto/lz4hc.c                 |   9 +++-
 crypto/lzo.c                   |   9 +++-
 drivers/block/zram/Kconfig     |   8 ++--
 drivers/block/zram/Makefile    |   4 +-
 drivers/block/zram/zcomp.c     | 102 +++++++++++++++++++++++++++++++----------
 drivers/block/zram/zcomp.h     |  42 +++++++----------
 drivers/block/zram/zcomp_lz4.c |  47 -------------------
 drivers/block/zram/zcomp_lz4.h |  17 -------
 drivers/block/zram/zcomp_lzo.c |  47 -------------------
 drivers/block/zram/zcomp_lzo.h |  17 -------
 drivers/block/zram/zram_drv.c  |  32 +++++++++----
 include/linux/crypto.h         |  20 ++++++++
 17 files changed, 211 insertions(+), 203 deletions(-)
 delete mode 100644 drivers/block/zram/zcomp_lz4.c
 delete mode 100644 drivers/block/zram/zcomp_lz4.h
 delete mode 100644 drivers/block/zram/zcomp_lzo.c
 delete mode 100644 drivers/block/zram/zcomp_lzo.h

-- 
1.9.1


^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2015-09-25  7:58 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-18  5:19 [PATCH v3 0/9] zram: introduce crypto decompress noctx API and use it on zram Joonsoo Kim
2015-09-18  5:19 ` [PATCH v3 1/9] crypto: introduce decompression API that can be called via sharable tfm object Joonsoo Kim
2015-09-21  5:38   ` Sergey Senozhatsky
2015-09-25  5:29     ` Joonsoo Kim
2015-09-21  6:18   ` Sergey Senozhatsky
2015-09-25  5:26     ` Joonsoo Kim
2015-09-25  7:56       ` Sergey Senozhatsky
2015-09-25  7:58         ` Herbert Xu
2015-09-22 12:43   ` Herbert Xu
2015-09-25  5:25     ` Joonsoo Kim
2015-09-18  5:19 ` [PATCH v3 2/9] crypto/lzo: support decompress_noctx Joonsoo Kim
2015-09-18  5:19 ` [PATCH v3 3/9] crypyo/lz4: " Joonsoo Kim
2015-09-18  5:19 ` [PATCH v3 4/9] crypto/lz4hc: " Joonsoo Kim
2015-09-18  5:19 ` [PATCH v3 5/9] crypto/842: " Joonsoo Kim
2015-09-18  5:19 ` [PATCH v3 6/9] zram: make stream find and release functions static Joonsoo Kim
2015-09-20 23:39   ` Minchan Kim
2015-09-18  5:19 ` [PATCH v3 7/9] zram: pass zstrm down to decompression path Joonsoo Kim
2015-09-20 23:42   ` Minchan Kim
2015-09-18  5:19 ` [PATCH v3 8/9] zram: use crypto API for compression Joonsoo Kim
2015-09-21  3:45   ` Minchan Kim
2015-09-25  5:44     ` Joonsoo Kim
2015-09-21  5:19   ` Sergey Senozhatsky
2015-09-25  5:43     ` Joonsoo Kim
2015-09-25  7:50       ` Sergey Senozhatsky
2015-09-18  5:19 ` [PATCH v3 9/9] zram: use crypto decompress_noctx API Joonsoo Kim
2015-09-21  3:51   ` Minchan Kim
2015-09-25  5:46     ` Joonsoo Kim
2015-09-25  7:51       ` Sergey Senozhatsky
2015-09-21  5:29   ` Sergey Senozhatsky
2015-09-25  5:48     ` Joonsoo Kim
2015-09-21  7:56   ` Sergey Senozhatsky
2015-09-25  5:47     ` Joonsoo Kim
2015-09-21  3:58 ` [PATCH v3 0/9] zram: introduce crypto decompress noctx API and use it on zram Minchan Kim
2015-09-25  5:31   ` Joonsoo Kim
2015-09-21 13:13 ` [RFC][PATCH 0/9] use CRYPTO_ALG_TFM_MAY_SHARE cra flag (full patchset) Sergey Senozhatsky
2015-09-21 13:13   ` [RFC][PATCH 1/9] crypto: introduce CRYPTO_ALG_TFM_MAY_SHARE flag Sergey Senozhatsky
2015-09-21 13:13   ` [RFC][PATCH 2/9] crypto/lzo: set CRYPTO_ALG_TFM_MAY_SHARE Sergey Senozhatsky
2015-09-21 13:13   ` [RFC][PATCH 3/9] crypto/lz4: " Sergey Senozhatsky
2015-09-21 13:13   ` [RFC][PATCH 4/9] crypto/lz4hc: " Sergey Senozhatsky
2015-09-21 13:13   ` [RFC][PATCH 5/9] crypto/842: " Sergey Senozhatsky
2015-09-21 13:13   ` [RFC][PATCH 6/9] zram: make stream find and release functions static Sergey Senozhatsky
2015-09-21 13:13   ` [RFC][PATCH 7/9] zram: pass zstrm down to decompression path Sergey Senozhatsky
2015-09-21 13:17   ` [RFC][PATCH 0/9] use CRYPTO_ALG_TFM_MAY_SHARE cra flag (full patchset) Sergey Senozhatsky
2015-09-21 13:25   ` [RFC][PATCH 9/9] zram: use crypto CRYPTO_ALG_TFM_MAY_SHARE API Sergey Senozhatsky
2015-09-21 13:40   ` [RFC][PATCH 8/9] zram: use crypto API for compression Sergey Senozhatsky

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).