This function is just a wrapper on top of uvm_unmap(), it has its own
file and is called only 3 times in the kernel. Getting rid of it makes
the overall UVM simpler, ok?
Index: sys/conf/files
===================================================================
RCS file: /cvs/src/sys/conf/files,v
retrieving revision 1.675
diff -u -p -r1.675 files
--- sys/conf/files 5 Oct 2019 05:33:14 -0000 1.675
+++ sys/conf/files 2 Nov 2019 09:40:31 -0000
@@ -970,7 +970,6 @@ file uvm/uvm_stat.c
file uvm/uvm_swap.c
file uvm/uvm_swap_encrypt.c uvm_swap_encrypt
file uvm/uvm_unix.c
-file uvm/uvm_user.c
file uvm/uvm_vnode.c
# IPv6
Index: sys/kern/kern_exec.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_exec.c,v
retrieving revision 1.208
diff -u -p -r1.208 kern_exec.c
--- sys/kern/kern_exec.c 2 Aug 2019 02:17:35 -0000 1.208
+++ sys/kern/kern_exec.c 2 Nov 2019 09:40:31 -0000
@@ -749,8 +749,7 @@ exec_abort:
* get rid of the (new) address space we have created, if any, get rid
* of our namei data and vnode, and exit noting failure
*/
- uvm_deallocate(&vm->vm_map, VM_MIN_ADDRESS,
- VM_MAXUSER_ADDRESS - VM_MIN_ADDRESS);
+ uvm_unmap(&vm->vm_map, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS);
if (pack.ep_interp != NULL)
pool_put(&namei_pool, pack.ep_interp);
if (pack.ep_emul_arg != NULL)
Index: sys/kern/sysv_shm.c
===================================================================
RCS file: /cvs/src/sys/kern/sysv_shm.c,v
retrieving revision 1.72
diff -u -p -r1.72 sysv_shm.c
--- sys/kern/sysv_shm.c 28 Oct 2019 19:57:50 -0000 1.72
+++ sys/kern/sysv_shm.c 2 Nov 2019 09:40:31 -0000
@@ -160,14 +160,14 @@ shm_delete_mapping(struct vmspace *vm, s
{
struct shmid_ds *shmseg;
int segnum;
- size_t size;
+ vaddr_t end;
segnum = IPCID_TO_IX(shmmap_s->shmid);
if (segnum < 0 || segnum >= shminfo.shmmni ||
(shmseg = shmsegs[segnum]) == NULL)
return (EINVAL);
- size = round_page(shmseg->shm_segsz);
- uvm_deallocate(&vm->vm_map, shmmap_s->va, size);
+ end = round_page(shmmap_s->va+shmseg->shm_segsz);
+ uvm_unmap(&vm->vm_map, trunc_page(shmmap_s->va), end);
shmmap_s->shmid = -1;
shmseg->shm_dtime = time_second;
if ((--shmseg->shm_nattch <= 0) &&
Index: sys/uvm/uvm_extern.h
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_extern.h,v
retrieving revision 1.148
diff -u -p -r1.148 uvm_extern.h
--- sys/uvm/uvm_extern.h 1 Jul 2019 21:13:03 -0000 1.148
+++ sys/uvm/uvm_extern.h 2 Nov 2019 09:40:31 -0000
@@ -455,7 +455,6 @@ int uvm_coredump_walkmap(struct proc *
uvm_coredump_setup_cb *_setup,
uvm_coredump_walk_cb *_walk, void *_cookie);
void uvm_grow(struct proc *, vaddr_t);
-void uvm_deallocate(vm_map_t, vaddr_t, vsize_t);
struct uvm_object *uvn_attach(struct vnode *, vm_prot_t);
void uvm_pagezero_thread(void *);
void kmeminit_nkmempages(void);
Index: sys/uvm/uvm_unix.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_unix.c,v
retrieving revision 1.66
diff -u -p -r1.66 uvm_unix.c
--- sys/uvm/uvm_unix.c 21 Jun 2019 09:39:49 -0000 1.66
+++ sys/uvm/uvm_unix.c 2 Nov 2019 09:40:31 -0000
@@ -94,7 +94,7 @@ sys_obreak(struct proc *p, void *v, regi
}
vm->vm_dsize += atop(new - old);
} else {
- uvm_deallocate(&vm->vm_map, new, old - new);
+ uvm_unmap(&vm->vm_map, new, old);
vm->vm_dsize -= atop(old - new);
}
Index: sys/uvm/uvm_user.c
===================================================================
RCS file: sys/uvm/uvm_user.c
diff -N sys/uvm/uvm_user.c
--- sys/uvm/uvm_user.c 14 Sep 2014 14:17:27 -0000 1.14
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,55 +0,0 @@
-/* $OpenBSD: uvm_user.c,v 1.14 2014/09/14 14:17:27 jsg Exp $ */
-/* $NetBSD: uvm_user.c,v 1.8 2000/06/27 17:29:37 mrg Exp $ */
-
-/*
- * Copyright (c) 1997 Charles D. Cranor and Washington University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * from: Id: uvm_user.c,v 1.1.2.1 1997/08/14 19:10:41 chuck Exp
- */
-
-/*
- * uvm_user.c: high level uvm_allocate/uvm_deallocate interface into vm.
- */
-
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm.h>
-
-/*
- * uvm_deallocate: deallocate memory (unmap)
- */
-void
-uvm_deallocate(struct vm_map *map, vaddr_t start, vsize_t size)
-{
-
- if (map == NULL)
- panic("uvm_deallocate with null map");
-
- if (size == 0)
- return;
-
- uvm_unmap(map, trunc_page(start), round_page(start+size));
-}
Index: share/man/man9/uvm.9
===================================================================
RCS file: /cvs/src/share/man/man9/uvm.9,v
retrieving revision 1.70
diff -u -p -r1.70 uvm.9
--- share/man/man9/uvm.9 21 Jun 2019 09:39:48 -0000 1.70
+++ share/man/man9/uvm.9 2 Nov 2019 09:44:05 -0000
@@ -43,7 +43,6 @@
.Nm uvm_map_pageable_all ,
.Nm uvm_map_checkprot ,
.Nm uvm_map_protect ,
-.Nm uvm_deallocate ,
.Nm uvmspace_alloc ,
.Nm uvmspace_exec ,
.Nm uvmspace_fork ,
@@ -182,8 +181,6 @@ function initialises the swap subsystem.
.Fn uvm_map_checkprot "vm_map_t map" "vaddr_t start" "vaddr_t end" "vm_prot_t
protection"
.Ft int
.Fn uvm_map_protect "vm_map_t map" "vaddr_t start" "vaddr_t end" "vm_prot_t
new_prot" "boolean_t set_max"
-.Ft void
-.Fn uvm_deallocate "vm_map_t map" "vaddr_t start" "vsize_t size"
.Ft struct vmspace *
.Fn uvmspace_alloc "vaddr_t min" "vaddr_t max" "boolean_t pageable" "boolean_t
remove_holes"
.Ft void
@@ -391,15 +388,6 @@ if
.Fa set_max
is non-zero.
This function returns a standard errno.
-.Pp
-The
-.Fn uvm_deallocate
-function deallocates kernel memory in map
-.Fa map
-from address
-.Fa start
-to
-.Fa start + size .
.Pp
The
.Fn uvmspace_alloc