linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Um, Taeil" <taeilum@amazon.com>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: "sjenning@redhat.com" <sjenning@redhat.com>,
	"ddstreet@ieee.org" <ddstreet@ieee.org>
Subject: zswap: use PAGE_SIZE * 2 for compression dst buffer size when calling crypto compression API
Date: Mon, 17 Sep 2018 23:10:35 +0000	[thread overview]
Message-ID: <D4C91DBA-CF56-4991-BD7F-6BE334A2C048@amazon.com> (raw)

[-- 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 --]

             reply	other threads:[~2018-09-17 23:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17 23:10 Um, Taeil [this message]
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

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=D4C91DBA-CF56-4991-BD7F-6BE334A2C048@amazon.com \
    --to=taeilum@amazon.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