diff options
author | alc <alc@FreeBSD.org> | 2003-02-13 19:39:54 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-02-13 19:39:54 +0000 |
commit | d3cfca777cfe7ba70a7f768f43da01965478cbaa (patch) | |
tree | a0e776497e3dccfc14114e72019e2483fb6b029c | |
parent | 43e82f74f729c77a0250f5cd4bb20450b59f605b (diff) | |
download | FreeBSD-src-d3cfca777cfe7ba70a7f768f43da01965478cbaa.zip FreeBSD-src-d3cfca777cfe7ba70a7f768f43da01965478cbaa.tar.gz |
Use atomic ops to update amountpipekva. Amountpipekva represents the
total kernel virtual address space used by all pipes. It is, thus, outside
the scope of any individual pipe lock.
-rw-r--r-- | sys/kern/sys_pipe.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 937e909..7fbceb5 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -332,7 +332,7 @@ pipespace(cpipe, size) cpipe->pipe_buffer.in = 0; cpipe->pipe_buffer.out = 0; cpipe->pipe_buffer.cnt = 0; - amountpipekva += cpipe->pipe_buffer.size; + atomic_add_int(&amountpipekva, cpipe->pipe_buffer.size); return (0); } @@ -676,7 +676,8 @@ pipe_build_write_buffer(wpipe, uio) */ wpipe->pipe_map.kva = kmem_alloc_pageable(kernel_map, wpipe->pipe_buffer.size + PAGE_SIZE); - amountpipekva += wpipe->pipe_buffer.size + PAGE_SIZE; + atomic_add_int(&amountpipekva, + wpipe->pipe_buffer.size + PAGE_SIZE); } pmap_qenter(wpipe->pipe_map.kva, wpipe->pipe_map.ms, wpipe->pipe_map.npages); @@ -714,7 +715,8 @@ pipe_destroy_write_buffer(wpipe) wpipe->pipe_map.kva = 0; kmem_free(kernel_map, kva, wpipe->pipe_buffer.size + PAGE_SIZE); - amountpipekva -= wpipe->pipe_buffer.size + PAGE_SIZE; + atomic_subtract_int(&amountpipekva, + wpipe->pipe_buffer.size + PAGE_SIZE); } } vm_page_lock_queues(); @@ -1338,7 +1340,7 @@ pipe_free_kmem(cpipe) if (cpipe->pipe_buffer.buffer != NULL) { if (cpipe->pipe_buffer.size > PIPE_SIZE) --nbigpipe; - amountpipekva -= cpipe->pipe_buffer.size; + atomic_subtract_int(&amountpipekva, cpipe->pipe_buffer.size); kmem_free(kernel_map, (vm_offset_t)cpipe->pipe_buffer.buffer, cpipe->pipe_buffer.size); @@ -1346,7 +1348,8 @@ pipe_free_kmem(cpipe) } #ifndef PIPE_NODIRECT if (cpipe->pipe_map.kva != 0) { - amountpipekva -= cpipe->pipe_buffer.size + PAGE_SIZE; + atomic_subtract_int(&amountpipekva, + cpipe->pipe_buffer.size + PAGE_SIZE); kmem_free(kernel_map, cpipe->pipe_map.kva, cpipe->pipe_buffer.size + PAGE_SIZE); |