linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Streetman <ddstreet@ieee.org>
To: taeilum@amazon.com
Cc: Linux-MM <linux-mm@kvack.org>, Seth Jennings <sjenning@redhat.com>
Subject: Re: zswap: use PAGE_SIZE * 2 for compression dst buffer size when calling crypto compression API
Date: Tue, 18 Sep 2018 10:15:20 -0400	[thread overview]
Message-ID: <CALZtONDpUDAz_PLrt03CaajzAoY_Wr6Tm=PgvqAWyir9=fCd8A@mail.gmail.com> (raw)
In-Reply-To: <D4C91DBA-CF56-4991-BD7F-6BE334A2C048@amazon.com>

On Mon, Sep 17, 2018 at 7:10 PM Um, Taeil <taeilum@amazon.com> wrote:
>
> 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.

How exactly could it be a problem?

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

  reply	other threads:[~2018-09-18 14:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17 23:10 Um, Taeil
2018-09-18 14:15 ` Dan Streetman [this message]
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='CALZtONDpUDAz_PLrt03CaajzAoY_Wr6Tm=PgvqAWyir9=fCd8A@mail.gmail.com' \
    --to=ddstreet@ieee.org \
    --cc=linux-mm@kvack.org \
    --cc=sjenning@redhat.com \
    --cc=taeilum@amazon.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