Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jan 1997 18:31:41 -0800 (PST)
From:      Mike Pritchard <mpp>
To:        dyson@FreeBSD.ORG
Cc:        dtc@scrooge.ee.swin.oz.au, current@FreeBSD.ORG
Subject:   Re: possible madvise MADV_FREE improvement
Message-ID:  <199701260231.SAA10393@freefall.freebsd.org>
In-Reply-To: <199701200206.VAA00126@dyson.iquest.net> from "John S. Dyson" at Jan 19, 97 09:06:06 pm

next in thread | previous in thread | raw e-mail | index | archive | help
John S. Dyson wrote:
> > 
> > Below is a patch which seems to improve madvise MADV_FREE; stops the
> > page-ins in the example recently posted.  It also brings the call
> > closer to reliably zeroing the pages.
> > 
> Thanks for the bug report, and I will be committing a fix in a little
> while (next hour or so) for the problem.  Note that MADV_FREE does not
> guarantee that the page will be zeroed in any way.  Specificially, MADV_FREE
> allows the system to optionally dispose of the contents of the page range,
> without paging it out.  If the contents are disposed of, of course, the
> pages in the page range will be demand zeroed.
> 
> John
> dyson@freebsd.org

Can someone clarify  what PR# 1851 has to say?  Is it
possible for "random" data to be returned in some cases?  Here
is the next of the PR:

>From dtc@scrooge.ee.swin.oz.au  Sun Oct 20 07:23:39 1996
Date: Mon, 21 Oct 1996 00:25:18 +1000 (EST)
From: Douglas Thomas Crosher  <dtc@scrooge.ee.swin.oz.au>
To: FreeBSD-gnats-submit@freebsd.org
Subject: madvise MADV_FREE manual page clarification

>Number:         1851
>Category:       docs
>Synopsis:       madvise MADV_FREE manual page clarification
>Description:

>From the madvise manual page:

    "MADV_FREE gives the VM system the freedom to free pages, and tells the
     system that information in the specified page range is no longer impor-
     tant.  This is an efficient way of allowing malloc(3) to free pages any-
     where in the address space, while keeping the address space valid.  The
     next time that the page is referenced, the page might be demand zeroed,
     or might contain the data that was there before the MADV_FREE call. ..."

I have a slight query on the behaviour of MADV_FREE. My initial
interpretation was that after a MADV_FREE a page would either be zero
filled or remain unchanged. However I found that pages could have
different data in them after the MADV_FREE call.

>How-To-Repeat:

I've seen this behaviour while experimenting with page freeing
strategies for a garbage collector for CMUCL.  I tried to zero fill
the pages then call madvise MADV_FREE in the hope they would be zero
the next time there were accessed, however some pages were not zero
filled.

>Fix:
	
Perhaps the documentation could be made a little clearer, I suggest:
"... The next time that the page is referenced, the page might be
demand zeroed, or might contain random data."

>Audit-Trail:

From: Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To: dtc@scrooge.ee.swin.oz.au (Douglas Thomas Crosher)
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: docs/1851: madvise MADV_FREE manual page clarification
Date: Sun, 20 Oct 1996 19:29:12 +0100 (MET)

 > I have a slight query on the behaviour of MADV_FREE. My initial
 > interpretation was that after a MADV_FREE a page would either be zero
 > filled or remain unchanged. However I found that pages could have
 > different data in them after the MADV_FREE call.
 ...
 > 	
 > Perhaps the documentation could be made a little clearer, I suggest:
 > "... The next time that the page is referenced, the page might be
 > demand zeroed, or might contain random data."
 
 One thing I would like is to have a slightly different version of
 MADV_FREE which _guarantees_ the page to be zero-filled on demand. John
 Dyson said it would not hard at all (if I only knew how... :)
 
 	Luigi
 ====================================================================
 Luigi Rizzo                     Dip. di Ingegneria dell'Informazione
 email: luigi@iet.unipi.it       Universita' di Pisa
 tel: +39-50-568533              via Diotisalvi 2, 56126 PISA (Italy)
 fax: +39-50-568522              http://www.iet.unipi.it/~luigi/
 ====================================================================
-- 
Mike Pritchard
mpp@FreeBSD.org
"Go that way.  Really fast.  If something gets in your way, turn"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701260231.SAA10393>