diff options
author | alc <alc@FreeBSD.org> | 2003-08-11 00:17:44 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-08-11 00:17:44 +0000 |
commit | 1625d6386b23ec96cdde63544081b5711aac0e45 (patch) | |
tree | b3d56cef090aae31c0099555bd69fe50f95597d3 /sys | |
parent | f9f13dbaf0fd714b1af49838c48e2144670d8da8 (diff) | |
download | FreeBSD-src-1625d6386b23ec96cdde63544081b5711aac0e45.zip FreeBSD-src-1625d6386b23ec96cdde63544081b5711aac0e45.tar.gz |
Use vm_page_hold() instead of vm_page_wire(). Otherwise, a multithreaded
application could cause a wired page to be freed. In general,
vm_page_hold() should be preferred for ephemeral kernel mappings of pages
borrowed from a user-level address space. (vm_page_wire() should really be
reserved for indefinite duration pinning by the "owner" of the page.)
Discussed with: silby
Submitted by: tegge
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/sys_pipe.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 3e5d507..0bf87fb 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -696,7 +696,7 @@ pipe_build_write_buffer(wpipe, uio) vm_page_lock_queues(); for (j = 0; j < i; j++) { - vm_page_unwire(wpipe->pipe_map.ms[j], 1); + vm_page_unhold(wpipe->pipe_map.ms[j]); atomic_subtract_int(&amountpipekvawired, PAGE_SIZE); } @@ -706,7 +706,7 @@ pipe_build_write_buffer(wpipe, uio) m = PHYS_TO_VM_PAGE(paddr); vm_page_lock_queues(); - vm_page_wire(m); + vm_page_hold(m); atomic_add_int(&amountpipekvawired, PAGE_SIZE); vm_page_unlock_queues(); wpipe->pipe_map.ms[i] = m; @@ -775,7 +775,7 @@ pipe_destroy_write_buffer(wpipe) } vm_page_lock_queues(); for (i = 0; i < wpipe->pipe_map.npages; i++) { - vm_page_unwire(wpipe->pipe_map.ms[i], 1); + vm_page_unhold(wpipe->pipe_map.ms[i]); atomic_subtract_int(&amountpipekvawired, PAGE_SIZE); } vm_page_unlock_queues(); |