I’m trying to track down unwanted dirty pages in small binaries on Linux x86. The whole binary is less than a 4k page (it’s compiled without glibc). On my laptop running a 2.6.32 kernel, .text shows up in /proc/$pid/smaps as Private_Clean: 4 and Private_Dirty: 0, as expected, but on my server with 2.6.36, .text is Private_Dirty: 4. Any idea what could cause this? As far as I know, no address layout randomization or similar is in effect (I’ve disabled all related settings that I know of). Any idea what could be dirtying the program’s .text?
Edit:
$ strace ~/em2
execve("/home/R/em2", ["/home/R/em2"], [/* 28 vars */]) = 0
nanosleep({100000, 0}, ^C <unfinished ...>
And….. now smaps is showing .text as Private_Clean: 4. It’s very strange, because I actually have 2 different binaries compiled on different machines that were both showing the inexplicable dirty page when run on my server, and now they’re both clean. Sorry for wasting everybody’s time. If the issue doesn’t come back, I’ll close/delete this question or whatever is appropriate since I can no longer reproduce it.
Problem solved: Apparently Linux has a “feature” (I would call it a bug) where the page shows up as
Private_Dirtyif the binary file has not yet been flushed out to disk after creating it. This is why the problem mysteriously went away after a while.