forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zstd: pass pointer rather than structure to functions
Patch series "zstd: reduce stack usage". This patchset reduces stack usage for zstd code, because target like ARM has limited 8KB kernel stack, which is getting overflowed due to high 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) This patchset tries to reduce around 300 bytes of stack usage of zstd compression path. We faced high stack usage issue on switching compression algo from LZO/LZ4 to zstd algo. zstd compression uses around 1200 bytes of stack which is huge as compared to LZO/LZ4 which uses negligible stack (< 200 bytes). This patch (of 4): Currently params structure is passed in all functions, which increases stack usage in all the function and lead to stack overflow on target like ARM with kernel stack size of 8 KB so better to pass pointer. Checked for ARM: Original Patched Call FLow Size: 1264 1040 .... (HUF_sort) -> 296 (HUF_buildCTable_wksp) -> 144 (HUF_compress4X_repeat) -> 88 (ZSTD_compressBlock_internal) -> 200 (ZSTD_compressContinue_internal)-> 136 -> 88 (ZSTD_compressCCtx) -> 192 -> 64 (zstd_compress) -> 144 -> 96 (crypto_compress) -> 32 (zcomp_compress) -> 32 .... Link: http://lkml.kernel.org/r/1559552526-4317-2-git-send-email-maninder1.s@samsung.com Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Vaneet Narang <v.narang@samsung.com> Signed-off-by: Joe Perches <joe@perches.com> Cc: Amit Sahrawat <a.sahrawat@samsung.com> Cc: David S. Miller <davem@davemloft.net> Cc: Gustavo A. R. Silva <gustavo@embeddedor.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Kees Cook <keescook@chromium.org> Cc: <pankaj.m@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
- Loading branch information
1 parent
8aac7f5
commit d85ceec
Showing
3 changed files
with
50 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters