From 58b4e6cc84d76f15d264fb959b50d9071a24d14e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 12 Aug 1999 06:33:56 +0000 Subject: [PATCH] vm_object_madvise: Support MADV_DONTNEED and MADV_WILLNEED on object types besides OBJT_DEFAULT and OBJT_SWAP. Submitted by: dillon --- sys/vm/vm_object.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 91feed0bf12c..70a3defabef3 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.161 1999/08/01 06:05:09 alc Exp $ + * $Id: vm_object.c,v 1.162 1999/08/09 10:35:05 phk Exp $ */ /* @@ -766,16 +766,18 @@ vm_object_madvise(object, pindex, count, advise) tobject = object; tpindex = pindex; shadowlookup: - - if (tobject->type != OBJT_DEFAULT && - tobject->type != OBJT_SWAP - ) { - continue; + /* + * MADV_FREE only operates on OBJT_DEFAULT or OBJT_SWAP pages + * and those pages must be OBJ_ONEMAPPING. + */ + if (advise == MADV_FREE) { + if ((tobject->type != OBJT_DEFAULT && + tobject->type != OBJT_SWAP) || + (tobject->flags & OBJ_ONEMAPPING) == 0) { + continue; + } } - if ((tobject->flags & OBJ_ONEMAPPING) == 0) - continue; - m = vm_page_lookup(tobject, tpindex); if (m == NULL) {