lkml.org 
[lkml]   [2004]   [Jan]   [14]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 14 Jan 2004 14:32:21 -0800
FromAndrew Morton <>
SubjectRe: [RFC] /dev/anon
Davide Libenzi <davidel@xmailserver.org> wrote:
>
> On Wed, 14 Jan 2004, Jeff Dike wrote:
>
> > > I thought your goal was to release memory
> > > to the host, that's why I proposed sys_madvise(MADV_DONTNEED).
> >
> > It is, I want memory released immediately as though it were clean, and
> > MADV_DONTNEED doesn't help.
>
> Strange, I didn't notice this before. If you look at the comment in
> mm/madvise.c:madvise_dontneed, it advertises that dirty pages are actually
> thrown away (that would be what you're actually looking for). But if you
> go down to zap_page_range -> unmap_vmas -> unmap_page_range ->
> zap_pmd_range -> zap_pte_range, if the page is dirty, set_page_dirty ->
> __set_page_dirty_buffers pushes the page into the mapping dirty pages list
> and __mark_inode_dirty push the inode inside the superblock dirty list. So
> the comment seems to be wrong (I also verified this with a simple program,
> and pages are actually flushed).
>

We cannot invalidate the pages due to MADV_DONTNEED: there may be
freshly-allocated, unwritten file blocks associated with them. You'd have
to be playing games with write() amd MAP_SHARED to do this.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:00    [from the cache]
©2003-2009