diff options
author | jeff <jeff@FreeBSD.org> | 2003-01-21 05:44:52 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2003-01-21 05:44:52 +0000 |
commit | 18309dfabebe791e296990abe7d558eba82724a8 (patch) | |
tree | 0787f6c8182982ce13ac9a14af60a5cbecd9e481 /sys/alpha | |
parent | a56a74e4b68be38fa9402c627c60820dce36a399 (diff) | |
download | FreeBSD-src-18309dfabebe791e296990abe7d558eba82724a8.zip FreeBSD-src-18309dfabebe791e296990abe7d558eba82724a8.tar.gz |
- Add a VM_WAIT in the appropriate cases where vm_page_alloc() fails and flags
indicate that uma_small_alloc should not. This code should be refactored so
that there is not so much cross arch duplication.
Reviewed by: jake
Spotted by: tmm
Tested on: alpha, sparc64
Pointy hat to: jeff and everyone who cut and pasted the bad code. :-)
Diffstat (limited to 'sys/alpha')
-rw-r--r-- | sys/alpha/alpha/pmap.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c index 1a9082f..73406fc 100644 --- a/sys/alpha/alpha/pmap.c +++ b/sys/alpha/alpha/pmap.c @@ -582,16 +582,21 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) if (wait & M_ZERO) pflags |= VM_ALLOC_ZERO; - m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); - - if (m) { - va = (void *)ALPHA_PHYS_TO_K0SEG(m->phys_addr); - if ((m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); - return (va); + for (;;) { + m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); + if (m == NULL) { + if (wait & M_NOWAIT) + return (NULL); + else + VM_WAIT; + } else + break; } - return (NULL); + va = (void *)ALPHA_PHYS_TO_K0SEG(m->phys_addr); + if ((m->flags & PG_ZERO) == 0) + bzero(va, PAGE_SIZE); + return (va); } void |