# HG changeset patch # User Sašo Kiselkov # Date 1366821943 28800 # Node ID 3843f7c5f635dd5237545b8436d04ef69b8bbdab # Parent 624fa8f61951b5f4160f55b9cdaf5f37f82f59c4 3705 stack overflow due to zfs lz4 compression Reviewed by: Matthew Ahrens Approved by: Christopher Siden diff -r 624fa8f61951 -r 3843f7c5f635 usr/src/uts/common/fs/zfs/lz4.c --- a/usr/src/uts/common/fs/zfs/lz4.c Tue Apr 23 09:31:42 2013 -0800 +++ b/usr/src/uts/common/fs/zfs/lz4.c Wed Apr 24 08:45:43 2013 -0800 @@ -197,20 +197,17 @@ defined(__amd64) || defined(__ppc64__) || defined(_WIN64) || \ defined(__LP64__) || defined(_LP64)) #define LZ4_ARCH64 1 -/* - * Illumos: On amd64 we have 20k of stack and 24k on sun4u and sun4v, so we - * can spend 16k on the algorithm - */ -#define STACKLIMIT 12 #else #define LZ4_ARCH64 0 +#endif + /* - * Illumos: On i386 we only have 12k of stack, so in order to maintain the - * same COMPRESSIONLEVEL we have to use heap allocation. Performance will - * suck, but alas, it's ZFS on 32-bit we're talking about, so... + * Limits the amount of stack space that the algorithm may consume to hold + * the compression lookup table. The value `9' here means we'll never use + * more than 2k of stack (see above for a description of COMPRESSIONLEVEL). + * If more memory is needed, it is allocated from the heap. */ -#define STACKLIMIT 11 -#endif +#define STACKLIMIT 9 /* * Little Endian or Big Endian? @@ -240,11 +237,7 @@ #define LZ4_FORCE_UNALIGNED_ACCESS 1 #endif -/* - * Illumos: we can't use GCC's __builtin_ctz family of builtins in the - * kernel - */ -#define LZ4_FORCE_SW_BITCOUNT +/* #define LZ4_FORCE_SW_BITCOUNT */ /* * Compiler Options