mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 03:19:35 +03:00
10129680f8
The Solaris semantics for kmem_alloc() and vmem_alloc() are that they must never fail when called with KM_SLEEP. They may only fail if called with KM_NOSLEEP otherwise they must block until memory is available. This is quite different from how the Linux memory allocators work, under Linux a memory allocation failure is always possible and must be dealt with. At one point in the past the kmem code did properly implement this behavior, however as the code evolved this behavior was overlooked in places. This patch goes through all three implementations of the kmem/vmem allocation functions and ensures that they will all block in the KM_SLEEP case when memory is not available. They may still fail in the KM_NOSLEEP case in which case the caller is responsible for handling the failure. Special care is taken in vmalloc_nofail() to avoid thrashing the system on the virtual address space spin lock. The down side of course is if you do see a failure here, which is unlikely for 64-bit systems, your allocation will delay for an entire second. Still this is preferable to locking up your system and it is the best we can do given the constraints. Additionally, the code was cleaned up to be much more readable and comments were added to describe the various kmem-debug-* configure options. The default configure options remain: "--enable-debug-kmem --disable-debug-kmem-tracking" |
||
---|---|---|
.. | ||
.gitignore | ||
Makefile.in | ||
spl-atomic.c | ||
spl-condvar.c | ||
spl-cred.c | ||
spl-debug.c | ||
spl-err.c | ||
spl-generic.c | ||
spl-kmem.c | ||
spl-kobj.c | ||
spl-kstat.c | ||
spl-module.c | ||
spl-mutex.c | ||
spl-proc.c | ||
spl-rwlock.c | ||
spl-taskq.c | ||
spl-thread.c | ||
spl-time.c | ||
spl-vnode.c | ||
spl-xdr.c |