public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* wrong madvise(MADV_DONTNEED) semantic
@ 2005-06-28 13:43 Samuel Thibault
  2005-06-28 14:38 ` [Patch] Hotfix for " Jörn Engel
  2005-06-28 18:16 ` Andy Isaacson
  0 siblings, 2 replies; 18+ messages in thread
From: Samuel Thibault @ 2005-06-28 13:43 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2005-07-05 23:42 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-28 13:43 wrong madvise(MADV_DONTNEED) semantic Samuel Thibault
2005-06-28 14:38 ` [Patch] Hotfix for " 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox