pmap_wired_count() is now available on all platforms,
remove the code for the case where it's not defined.
This commit is contained in:
parent
f368e90e9b
commit
b0c54c738d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_map.c,v 1.182 2005/01/17 04:37:20 atatat Exp $ */
|
||||
/* $NetBSD: uvm_map.c,v 1.183 2005/01/23 15:58:13 chs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Charles D. Cranor and Washington University.
|
||||
|
@ -71,7 +71,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.182 2005/01/17 04:37:20 atatat Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.183 2005/01/23 15:58:13 chs Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_uvmhist.h"
|
||||
|
@ -3257,14 +3257,11 @@ uvm_map_pageable_all(struct vm_map *map, int flags, vsize_t limit)
|
|||
return ENOMEM;
|
||||
}
|
||||
|
||||
/* XXX non-pmap_wired_count case must be handled by caller */
|
||||
#ifdef pmap_wired_count
|
||||
if (limit != 0 &&
|
||||
(size + ptoa(pmap_wired_count(vm_map_pmap(map))) > limit)) {
|
||||
vm_map_unlock(map);
|
||||
return ENOMEM;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Pass 2.
|
||||
|
@ -4377,13 +4374,8 @@ uvm_map_printit(struct vm_map *map, boolean_t full,
|
|||
(*pr)("\t#ent=%d, sz=%d, ref=%d, version=%d, flags=0x%x\n",
|
||||
map->nentries, map->size, map->ref_count, map->timestamp,
|
||||
map->flags);
|
||||
#ifdef pmap_wired_count
|
||||
(*pr)("\tpmap=%p(resident=%ld, wired=%ld)\n", map->pmap,
|
||||
pmap_resident_count(map->pmap), pmap_wired_count(map->pmap));
|
||||
#else
|
||||
(*pr)("\tpmap=%p(resident=%ld)\n", map->pmap,
|
||||
pmap_resident_count(map->pmap));
|
||||
#endif
|
||||
if (!full)
|
||||
return;
|
||||
for (entry = map->header.next; entry != &map->header;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_mmap.c,v 1.86 2005/01/01 21:00:06 yamt Exp $ */
|
||||
/* $NetBSD: uvm_mmap.c,v 1.87 2005/01/23 15:58:13 chs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Charles D. Cranor and Washington University.
|
||||
|
@ -51,7 +51,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.86 2005/01/01 21:00:06 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.87 2005/01/23 15:58:13 chs Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
||||
|
@ -335,16 +335,6 @@ sys_mmap(l, v, retval)
|
|||
if ((ssize_t) size < 0)
|
||||
return (EINVAL); /* don't allow wrap */
|
||||
|
||||
#ifndef pmap_wired_count
|
||||
/*
|
||||
* if we're going to wire the mapping, restrict it to superuser.
|
||||
*/
|
||||
|
||||
if ((flags & MAP_WIRED) != 0 &&
|
||||
(error = suser(p->p_ucred, &p->p_acflag)) != 0)
|
||||
return (error);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* now check (MAP_FIXED) or get (!MAP_FIXED) the "addr"
|
||||
*/
|
||||
|
@ -924,14 +914,9 @@ sys_mlock(l, v, retval)
|
|||
if (atop(size) + uvmexp.wired > uvmexp.wiredmax)
|
||||
return (EAGAIN);
|
||||
|
||||
#ifdef pmap_wired_count
|
||||
if (size + ptoa(pmap_wired_count(vm_map_pmap(&p->p_vmspace->vm_map))) >
|
||||
p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur)
|
||||
return (EAGAIN);
|
||||
#else
|
||||
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
|
||||
return (error);
|
||||
#endif
|
||||
|
||||
error = uvm_map_pageable(&p->p_vmspace->vm_map, addr, addr+size, FALSE,
|
||||
0);
|
||||
|
@ -979,11 +964,6 @@ sys_munlock(l, v, retval)
|
|||
if (addr + size < addr)
|
||||
return (EINVAL);
|
||||
|
||||
#ifndef pmap_wired_count
|
||||
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
|
||||
return (error);
|
||||
#endif
|
||||
|
||||
error = uvm_map_pageable(&p->p_vmspace->vm_map, addr, addr+size, TRUE,
|
||||
0);
|
||||
if (error == EFAULT)
|
||||
|
@ -1013,11 +993,6 @@ sys_mlockall(l, v, retval)
|
|||
(flags & ~(MCL_CURRENT|MCL_FUTURE)) != 0)
|
||||
return (EINVAL);
|
||||
|
||||
#ifndef pmap_wired_count
|
||||
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
|
||||
return (error);
|
||||
#endif
|
||||
|
||||
error = uvm_map_pageable_all(&p->p_vmspace->vm_map, flags,
|
||||
p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur);
|
||||
return (error);
|
||||
|
@ -1207,13 +1182,10 @@ uvm_mmap(map, addr, size, prot, maxprot, flags, handle, foff, locklimit)
|
|||
}
|
||||
vm_map_lock(map);
|
||||
if ((flags & MAP_WIRED) != 0 || (map->flags & VM_MAP_WIREFUTURE) != 0) {
|
||||
if ((atop(size) + uvmexp.wired) > uvmexp.wiredmax
|
||||
#ifdef pmap_wired_count
|
||||
|| (locklimit != 0 && (size +
|
||||
ptoa(pmap_wired_count(vm_map_pmap(map)))) >
|
||||
locklimit)
|
||||
#endif
|
||||
) {
|
||||
if (atop(size) + uvmexp.wired > uvmexp.wiredmax ||
|
||||
(locklimit != 0 &&
|
||||
size + ptoa(pmap_wired_count(vm_map_pmap(map))) >
|
||||
locklimit)) {
|
||||
vm_map_unlock(map);
|
||||
uvm_unmap(map, *addr, *addr + size);
|
||||
return ENOMEM;
|
||||
|
|
Loading…
Reference in New Issue