Remove Giant around allocation of the swap pager with non-NULL handle.

Existing issue of not protecting pager_object_list iteration in
vm_pager_object_lookup() by sw_alloc_mtx is not affected by Giant
removal.

Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
kib 2016-05-24 10:16:03 +00:00
parent 9f26e9cda7
commit 2832c7177d

View File

@ -604,7 +604,6 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
pindex = OFF_TO_IDX(offset + PAGE_MASK + size); pindex = OFF_TO_IDX(offset + PAGE_MASK + size);
if (handle) { if (handle) {
mtx_lock(&Giant);
/* /*
* Reference existing named region or allocate new one. There * Reference existing named region or allocate new one. There
* should not be a race here against swp_pager_meta_build() * should not be a race here against swp_pager_meta_build()
@ -617,7 +616,6 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
if (cred != NULL) { if (cred != NULL) {
if (!swap_reserve_by_cred(size, cred)) { if (!swap_reserve_by_cred(size, cred)) {
sx_xunlock(&sw_alloc_sx); sx_xunlock(&sw_alloc_sx);
mtx_unlock(&Giant);
return (NULL); return (NULL);
} }
crhold(cred); crhold(cred);
@ -633,7 +631,6 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
VM_OBJECT_WUNLOCK(object); VM_OBJECT_WUNLOCK(object);
} }
sx_xunlock(&sw_alloc_sx); sx_xunlock(&sw_alloc_sx);
mtx_unlock(&Giant);
} else { } else {
if (cred != NULL) { if (cred != NULL) {
if (!swap_reserve_by_cred(size, cred)) if (!swap_reserve_by_cred(size, cred))