Eliminate redundant calls to vm_map_pageable() and vm_fault(), as suggested by

Chuck Cranor.
This commit is contained in:
mycroft 1997-04-09 23:35:07 +00:00
parent e59a1e5e15
commit f50c40bad5
2 changed files with 10 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.100 1997/03/19 03:19:01 mycroft Exp $ */ /* $NetBSD: trap.c,v 1.101 1997/04/09 23:35:07 mycroft Exp $ */
/*- /*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -387,27 +387,19 @@ trap(frame)
} }
} }
/* check if page table is mapped, if not, fault it first */ /* Create a page table page if necessary, and wire it. */
if ((PTD[pdei(va)] & PG_V) == 0) { if ((PTD[pdei(va)] & PG_V) == 0) {
v = trunc_page(vtopte(va)); v = trunc_page(vtopte(va));
rv = vm_fault(map, v, ftype, FALSE); rv = vm_map_pageable(map, v, v + NBPG, FALSE);
if (rv != KERN_SUCCESS) if (rv != KERN_SUCCESS)
goto nogo; goto nogo;
/* check if page table fault, increment wiring */ }
vm_map_pageable(map, v, round_page(v+1), FALSE);
} else
v = 0;
/* Fault the original page in. */
rv = vm_fault(map, va, ftype, FALSE); rv = vm_fault(map, va, ftype, FALSE);
if (rv == KERN_SUCCESS) { if (rv == KERN_SUCCESS) {
if (nss > vm->vm_ssize) if (nss > vm->vm_ssize)
vm->vm_ssize = nss; vm->vm_ssize = nss;
va = trunc_page(vtopte(va));
/* for page table, increment wiring as long as
not a page table fault as well */
if (!v && map != kernel_map)
vm_map_pageable(map, va, round_page(va+1),
FALSE);
if (type == T_PAGEFLT) if (type == T_PAGEFLT)
return; return;
goto out; goto out;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.24 1997/04/01 16:33:04 matthias Exp $ */ /* $NetBSD: trap.c,v 1.25 1997/04/09 23:35:08 mycroft Exp $ */
/*- /*-
* Copyright (c) 1996 Matthias Pfaller. All rights reserved. * Copyright (c) 1996 Matthias Pfaller. All rights reserved.
@ -396,27 +396,19 @@ trap(frame)
} }
} }
/* check if page table is mapped, if not, fault it first */ /* Create a page table page if necessary, and wire it. */
if ((PTD[pdei(va)] & PG_V) == 0) { if ((PTD[pdei(va)] & PG_V) == 0) {
v = trunc_page(vtopte(va)); v = trunc_page(vtopte(va));
rv = vm_fault(map, v, ftype, FALSE); rv = vm_map_pageable(map, v, v + NBPG, FALSE);
if (rv != KERN_SUCCESS) if (rv != KERN_SUCCESS)
goto nogo; goto nogo;
/* check if page table fault, increment wiring */ }
vm_map_pageable(map, v, round_page(v+1), FALSE);
} else
v = 0;
/* Fault the original page in. */
rv = vm_fault(map, va, ftype, FALSE); rv = vm_fault(map, va, ftype, FALSE);
if (rv == KERN_SUCCESS) { if (rv == KERN_SUCCESS) {
if (nss > vm->vm_ssize) if (nss > vm->vm_ssize)
vm->vm_ssize = nss; vm->vm_ssize = nss;
va = trunc_page(vtopte(va));
/* for page table, increment wiring as long as
not a page table fault as well */
if (!v && map != kernel_map)
vm_map_pageable(map, va, round_page(va+1),
FALSE);
if (type == T_ABT) if (type == T_ABT)
return; return;
goto out; goto out;