This patch set reduces stack usage for zstd code, because target like ARM has
limited 8KB kernel stack, which is getting overflowed due to hight stack usage
of zstd code with call flow like:

....
....
(FSE_compress_usingCTable) from (HUF_compressWeights_wksp+0x140/0x200)
(HUF_compressWeights_wksp) from (HUF_writeCTable_wksp+0xdc/0x1c8)
(HUF_writeCTable_wksp) from (HUF_compress4X_repeat+0x214/0x450)
(HUF_compress4X_repeat) from  (ZSTD_compressBlock_internal+0x228/0x135c)
(ZSTD_compressBlock_internal) from  (ZSTD_compressContinue_internal+0x1f8/0x3c8)
(ZSTD_compressContinue_internal) from  (ZSTD_compressCCtx+0xc0/0x1cc)
(ZSTD_compressCCtx) from  (zstd_compress+0x90/0xa8)
(zstd_compress) from  (crypto_compress+0x2c/0x34) 
(crypto_compress) from  (zcomp_compress+0x3c/0x44)
(zcomp_compress) from  (zram_bvec_rw+0x2f8/0xa7c)
(zram_bvec_rw) from [<c03e1e58>] (zram_rw_page+0x104/0x170)
(zram_rw_page) from [<c01d3f94>] (bdev_write_page+0x80/0xb4)
(bdev_write_page) from [<c017dc9c>] (__swap_writepage+0x160/0x29c)
(__swap_writepage) from [<c017de14>] (swap_writepage+0x3c/0x58)
(swap_writepage) from [<c014f88c>] (shrink_page_list+0x788/0xae0)
(shrink_page_list) from [<c01502e0>] (shrink_inactive_list+0x210/0x4a8)
(shrink_inactive_list) from [<c0150dd4>] (shrink_zone+0x53c/0x7c0)
(shrink_zone) from [<c0151354>] (try_to_free_pages+0x2fc/0x7cc)
(try_to_free_pages) from [<c0144c60>] (__alloc_pages_nodemask+0x534/0x91c)
(__alloc_pages_nodemask) from [<c01393ac>] (pagecache_get_page+0xe0/0x1d8)
....
....

Maninder Singh, Vaneet Narang (4):
  zstd: pass pointer rathen than structure to functions
  zstd: use U16 data type for rankPos
  zstd: move params structure to global variable to reduce stack
    usage
  zstd: change structure variable from int to char

 crypto/zstd.c           | 11 ++++---
 include/linux/zstd.h    | 16 +++++-----
 lib/zstd/compress.c     | 85 +++++++++++++++++++++++++------------------------
 lib/zstd/decompress.c   |  2 +-
 lib/zstd/huf_compress.c |  4 +--
 5 files changed, 62 insertions(+), 56 deletions(-)

-- 
2.7.4

Reply via email to