Hello, I just want to note the fact that although Linux got it badly wrong, according to POSIX, MADV_DONTNEED is _not_ supposed to drop the content of the memory, but just to tune the write-back heuristics and such. (see glibc's ./sysdeps/unix/sysv/linux/posix_madvise.c if you're not convinced)
qemu should probably try to use MADV_REMOVE (proper linux variant) or MADV_FREE (solaris variant). Samuel