diff options
author | Stefan Kempf <stefan@cvs.openbsd.org> | 2016-04-04 16:34:17 +0000 |
---|---|---|
committer | Stefan Kempf <stefan@cvs.openbsd.org> | 2016-04-04 16:34:17 +0000 |
commit | bca792b10e53f176620b38e6d7d472c093f70fdd (patch) | |
tree | f2d96202f112bb2d2c1ab4a92b1513873aac0ee9 /sys | |
parent | 1dfa8721a635e937f98d5271a832165af6dc4678 (diff) |
UVM_FLAG_AMAPPAD has no effect anymore, nuke it.
This flag caused amaps to be allocated with additional spare slots, to
make extending them cheaper. However, the kernel never extends amaps,
so allocating spare slots is pointless. Also UVM_FLAG_AMAPPAD only
has an effect in combination with UVM_FLAG_OVERLAY. The only function
that used both flags was sys_obreak, but that function had the use of
UVM_FLAG_OVERLAY removed recently.
While there, kill the unused prototypes amap_flags and amap_refs.
They're defined as macros already.
ok mlarkin@ kettenis@ mpi@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/uvm/uvm_amap.c | 19 | ||||
-rw-r--r-- | sys/uvm/uvm_amap.h | 8 | ||||
-rw-r--r-- | sys/uvm/uvm_extern.h | 13 | ||||
-rw-r--r-- | sys/uvm/uvm_map.c | 10 | ||||
-rw-r--r-- | sys/uvm/uvm_unix.c | 5 |
5 files changed, 22 insertions, 33 deletions
diff --git a/sys/uvm/uvm_amap.c b/sys/uvm/uvm_amap.c index 6472c0f4bee..5f9d778908a 100644 --- a/sys/uvm/uvm_amap.c +++ b/sys/uvm/uvm_amap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_amap.c,v 1.63 2016/03/27 09:51:37 stefan Exp $ */ +/* $OpenBSD: uvm_amap.c,v 1.64 2016/04/04 16:34:16 stefan Exp $ */ /* $NetBSD: uvm_amap.c,v 1.27 2000/11/25 06:27:59 chs Exp $ */ /* @@ -65,7 +65,7 @@ static char amap_slot_pool_names[UVM_AMAP_CHUNK][13]; * local functions */ -static struct vm_amap *amap_alloc1(int, int, int); +static struct vm_amap *amap_alloc1(int, int); static __inline void amap_list_insert(struct vm_amap *); static __inline void amap_list_remove(struct vm_amap *); @@ -177,7 +177,7 @@ amap_init(void) * init the overlay. */ static inline struct vm_amap * -amap_alloc1(int slots, int padslots, int waitf) +amap_alloc1(int slots, int waitf) { struct vm_amap *amap; int totalslots; @@ -187,7 +187,7 @@ amap_alloc1(int slots, int padslots, int waitf) if (amap == NULL) return(NULL); - totalslots = slots + padslots; + totalslots = slots; KASSERT(totalslots > 0); if (totalslots > UVM_AMAP_CHUNK) @@ -233,15 +233,14 @@ fail1: * => reference count to new amap is set to one */ struct vm_amap * -amap_alloc(vaddr_t sz, vaddr_t padsz, int waitf) +amap_alloc(vaddr_t sz, int waitf) { struct vm_amap *amap; - int slots, padslots; + int slots; AMAP_B2SLOT(slots, sz); /* load slots */ - AMAP_B2SLOT(padslots, padsz); - amap = amap_alloc1(slots, padslots, waitf); + amap = amap_alloc1(slots, waitf); if (amap) { memset(amap->am_anon, 0, amap->am_maxslot * sizeof(struct vm_anon *)); @@ -361,7 +360,7 @@ amap_copy(struct vm_map *map, struct vm_map_entry *entry, int waitf, } entry->aref.ar_pageoff = 0; - entry->aref.ar_amap = amap_alloc(entry->end - entry->start, 0, + entry->aref.ar_amap = amap_alloc(entry->end - entry->start, waitf); if (entry->aref.ar_amap != NULL) entry->etype &= ~UVM_ET_NEEDSCOPY; @@ -381,7 +380,7 @@ amap_copy(struct vm_map *map, struct vm_map_entry *entry, int waitf, /* looks like we need to copy the map. */ AMAP_B2SLOT(slots, entry->end - entry->start); - amap = amap_alloc1(slots, 0, waitf); + amap = amap_alloc1(slots, waitf); if (amap == NULL) return; srcamap = entry->aref.ar_amap; diff --git a/sys/uvm/uvm_amap.h b/sys/uvm/uvm_amap.h index a98b44073ad..6991ec2a198 100644 --- a/sys/uvm/uvm_amap.h +++ b/sys/uvm/uvm_amap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_amap.h,v 1.22 2016/03/27 09:51:37 stefan Exp $ */ +/* $OpenBSD: uvm_amap.h,v 1.23 2016/04/04 16:34:16 stefan Exp $ */ /* $NetBSD: uvm_amap.h,v 1.14 2001/02/18 21:19:08 chs Exp $ */ /* @@ -66,14 +66,12 @@ struct vm_amap; void amap_add(struct vm_aref *, vaddr_t, struct vm_anon *, boolean_t); /* allocate a new amap */ -struct vm_amap *amap_alloc(vaddr_t, vaddr_t, int); +struct vm_amap *amap_alloc(vaddr_t, int); /* clear amap needs-copy flag */ void amap_copy(vm_map_t, vm_map_entry_t, int, boolean_t, vaddr_t, vaddr_t); /* resolve all COW faults now */ void amap_cow_now(vm_map_t, vm_map_entry_t); - /* get amap's flags */ -int amap_flags(struct vm_amap *); /* free amap */ void amap_free(struct vm_amap *); /* init amap module (at boot time) */ @@ -84,8 +82,6 @@ struct vm_anon *amap_lookup(struct vm_aref *, vaddr_t); void amap_lookups(struct vm_aref *, vaddr_t, struct vm_anon **, int); /* add a reference to an amap */ void amap_ref(struct vm_amap *, vaddr_t, vsize_t, int); - /* get number of references of amap */ -int amap_refs(struct vm_amap *); /* split reference to amap into two */ void amap_splitref(struct vm_aref *, struct vm_aref *, vaddr_t); /* remove an anon from an amap */ diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index 0119130d717..7b6e6d65d1e 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.137 2015/12/02 09:50:46 blambert Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.138 2016/04/04 16:34:16 stefan Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -106,12 +106,11 @@ typedef int vm_prot_t; #define UVM_FLAG_OVERLAY 0x0020000 /* establish overlay */ #define UVM_FLAG_NOMERGE 0x0040000 /* don't merge map entries */ #define UVM_FLAG_COPYONW 0x0080000 /* set copy_on_write flag */ -#define UVM_FLAG_AMAPPAD 0x0100000 /* for bss: pad amap to reduce malloc() */ -#define UVM_FLAG_TRYLOCK 0x0200000 /* fail if we can not lock map */ -#define UVM_FLAG_HOLE 0x0400000 /* no backend */ -#define UVM_FLAG_QUERY 0x0800000 /* do everything, except actual execution */ -#define UVM_FLAG_NOFAULT 0x1000000 /* don't fault */ -#define UVM_FLAG_UNMAP 0x2000000 /* unmap to make space */ +#define UVM_FLAG_TRYLOCK 0x0100000 /* fail if we can not lock map */ +#define UVM_FLAG_HOLE 0x0200000 /* no backend */ +#define UVM_FLAG_QUERY 0x0400000 /* do everything, except actual execution */ +#define UVM_FLAG_NOFAULT 0x0800000 /* don't fault */ +#define UVM_FLAG_UNMAP 0x1000000 /* unmap to make space */ /* macros to extract info */ diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index ff7c5e407c6..1a3b04fbdf7 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.210 2016/03/27 09:51:37 stefan Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.211 2016/04/04 16:34:16 stefan Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -1084,9 +1084,7 @@ uvm_mapanon(struct vm_map *map, vaddr_t *addr, vsize_t sz, if (flags & UVM_FLAG_OVERLAY) { KERNEL_LOCK(); entry->aref.ar_pageoff = 0; - entry->aref.ar_amap = amap_alloc(sz, - ptoa(flags & UVM_FLAG_AMAPPAD ? UVM_AMAP_CHUNK : 0), - M_WAITOK); + entry->aref.ar_amap = amap_alloc(sz, M_WAITOK); KERNEL_UNLOCK(); } @@ -1342,9 +1340,7 @@ uvm_map(struct vm_map *map, vaddr_t *addr, vsize_t sz, } if (flags & UVM_FLAG_OVERLAY) { entry->aref.ar_pageoff = 0; - entry->aref.ar_amap = amap_alloc(sz, - ptoa(flags & UVM_FLAG_AMAPPAD ? UVM_AMAP_CHUNK : 0), - M_WAITOK); + entry->aref.ar_amap = amap_alloc(sz, M_WAITOK); } /* Update map and process statistics. */ diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c index 505d3c806cd..3d6d3ad3f51 100644 --- a/sys/uvm/uvm_unix.c +++ b/sys/uvm/uvm_unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_unix.c,v 1.57 2016/03/15 18:16:47 stefan Exp $ */ +/* $OpenBSD: uvm_unix.c,v 1.58 2016/04/04 16:34:16 stefan Exp $ */ /* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */ /* @@ -86,8 +86,7 @@ sys_obreak(struct proc *p, void *v, register_t *retval) UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_INHERIT_COPY, - MADV_NORMAL, UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED| - UVM_FLAG_COPYONW)); + MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_COPYONW)); if (error) { uprintf("sbrk: grow %ld failed, error = %d\n", new - old, error); |