diff options
author | alc <alc@FreeBSD.org> | 1999-08-01 06:05:09 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 1999-08-01 06:05:09 +0000 |
commit | 33da09bf48e594f4f9734da60181acb8ed7c0cd5 (patch) | |
tree | 88788c7d46d119c494704045a78e93d4fb700784 | |
parent | 319a1b1319cc5fec318be743854f484bc984b132 (diff) | |
download | FreeBSD-src-33da09bf48e594f4f9734da60181acb8ed7c0cd5.zip FreeBSD-src-33da09bf48e594f4f9734da60181acb8ed7c0cd5.tar.gz |
Move the memory access behavior information provided by madvise
from the vm_object to the vm_map.
Submitted by: dillon
-rw-r--r-- | sys/ufs/ufs/ufs_readwrite.c | 9 | ||||
-rw-r--r-- | sys/vm/vm_fault.c | 7 | ||||
-rw-r--r-- | sys/vm/vm_map.c | 14 | ||||
-rw-r--r-- | sys/vm/vm_map.h | 22 | ||||
-rw-r--r-- | sys/vm/vm_object.c | 3 | ||||
-rw-r--r-- | sys/vm/vm_object.h | 7 |
6 files changed, 38 insertions, 24 deletions
diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index 81a84bb..3fc8c46 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ufs_readwrite.c 8.11 (Berkeley) 5/8/95 - * $Id: ufs_readwrite.c,v 1.60 1999/07/13 18:20:12 mckusick Exp $ + * $Id: ufs_readwrite.c,v 1.61 1999/07/25 02:07:16 bde Exp $ */ #define BLKSIZE(a, b, c) blksize(a, b, c) @@ -591,10 +591,9 @@ ffs_getpages(ap) if (firstindex == 0) vp->v_lastr = 0; - if (((obj->behavior != OBJ_RANDOM) && - (firstindex != 0) && (firstindex <= vp->v_lastr) && - ((firstindex + pcount) > vp->v_lastr)) || - (obj->behavior == OBJ_SEQUENTIAL)) { + if ((firstindex != 0) && + (firstindex <= vp->v_lastr) && + ((firstindex + pcount) > vp->v_lastr)) { struct uio auio; struct iovec aiov; diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 6c24c06..dd53ad9 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -66,7 +66,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_fault.c,v 1.102 1999/05/02 23:57:11 alc Exp $ + * $Id: vm_fault.c,v 1.103 1999/07/20 05:46:56 alc Exp $ */ /* @@ -385,8 +385,9 @@ readrest: int rv; int reqpage; int ahead, behind; + u_char behavior = vm_map_entry_behavior(fs.entry); - if (fs.first_object->behavior == OBJ_RANDOM) { + if (behavior == MAP_ENTRY_BEHAV_RANDOM) { ahead = 0; behind = 0; } else { @@ -400,7 +401,7 @@ readrest: } if ((fs.first_object->type != OBJT_DEVICE) && - (fs.first_object->behavior == OBJ_SEQUENTIAL)) { + (behavior == MAP_ENTRY_BEHAV_SEQUENTIAL)) { vm_pindex_t firstpindex, tmppindex; if (fs.first_pindex < 2*(VM_FAULT_READ_BEHIND + VM_FAULT_READ_AHEAD + 1)) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index bfebc9c..9d4aec7 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_map.c,v 1.172 1999/07/11 18:30:31 alc Exp $ + * $Id: vm_map.c,v 1.173 1999/07/21 18:02:27 alc Exp $ */ /* @@ -1050,14 +1050,14 @@ vm_map_madvise(map, start, end, advise) } switch (advise) { - case MADV_NORMAL: - current->object.vm_object->behavior = OBJ_NORMAL; + case MADV_NORMAL: + vm_map_entry_set_behavior(current, MAP_ENTRY_BEHAV_NORMAL); break; - case MADV_SEQUENTIAL: - current->object.vm_object->behavior = OBJ_SEQUENTIAL; + case MADV_SEQUENTIAL: + vm_map_entry_set_behavior(current, MAP_ENTRY_BEHAV_SEQUENTIAL); break; - case MADV_RANDOM: - current->object.vm_object->behavior = OBJ_RANDOM; + case MADV_RANDOM: + vm_map_entry_set_behavior(current, MAP_ENTRY_BEHAV_RANDOM); break; /* * Right now, we could handle DONTNEED and WILLNEED with common code. diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h index 996ec95..2c22801 100644 --- a/sys/vm/vm_map.h +++ b/sys/vm/vm_map.h @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_map.h,v 1.42 1999/06/19 18:42:51 alc Exp $ + * $Id: vm_map.h,v 1.43 1999/07/10 18:16:08 alc Exp $ */ /* @@ -118,6 +118,26 @@ struct vm_map_entry { #define MAP_ENTRY_NOFAULT 0x10 #define MAP_ENTRY_USER_WIRED 0x20 +#define MAP_ENTRY_BEHAV_NORMAL 0x00 /* default behavior */ +#define MAP_ENTRY_BEHAV_SEQUENTIAL 0x40 /* expect sequential access */ +#define MAP_ENTRY_BEHAV_RANDOM 0x80 /* expect random access */ +#define MAP_ENTRY_BEHAV_RESERVED 0xC0 /* future use */ + +#define MAP_ENTRY_BEHAV_MASK 0xC0 + +static __inline u_char +vm_map_entry_behavior(struct vm_map_entry *entry) +{ + return entry->eflags & MAP_ENTRY_BEHAV_MASK; +} + +static __inline void +vm_map_entry_set_behavior(struct vm_map_entry *entry, u_char behavior) +{ + entry->eflags = (entry->eflags & ~MAP_ENTRY_BEHAV_MASK) | + (behavior & MAP_ENTRY_BEHAV_MASK); +} + /* * Maps are doubly-linked lists of map entries, kept sorted * by address. A single hint is provided to start diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 2df7e2a..22682b7 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_object.c,v 1.159 1999/07/11 18:30:32 alc Exp $ + * $Id: vm_object.c,v 1.160 1999/07/16 05:11:36 alc Exp $ */ /* @@ -154,7 +154,6 @@ _vm_object_allocate(type, size, object) object->flags = 0; if ((object->type == OBJT_DEFAULT) || (object->type == OBJT_SWAP)) vm_object_set_flag(object, OBJ_ONEMAPPING); - object->behavior = OBJ_NORMAL; object->paging_in_progress = 0; object->resident_page_count = 0; object->shadow_count = 0; diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 86bbaa8..62e52e9 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_object.h,v 1.57 1999/07/10 18:29:18 alc Exp $ + * $Id: vm_object.h,v 1.58 1999/07/16 05:11:37 alc Exp $ */ /* @@ -98,7 +98,6 @@ struct vm_object { u_short flags; /* see below */ u_short pg_color; /* color of first page in obj */ u_short paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ - u_short behavior; /* see below */ int resident_page_count; /* number of resident pages */ struct vm_object *backing_object; /* object that I'm a shadow of */ vm_ooffset_t backing_object_offset;/* Offset in backing object */ @@ -149,10 +148,6 @@ struct vm_object { #define OBJ_OPT 0x1000 /* I/O optimization */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ -#define OBJ_NORMAL 0x0 /* default behavior */ -#define OBJ_SEQUENTIAL 0x1 /* expect sequential accesses */ -#define OBJ_RANDOM 0x2 /* expect random accesses */ - #define IDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT) #define OFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> PAGE_SHIFT)) |