Question: madvise(DONT_SYNC)
From: Rob Landley
Date: Sun Nov 27 2005 - 20:34:39 EST
I remember long ago a discussion about soft pinning of pages. Not actually
locking them into memory but just letting the VM know that when they get
dirtied there's no need to ever write them out in the absence of memory
pressure.
I don't remember how the discussion resolved, and I can't find anything that
looks like MADV_NOSYNC in mman.h in the 2.6.15-rc2 headers.
I bring this up because User Mode Linux could use this behavior. Under 2.4 it
could get nosync file backed memory by simply deleting the file after mmaping
it, but that hack was taken out in 2.6 and now you have to use a tmpfs mount
to avoid a really nasty behavior (where every page you dirty gets written out
and something like a kernel compile will peg the disk doing unnecessary
writes for minutes at a time, which isn't fun even with CFQ).
UML is currently written on the assumption that tmpfs will be mounted on /tmp,
but the only distribution I've been able to find that actually does that by
default is knoppix (not because anything is mounted on /tmp, but because / is
a union mount of iso9660 and tmpfs). Fedora Core 4, Ubuntu, Gentoo all have
tmpfs inheriting / (which is generally ext3).
Needing root access to set up the host system so that UML is usable defeats
half the advantage it has over Xen, for my use cases.
I can change the default to /dev/pts (which is tmpfs with the sticky bit on
Fedora Core 4, Ubuntu, and Gentoo. But which has nothing mounted on it and
isn't even world writable on the only x86-64 system I currently have access
to, which is running PLD Linux...) But if the madvise worked its mmap file
could just be in the user's home directory, and it wouldn't need to hunt for
a tmpfs mount at all...
Rob
--
Steve Ballmer: Innovation! Inigo Montoya: You keep using that word.
I do not think it means what you think it means.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/