Bug 6282 - wrong madvise(MADV_DONTNEED) semantic
Summary: wrong madvise(MADV_DONTNEED) semantic
Status: ASSIGNED
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Natalie Protasevich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-24 14:42 UTC by Samuel Thibault
Modified: 2014-08-11 20:40 UTC (History)
2 users (show)

See Also:
Kernel Version: any since madvise implementation (somewhere in 2.4)
Subsystem:
Regression: No
Bisected commit-id:


Attachments
initialization dmesg (in case it can be useful) (6.49 KB, text/plain)
2006-03-25 06:37 UTC, Samuel Thibault
Details
additionnal dmesg on modprobe atyfb (984 bytes, text/plain)
2006-03-25 06:38 UTC, Samuel Thibault
Details
testcase (16.00 KB, text/plain)
2014-06-29 19:10 UTC, Samuel Thibault
Details

Description Samuel Thibault 2006-03-24 14:42:44 UTC
Hi,

That 
Comment 1 Andrew Morton 2006-03-24 14:47:32 UTC
Please take it to linux-kernel.  Include the testcase if poss, thanks.

Comment 2 Samuel Thibault 2006-03-24 14:52:27 UTC
URL of thread:
http://marc.theaimsgroup.com/?t=111996860600002&r=1&w=2&n=13
Comment 3 Samuel Thibault 2006-03-25 06:37:26 UTC
Created attachment 7667 [details]
initialization dmesg (in case it can be useful)
Comment 4 Samuel Thibault 2006-03-25 06:38:10 UTC
Created attachment 7668 [details]
additionnal dmesg on modprobe atyfb
Comment 5 Samuel Thibault 2006-03-25 06:39:14 UTC
Comment on attachment 7667 [details]
initialization dmesg (in case it can be useful)

Oops, wrong bug report
Comment 6 Samuel Thibault 2006-03-25 06:39:37 UTC
Comment on attachment 7668 [details]
additionnal dmesg on modprobe atyfb

Oops, wrong bug report
Comment 7 Samuel Thibault 2007-03-01 10:05:13 UTC
See glibc bug http://sourceware.org/bugzilla/show_bug.cgi?id=3458
Drepper "fixed" the issue for now by ignoring MADV_DONTNEED advice.
Comment 8 Samuel Thibault 2007-03-01 10:05:55 UTC
Note: that of course does not mean that we shouldn't implement something that really is what POSIX expects from MADV_DONTNEED
Comment 9 Natalie Protasevich 2008-03-20 00:40:08 UTC
Samuel, have you tried advice in #1 about posting this to LKML?
Thanks.
Comment 10 Samuel Thibault 2008-03-20 03:42:45 UTC
See  http://marc.info/?l=linux-kernel&m=114324188901936&w=2  but no luck.  There are related threads:  http://marc.info/?l=linux-kernel&m=117561753326551&w=2 http://marc.info/?l=linux-kernel&m=117626557716611&w=2 http://marc.info/?l=linux-kernel&m=117679424209965&w=2 http://marc.info/?l=linux-kernel&m=117798097213454&w=2  And they indeed agree that our MADV_DONTNEED is not POSIX and that we should add a POSIX_MADV_DONTNEED, but don't do anything about it. So it looks like yes, the issue was raised and people know about it, but nobody really cares and glibc is still wrapping it with a nop... 
Comment 11 xerofoify 2014-06-25 18:58:15 UTC
This bug is very old. Please try on newer kernel.
Cheers Nick
Comment 12 Samuel Thibault 2014-06-29 19:10:24 UTC
Created attachment 141411 [details]
testcase

Hello,

Yes, this is still a problem on Linux 3.15.  I have attached again the
testcase, which is still emitting "FAILED".

Samuel
Comment 13 xerofoify 2014-08-08 19:29:54 UTC
I have read your test case and would like to known on what lines it's failing or does it just fail all togethor.
Nick
Comment 14 Samuel Thibault 2014-08-11 20:40:09 UTC
Here is the output I get:

c = 00204a16      file msync:  NO madvise:  NO ok
c = 05542a27      file msync: YES madvise:  NO ok
c = 169c39e2      file msync:  NO madvise: YES FAILED
c = 2eab4956      file msync: YES madvise: YES FAILED
c = 0bb0b8b4 anonymous msync:  NO madvise:  NO ok
c = 0bd068c9 anonymous msync: YES madvise:  NO ok
c = 3e5d224d anonymous msync:  NO madvise: YES FAILED
c = 436c8d9c anonymous msync: YES madvise: YES FAILED

Whenever madvise(MADV_DONTNEED) is called, the value of the cookie gets
lost.

Note You need to log in before you can comment on or make changes to this bug.