From 2a1618cd59cd53c3647079e2cd611ca3b0f988a3 Mon Sep 17 00:00:00 2001 From: Alan Cox <alc@FreeBSD.org> Date: Sat, 22 Jun 2002 07:54:42 +0000 Subject: [PATCH] o Remove GIANT_REQUIRED from phys_pager_alloc(). If handle isn't NULL, acquire and release Giant. If handle is NULL, Giant isn't needed. o Annotate phys_pager_alloc() and phys_pager_dealloc() as MPSAFE. --- sys/vm/phys_pager.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/vm/phys_pager.c b/sys/vm/phys_pager.c index 76b7efc0920e..a93dda1c0fd8 100644 --- a/sys/vm/phys_pager.c +++ b/sys/vm/phys_pager.c @@ -56,14 +56,15 @@ phys_pager_init(void) mtx_init(&phys_pager_mtx, "phys_pager list", NULL, MTX_DEF); } +/* + * MPSAFE + */ static vm_object_t phys_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff) { vm_object_t object; - GIANT_REQUIRED; - /* * Offset should be page aligned. */ @@ -73,6 +74,7 @@ phys_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, size = round_page(size); if (handle != NULL) { + mtx_lock(&Giant); /* * Lock to prevent object creation race condition. */ @@ -108,7 +110,7 @@ phys_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, if (phys_pager_alloc_lock == -1) wakeup(&phys_pager_alloc_lock); phys_pager_alloc_lock = 0; - + mtx_unlock(&Giant); } else { object = vm_object_allocate(OBJT_PHYS, OFF_TO_IDX(foff + size)); @@ -117,6 +119,9 @@ phys_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, return (object); } +/* + * MPSAFE + */ static void phys_pager_dealloc(vm_object_t object) {