Move the memory access behavior information provided by madvise

from the vm_object to the vm_map.

Submitted by:	dillon
This commit is contained in:
Alan Cox 1999-08-01 06:05:09 +00:00
parent eaf183a844
commit 7f866e4b29
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=49338
6 changed files with 38 additions and 24 deletions

View File

@ -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;

View File

@ -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 @@ RetryFault:;
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 @@ RetryFault:;
}
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))

View File

@ -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.

View File

@ -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

View File

@ -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;

View File

@ -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))