diff options
author | kmacy <kmacy@FreeBSD.org> | 2006-10-12 04:41:39 +0000 |
---|---|---|
committer | kmacy <kmacy@FreeBSD.org> | 2006-10-12 04:41:39 +0000 |
commit | e728d447453104c4d242dc342a1e96716657cad7 (patch) | |
tree | d451a3af547d206259ef0253b9d662aa482279e8 | |
parent | ad9b4ceef9225725d1ac7719783f54b2ffb22db9 (diff) | |
download | FreeBSD-src-e728d447453104c4d242dc342a1e96716657cad7.zip FreeBSD-src-e728d447453104c4d242dc342a1e96716657cad7.tar.gz |
sun4v requires TSBs (translation storage buffers) to be contiguous and be
size aligned requiring heavy usage of vm_page_alloc_contig
This change makes vm_page_alloc_contig SMP safe
Approved by: scottl (acting as backup for mentor rwatson)
-rw-r--r-- | sys/vm/vm_contig.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/vm/vm_contig.c b/sys/vm/vm_contig.c index a2e9129..885ffaf 100644 --- a/sys/vm/vm_contig.c +++ b/sys/vm/vm_contig.c @@ -398,7 +398,8 @@ vm_page_alloc_contig(vm_pindex_t npages, vm_paddr_t low, vm_paddr_t high, vm_page_t pga = vm_page_array; static vm_pindex_t np = 0; static vm_pindex_t start = 0; - int i, pass, pqtype; + vm_pindex_t startl = 0; + int i, pass, pqtype; size = npages << PAGE_SHIFT; if (size == 0) @@ -417,6 +418,7 @@ vm_page_alloc_contig(vm_pindex_t npages, vm_paddr_t low, vm_paddr_t high, * cached amount. */ for (pass = 0; pass < 2; pass++) { + vm_page_lock_queues(); if ((np == 0) || (np > npages)) { if (atop(high) < vm_page_array_size) start = atop(high) - npages + 1; @@ -424,7 +426,6 @@ vm_page_alloc_contig(vm_pindex_t npages, vm_paddr_t low, vm_paddr_t high, start = vm_page_array_size - npages + 1; } np = 0; - vm_page_lock_queues(); retry: start--; /* @@ -517,12 +518,13 @@ cleanup_freed: if (vm_contig_unqueue_free(m) != 0) goto retry_page; } - vm_page_unlock_queues(); /* * We've found a contiguous chunk that meets are requirements. */ np = npages; - return (&pga[start]); + startl = start; + vm_page_unlock_queues(); + return (&pga[startl]); } return (NULL); } |