linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* zswap: use PAGE_SIZE * 2 for compression dst buffer size when calling crypto compression API
@ 2018-09-17 23:10 Um, Taeil
  2018-09-18 14:15 ` Dan Streetman
  0 siblings, 1 reply; 10+ messages in thread
From: Um, Taeil @ 2018-09-17 23:10 UTC (permalink / raw)
  To: linux-mm; +Cc: sjenning, ddstreet

[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]

Currently, we allocate PAGE_SIZE * 2 for zswap_dstmem which is used as compression destination buffer.
However, we pass only half of the size (PAGE_SIZE) to crypto_comp_compress.
This might not be a problem for CPU based existing lzo, lz4 crypto compression driver implantation.
However, this could be a problem for some H/W acceleration compression drivers, which honor destination buffer size when it prepares H/W resources.
Actually, this patch is aligned with what zram is passing when it calls crypto_comp_compress.
The following simple patch will solve this problem. I tested it with existing crypto/lzo.c and crypto/lz4.c compression driver and it works fine.


--- mm/zswap.c.orig       2018-09-14 14:36:37.984199232 -0700
+++ mm/zswap.c             2018-09-14 14:36:53.340189681 -0700
@@ -1001,7 +1001,7 @@ static int zswap_frontswap_store(unsigne
                struct zswap_entry *entry, *dupentry;
                struct crypto_comp *tfm;
                int ret;
-              unsigned int hlen, dlen = PAGE_SIZE;
+             unsigned int hlen, dlen = PAGE_SIZE * 2;
                unsigned long handle, value;
                char *buf;
                u8 *src, *dst;



Thank you,
Taeil


[-- Attachment #2: Type: text/html, Size: 5521 bytes --]

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

end of thread, other threads:[~2018-09-27 10:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-17 23:10 zswap: use PAGE_SIZE * 2 for compression dst buffer size when calling crypto compression API Um, Taeil
2018-09-18 14:15 ` Dan Streetman
2018-09-18 18:52   ` Um, Taeil
2018-09-18 21:44     ` Dan Streetman
2018-09-18 23:48       ` Um, Taeil
2018-09-19 15:47         ` Dan Streetman
2018-09-21  1:01           ` Um, Taeil
2018-09-26  9:00             ` Dan Streetman
2018-09-26 16:10               ` Um, Taeil
2018-09-27 10:08                 ` Dan Streetman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox