summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/uma_machdep.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-11-14 20:01:40 +0000
committerkib <kib@FreeBSD.org>2012-11-14 20:01:40 +0000
commite8ae50d444598a029ceb39f734aeda3b5ee77521 (patch)
treefe0b937a1c55b958f76306b0964a8d88a0f20367 /sys/amd64/amd64/uma_machdep.c
parent32941467f0eddd9305a7be708a05bdc2b91beb3a (diff)
downloadFreeBSD-src-e8ae50d444598a029ceb39f734aeda3b5ee77521.zip
FreeBSD-src-e8ae50d444598a029ceb39f734aeda3b5ee77521.tar.gz
Flip the semantic of M_NOWAIT to only require the allocation to not
sleep, and perform the page allocations with VM_ALLOC_SYSTEM class. Previously, the allocation was also allowed to completely drain the reserve of the free pages, being translated to VM_ALLOC_INTERRUPT request class for vm_page_alloc() and similar functions. Allow the caller of malloc* to request the 'deep drain' semantic by providing M_USE_RESERVE flag, now translated to VM_ALLOC_INTERRUPT class. Previously, it resulted in less aggressive VM_ALLOC_SYSTEM allocation class. Centralize the translation of the M_* malloc(9) flags in the single inline function malloc2vm_flags(). Discussion started by: "Sears, Steven" <Steven.Sears@netapp.com> Reviewed by: alc, mdf (previous version) Tested by: pho (previous version) MFC after: 2 weeks
Diffstat (limited to 'sys/amd64/amd64/uma_machdep.c')
-rw-r--r--sys/amd64/amd64/uma_machdep.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sys/amd64/amd64/uma_machdep.c b/sys/amd64/amd64/uma_machdep.c
index dc9c307..c4ca677 100644
--- a/sys/amd64/amd64/uma_machdep.c
+++ b/sys/amd64/amd64/uma_machdep.c
@@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/lock.h>
+#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <vm/vm.h>
@@ -48,12 +49,7 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
int pflags;
*flags = UMA_SLAB_PRIV;
- if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
- else
- pflags = VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
- if (wait & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
+ pflags = malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
for (;;) {
m = vm_page_alloc(NULL, 0, pflags);
if (m == NULL) {
OpenPOWER on IntegriCloud