Re: mmap() versus read()

Benjamin C.R. LaHaise (blah@kvack.org)
Tue, 10 Mar 1998 16:39:51 -0500 (EST)


On Tue, 10 Mar 1998, Pavel Machek wrote:

[context: paging executables from origin; why not swap?]
> Ok. Is there easy way to change it? On my system, swap is order of
> magnitude faster than disk. I would like linux to take advantage of
> it.

There isn't an easy way to change it right now, unless you want to give up
the sharing of clean pages, which is a big loss. One option will be to
take a swap backed inode (I'm using such beasts to replace the SysV shm
objects) and use it to 'cache' the executable - this would be easy enough
to accomplish, but could be a potentially heavy user of swap. It does
have the benefit of also caching normal file access... (say, NFS ;-)

Another alternative, but much more hackish and only applicable to memory
mappings: use one of the bits in a not-present page table entry to
indicate that the swap entry is still shared. Swapout will now write the
entry to swap and set this bit instead of just dumping the page.
filemap_swapin would then actually read the page from swap, rename the
page to the original inode, then scan for other ptes with the same entry
and make them points to the page. Definately hackish, and would suffer
from not keeping the same swap page. Doh. Oh well, it sounded cute. =)

-ben

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu