From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: linux-kernel@vger.kernel.org
Subject: wrong madvise(MADV_DONTNEED) semantic
Date: Tue, 28 Jun 2005 15:43:16 +0200 [thread overview]
Message-ID: <20050628134316.GS5044@implementation.labri.fr> (raw)
Hi,
There is something wrong with the current madvise(MADV_DONTNEED)
implementation. Both the manpage and the source code says that
MADV_DONTNEED means that the application does not care about the data,
so it might be thrown away by the kernel. But that's not what posix
says:
http://www.opengroup.org/onlinepubs/009695399/functions/posix_madvise.html
It says that "The posix_madvise() function shall have no effect on the
semantics of access to memory in the specified range". I.e. the data
that was recorded shall be saved!
The current linux implementation of MADV_DONTNEED is rather an
implementation of solaris' MADV_FREE, see its manpage:
http://docs.sun.com/app/docs/doc/816-5168/6mbb3hrde?a=view
Hence the current madvise_dontneed() implementation could be renamed
into madvise_free() and the appropriate MADV_FREE case be added, while
a new implementation of madvise_dontneed() _needs_ be written. It may
for instance go through the range so as to zap clean pages (since it is
safe), and set dirty pages as being least recently used so that they
will be considered as good candidates for eviction.
(And the manpage should get corrected too)
Regards,
Samuel Thibault
next reply other threads:[~2005-06-28 14:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-28 13:43 Samuel Thibault [this message]
2005-06-28 14:38 ` [Patch] Hotfix for Re: wrong madvise(MADV_DONTNEED) semantic Jörn Engel
2005-06-28 18:16 ` Andy Isaacson
2005-06-28 18:28 ` Robert Love
2005-06-28 18:53 ` Andy Isaacson
2005-06-28 19:23 ` Robert Love
2005-06-28 19:41 ` Samuel Thibault
2005-06-28 20:03 ` Jörn Engel
2005-06-28 20:05 ` Robert Love
2005-06-28 20:17 ` Jörn Engel
2005-06-28 20:20 ` Samuel Thibault
2005-06-28 20:30 ` Jörn Engel
2005-06-28 20:37 ` Andy Isaacson
2005-07-05 23:39 ` Darren Hart
2005-06-29 16:53 ` wrong madvise(MADV DONTNEED) semantic Michael Kerrisk
2005-06-29 17:22 ` Jamie Lokier
2005-06-29 16:34 ` Michael Kerrisk
2005-06-28 18:54 ` wrong madvise(MADV_DONTNEED) semantic Samuel Thibault
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=20050628134316.GS5044@implementation.labri.fr \
--to=samuel.thibault@ens-lyon.org \
--cc=linux-kernel@vger.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