summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-11-06 05:08:12 +0000
committeralc <alc@FreeBSD.org>2003-11-06 05:08:12 +0000
commitddec4754a22f0f3dcdd056f77b93a2516128d16d (patch)
treeb5bb0a7ad584e4a2109a84d1cc75470044404875
parent636849aec5c4eb6b782ab6ad5f7623b8bea34680 (diff)
downloadFreeBSD-src-ddec4754a22f0f3dcdd056f77b93a2516128d16d.zip
FreeBSD-src-ddec4754a22f0f3dcdd056f77b93a2516128d16d.tar.gz
- Simplify pipespace() by eliminating the explicit creation of vm objects.
Instead, let the vm objects be lazily instantiated at fault time. This results in the allocation of fewer vm objects and vm map entries due to aggregation in the vm system.
-rw-r--r--sys/kern/sys_pipe.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 3182384..9aae3ef 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -311,9 +311,8 @@ pipespace(cpipe, size)
struct pipe *cpipe;
int size;
{
- struct vm_object *object;
caddr_t buffer;
- int npages, error;
+ int error;
static int curfail = 0;
static struct timeval lastfail;
@@ -321,26 +320,19 @@ pipespace(cpipe, size)
("pipespace: pipe mutex locked"));
size = round_page(size);
- npages = size / PAGE_SIZE;
/*
- * Create an object, I don't like the idea of paging to/from
- * kernel_object.
* XXX -- minor change needed here for NetBSD/OpenBSD VM systems.
*/
- object = vm_object_allocate(OBJT_DEFAULT, npages);
buffer = (caddr_t) vm_map_min(pipe_map);
/*
- * Insert the object into the kernel map, and allocate kva for it.
* The map entry is, by default, pageable.
* XXX -- minor change needed here for NetBSD/OpenBSD VM systems.
*/
- error = vm_map_find(pipe_map, object, 0,
+ error = vm_map_find(pipe_map, NULL, 0,
(vm_offset_t *) &buffer, size, 1,
VM_PROT_ALL, VM_PROT_ALL, 0);
-
if (error != KERN_SUCCESS) {
- vm_object_deallocate(object);
if (ppsratecheck(&lastfail, &curfail, 1))
printf("kern.maxpipekva exceeded, please see tuning(7).\n");
return (ENOMEM);
OpenPOWER on IntegriCloud