From e972780a114bdef5234e4c83b1908c69a899dc5a Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 17 May 1999 00:53:56 +0000 Subject: Add the options MAP_PREFAULT and MAP_PREFAULT_PARTIAL to vm_map_find/insert, eliminating the need for the pmap_object_init_pt calls in imgact_* and mmap. Reviewed by: David Greenman --- sys/vm/vm_map.c | 7 ++++++- sys/vm/vm_map.h | 4 +++- sys/vm/vm_mmap.c | 12 ++---------- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'sys/vm') diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index d9c3f04ad20d..882a81bcb620 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_map.c,v 1.161 1999/05/14 23:09:32 alc Exp $ + * $Id: vm_map.c,v 1.162 1999/05/16 05:07:31 alc Exp $ */ /* @@ -561,6 +561,11 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset, (prev_entry->end >= new_entry->start)) map->first_free = new_entry; + if (cow & (MAP_PREFAULT|MAP_PREFAULT_PARTIAL)) + pmap_object_init_pt(map->pmap, start, + object, OFF_TO_IDX(offset), end - start, + cow & MAP_PREFAULT_PARTIAL); + return (KERN_SUCCESS); } diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h index 2f07515f5ef3..cb9bb12cafd3 100644 --- a/sys/vm/vm_map.h +++ b/sys/vm/vm_map.h @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_map.h,v 1.39 1999/05/14 23:09:34 alc Exp $ + * $Id: vm_map.h,v 1.40 1999/05/16 05:07:33 alc Exp $ */ /* @@ -308,6 +308,8 @@ vmspace_resident_count(struct vmspace *vmspace) #define MAP_UNUSED_01 0x1 #define MAP_COPY_ON_WRITE 0x2 #define MAP_NOFAULT 0x4 +#define MAP_PREFAULT 0x8 +#define MAP_PREFAULT_PARTIAL 0x10 /* * vm_fault option flags diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index bab89127c05d..b7631288869d 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -38,7 +38,7 @@ * from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$ * * @(#)vm_mmap.c 8.4 (Berkeley) 1/12/94 - * $Id: vm_mmap.c,v 1.97 1999/05/14 23:09:34 alc Exp $ + * $Id: vm_mmap.c,v 1.98 1999/05/16 05:07:33 alc Exp $ */ /* @@ -1035,7 +1035,7 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot, docow = 0; if ((flags & (MAP_ANON|MAP_SHARED)) == 0) { - docow = MAP_COPY_ON_WRITE; + docow = MAP_COPY_ON_WRITE | MAP_PREFAULT_PARTIAL; } #if defined(VM_PROT_READ_IS_EXEC) @@ -1067,14 +1067,6 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot, goto out; } - /* - * "Pre-fault" resident pages. - */ - if ((map->pmap != NULL) && (object != NULL)) { - pmap_object_init_pt(map->pmap, *addr, - object, (vm_pindex_t) OFF_TO_IDX(foff), size, 1); - } - /* * Shared memory is also shared with children. */ -- cgit v1.3