summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1998-02-05 03:32:49 +0000
committerdyson <dyson@FreeBSD.org>1998-02-05 03:32:49 +0000
commitebccbfc1ff2783a90468a1caf1dcdec08e2cdfda (patch)
tree55a2e387681d3f8a086c24b5ee5f182df4318779 /sys/kern/kern_exec.c
parentc552a9a1c3362d37fc1aaf3a9ba4231225b1f13a (diff)
downloadFreeBSD-src-ebccbfc1ff2783a90468a1caf1dcdec08e2cdfda.zip
FreeBSD-src-ebccbfc1ff2783a90468a1caf1dcdec08e2cdfda.tar.gz
1) Start using a cleaner and more consistant page allocator instead
of the various ad-hoc schemes. 2) When bringing in UPAGES, the pmap code needs to do another vm_page_lookup. 3) When appropriate, set the PG_A or PG_M bits a-priori to both avoid some processor errata, and to minimize redundant processor updating of page tables. 4) Modify pmap_protect so that it can only remove permissions (as it originally supported.) The additional capability is not needed. 5) Streamline read-only to read-write page mappings. 6) For pmap_copy_page, don't enable write mapping for source page. 7) Correct and clean-up pmap_incore. 8) Cluster initial kern_exec pagin. 9) Removal of some minor lint from kern_malloc. 10) Correct some ioopt code. 11) Remove some dead code from the MI swapout routine. 12) Correct vm_object_deallocate (to remove backing_object ref.) 13) Fix dead object handling, that had problems under heavy memory load. 14) Add minor vm_page_lookup improvements. 15) Some pages are not in objects, and make sure that the vm_page.c can properly support such pages. 16) Add some more page deficit handling. 17) Some minor code readability improvements.
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c60
1 files changed, 33 insertions, 27 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index cc62bc3..4d40448 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kern_exec.c,v 1.74 1998/01/11 21:35:38 dyson Exp $
+ * $Id: kern_exec.c,v 1.75 1998/02/04 22:32:31 eivind Exp $
*/
#include "opt_diagnostic.h"
@@ -359,8 +359,9 @@ int
exec_map_first_page(imgp)
struct image_params *imgp;
{
- int s;
- vm_page_t m;
+ int s, rv, i;
+ int initial_pagein;
+ vm_page_t ma[VM_INITIAL_PAGEIN];
vm_object_t object;
@@ -371,40 +372,45 @@ exec_map_first_page(imgp)
object = imgp->vp->v_object;
s = splvm();
-retry:
- m = vm_page_lookup(object, 0);
- if (m == NULL) {
- m = vm_page_alloc(object, 0, VM_ALLOC_NORMAL);
- if (m == NULL) {
- VM_WAIT;
- goto retry;
+ ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
+
+ if ((ma[0]->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL) {
+ initial_pagein = VM_INITIAL_PAGEIN;
+ if (initial_pagein > object->size)
+ initial_pagein = object->size;
+ for (i = 1; i < initial_pagein; i++) {
+ if (ma[i] = vm_page_lookup(object, i)) {
+ if ((ma[i]->flags & PG_BUSY) || ma[i]->busy)
+ break;
+ if (ma[i]->valid)
+ break;
+ ma[i]->flags |= PG_BUSY;
+ } else {
+ ma[i] = vm_page_alloc(object, i, VM_ALLOC_NORMAL);
+ if (ma[i] == NULL)
+ break;
+ }
}
- } else if ((m->flags & PG_BUSY) || m->busy) {
- m->flags |= PG_WANTED;
- tsleep(m, PVM, "execpw", 0);
- goto retry;
- }
+ initial_pagein = i;
- m->flags |= PG_BUSY;
+ rv = vm_pager_get_pages(object, ma, initial_pagein, 0);
+ ma[0] = vm_page_lookup(object, 0);
- if ((m->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL) {
- int rv;
- rv = vm_pager_get_pages(object, &m, 1, 0);
- if (rv != VM_PAGER_OK) {
- vm_page_protect(m, VM_PROT_NONE);
- vm_page_deactivate(m);
- PAGE_WAKEUP(m);
+ if ((rv != VM_PAGER_OK) || (ma[0] == NULL)) {
+ vm_page_protect(ma[0], VM_PROT_NONE);
+ vm_page_deactivate(ma[0]);
+ PAGE_WAKEUP(ma[0]);
splx(s);
return EIO;
}
}
- vm_page_wire(m);
- PAGE_WAKEUP(m);
+ vm_page_wire(ma[0]);
+ PAGE_WAKEUP(ma[0]);
splx(s);
- pmap_kenter((vm_offset_t) imgp->image_header, VM_PAGE_TO_PHYS(m));
- imgp->firstpage = m;
+ pmap_kenter((vm_offset_t) imgp->image_header, VM_PAGE_TO_PHYS(ma[0]));
+ imgp->firstpage = ma[0];
return 0;
}
OpenPOWER on IntegriCloud