Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jan 1997 22:58:06 +1100 (EST)
From:      Douglas Thomas Crosher  <dtc@scrooge.ee.swin.oz.au>
To:        luigi@labinfo.iet.unipi.it (Luigi Rizzo)
Cc:        current@freebsd.org
Subject:   Re: possible madvise MADV_FREE improvement
Message-ID:  <199701201158.WAA19937@scrooge.ee.swin.oz.au>
In-Reply-To: <199701200722.IAA13617@labinfo.iet.unipi.it> from "Luigi Rizzo" at Jan 20, 97 08:22:28 am

next in thread | previous in thread | raw e-mail | index | archive | help

> > > 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,
> 
> when does the system decide for disposing the pages, and wouldn't it be
> nice (and easy to implement) to have an option to force this behaviour ?

Check the function vm_object_madvise in sys/vm/vm_object.c, the logic
is in there. I've had it working reliably zeroing pages in an
anonymous mapped region backed only by swap; the code had been doing
just this, but not reliably, until the recent improvements.

With the recent improvements it's not too much more costly to have the
application zero the page, then call madvise MADV_FREE. But be careful
the memory is not backed by a vnode else it may be read from there,
which caught me out at one point.

Regards
Douglas Crosher



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