zswap: use PAGE_SIZE * 2 for compression dst buffer size when calling crypto compression API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

 


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux