linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Susi <psusi@ubuntu.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-mm@kvack.org, Minchan Kim <minchan@kernel.org>
Subject: Re: POSIX_FADV_DONTNEED implemented wrong
Date: Fri, 22 Feb 2013 16:52:55 -0500	[thread overview]
Message-ID: <5127E8B7.9080202@ubuntu.com> (raw)
In-Reply-To: <20130222202921.GB4824@cmpxchg.org>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/22/2013 3:29 PM, Johannes Weiner wrote:
>> 1)  It is completely useless for writing files.  This hint
>> should allow a program generating lots of writes to files that
>> will not likely be read again to reduce the cache pressure that
>> causes.
> 
> Wouldn't direct IO make more sense in that case?

It could, but doing direct aio is a lot more complicated than just using
posix_fadvise. Also it has problem #3: even if it is unlikely, it
*may* be used again, so it makes sense to cache it if we have plenty
of ram.

> Minchan worked on deactivating pages on truncation.  Maybe all it 
> takes is to implement deactivate_mapping_range() or something to 
> combine a page cache walk with deactivate_page().

Looks like a good idea!

> While you are at it, madvise(MADV_DONTNEED) does not do anything
> to the page cache, but it probably should.  :-)

It seems to be implemented by discarding the pages, even if dirty.
This also seems to be wrong.  According to posix, this is a hint that
it will not access the pages again any time *soon*, not that the data
will never be needed again and so it can be discarded.

It looks like MADV_SEQUENTIAL is missing the second part of its
implementation: making sure the pages will be discarded soon after
they are accessed.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRJ+i3AAoJEJrBOlT6nu759/IIAMbFAjJGmI7hkpt1GMtUfty8
n72BoygV3bDULpZ8BybJonRfiVw/ze9sVf6KhojB2dm9bvdZHl11DDGvf9Ro8OSr
dcjWUQxbHzuzGtUtnUEZPOAj6Ux6cetBtmjUxjnLyJrijK+W+cEHzWnzUZXWddlo
XcPe3IHNmj7YlTH+tcPevLCeTlzfFkjq/t4JXuZWmFW97MmMe5wTCScS0eiBYpHM
SVVL+VJ8TPG9Hnk/9oP0RqAyg+SjshGfaqhM8mTFvS4FtMbp/gXFz8GnewxG322h
ZdgwZqafiWsNeC8KitcTwKlxMU5fWFDLfHXKoFWgX2P7hVh8zJ9T6Ugi4KeaAN4=
=RFzN
-----END PGP SIGNATURE-----

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2013-02-22 21:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-22 19:57 Phillip Susi
2013-02-22 20:29 ` Johannes Weiner
2013-02-22 21:52   ` Phillip Susi [this message]
2013-02-23 22:57     ` [PATCH 0/2] FADV_DONTNEED and FADV_NOREUSE Phillip Susi
2013-02-23 22:58     ` [PATCH 1/2] mm: fadvise: fix POSIX_FADV_DONTNEED Phillip Susi
2013-02-24  1:46       ` Dave Hansen
2013-02-24  3:37         ` Phillip Susi
2013-02-24 18:24           ` Dave Hansen
2013-02-24 20:40             ` Phillip Susi
2013-02-24 21:25               ` Dave Hansen
2013-02-24 22:38                 ` Phillip Susi
2013-02-25 17:50                   ` Dave Hansen
2013-02-24  3:58       ` Zheng Liu
2013-02-24  4:04         ` Phillip Susi
2013-02-26  4:21       ` Minchan Kim
2013-02-26 14:06         ` Andrea Righi
2013-02-26 15:39           ` Phillip Susi
2013-02-23 22:58     ` [PATCH 2/2] mm: fadvise: implement POSIX_FADV_NOREUSE Phillip Susi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5127E8B7.9080202@ubuntu.com \
    --to=psusi@ubuntu.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox