mirror_zfs/module
Matthew Ahrens a724db0374
Channel program may spuriously fail with "memory limit exhausted"
ZFS channel programs (invoked by `zfs program`) are executed in a LUA
sandbox with a limit on the amount of memory they can consume.  The
limit is 10MB by default, and can be raised to 100MB with the `-m` flag.
If the memory limit is exceeded, the LUA program exits and the command
fails with a message like `Channel program execution failed: Memory
limit exhausted.`

The LUA sandbox allocates memory with `vmem_alloc(KM_NOSLEEP)`, which
will fail if the requested memory is not immediately available.  In this
case, the program fails with the same message, `Memory limit exhausted`.
However, in this case the specified memory limit has not been reached,
and the memory may only be temporarily unavailable.

This commit changes the LUA memory allocator `zcp_lua_alloc()` to use
`vmem_alloc(KM_SLEEP)`, so that we won't spuriously fail when memory is
temporarily low.  Instead, we rely on the system to be able to free up
memory (e.g. by evicting from the ARC), and we assume that even at the
highest memory limit of 100MB, the channel program will not truly
exhaust the system's memory.

External-issue: DLPX-71924
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Closes #11190
2020-11-11 17:16:15 -08:00
..
avl Links in Source Files 2020-09-02 09:42:12 -07:00
icp Introduce CPU_SEQID_UNSTABLE 2020-11-02 11:51:12 -08:00
lua Use known license string for zlua 2020-10-27 09:43:36 -07:00
nvpair Links in Source Files 2020-09-02 09:42:12 -07:00
os Linux: Fix mount/unmount when dataset name has a space 2020-11-11 17:14:24 -08:00
spl Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
unicode Throw const on some strings 2020-10-02 17:44:10 -07:00
zcommon Update references to nonexistent man pages in code 2020-10-30 08:55:59 -07:00
zfs Channel program may spuriously fail with "memory limit exhausted" 2020-11-11 17:16:15 -08:00
zstd Optimize locking checks in mempool allocator 2020-11-02 12:10:07 -08:00
.gitignore Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
Kbuild.in Add zstd support to zfs 2020-08-20 10:30:06 -07:00
Makefile.bsd Share zfs_fsync, zfs_read, zfs_write, et al between Linux and FreeBSD 2020-10-21 14:08:06 -07:00
Makefile.in Fix Linux modules uninstall 2020-10-08 20:07:10 -07:00