Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Jul 2005 21:32:12 -0400
From:      Garrett Wollman <wollman@csail.mit.edu>
To:        Giorgos Keramidas <keramida@freebsd.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: mmap bug?
Message-ID:  <17133.31644.343077.241748@khavrinen.csail.mit.edu>
In-Reply-To: <20050731224601.GA2024@gothmog.gr>
References:  <20050731141801.GA49300@gothmog.gr> <84dead7205073108564f71f1ab@mail.gmail.com> <20050731160853.GC49839@gothmog.gr> <84dead720507311115290f0140@mail.gmail.com> <20050731201858.GC1052@gothmog.gr> <17133.21281.703540.383144@khavrinen.csail.mit.edu> <20050731224601.GA2024@gothmog.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Mon, 1 Aug 2005 01:46:01 +0300, Giorgos Keramidas <keramida@freebsd.org> said:

> Is the fact that the data written to the mapped region visible after the
> close (by mapping the same region) expected too?

No, that's a bug.  (It's not a particularly surprising one, although
I'm no VM expert and I have no idea how difficult it would be to fix.)
The problem is that the VM system has no efficient way of telling that
you modified the part of the page that's after the end of the file, so
when you close the file, the dirty but only partially valid page is
cached.  Because you did a MAP_SHARED, mmap() can't use an anonymous
page -- it has to use the actual page from the file.  If the page
isn't in cache, it will correctly zero-fill the parts beyond the end
of the file, but it doesn't appear to do this for cached pages on
0->1 refcount transitions.

-GAWollman




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