path: root/sys/sys
diff options
authorRyan Stone <rstone@FreeBSD.org>2021-01-29 21:13:57 +0000
committerRyan Stone <rstone@FreeBSD.org>2021-02-03 21:16:51 +0000
commit660344ca44c63bfe4a16c3e57d0f6dbcbb5e083e (patch)
tree22cbdc1963a999bfa910222811f06284e1d82ea9 /sys/sys
parent8727c174b0fe44766bb7ea765dac6d5f82818103 (diff)
Add a VM flag to prevent reclaim on a failed contig allocation
If a M_WAITOK contig alloc fails, the VM subsystem will try to reclaim contiguous memory twice before actually failing the request. On a system with 64GB of RAM I've observed this take 400-500ms before it finally gives up, and I believe that this will only be worse on systems with even more memory. In certain contexts this delay is extremely harmful, so add a flag that will skip reclaim for allocation requests to allow those paths to opt-out of doing an expensive reclaim. Sponsored by: Dell Inc Differential Revision: https://reviews.freebsd.org/D28422 Reviewed by: markj, kib
Diffstat (limited to 'sys/sys')
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h
index a11dd767efc5..54a05e94a3a2 100644
--- a/sys/sys/malloc.h
+++ b/sys/sys/malloc.h
@@ -54,6 +54,7 @@
#define M_NOWAIT 0x0001 /* do not block */
#define M_WAITOK 0x0002 /* ok to block */
+#define M_NORECLAIM 0x0080 /* do not reclaim after failure */
#define M_ZERO 0x0100 /* bzero the allocation */
#define M_NOVM 0x0200 /* don't ask VM for pages */
#define M_USE_RESERVE 0x0400 /* can alloc out of reserve memory */