On 12/27/06, Linus Torvalds <[email protected]> wrote: <snip>
- It never uses mprotect on the shared mappings, but it _does_ do: "mincore()" - but the return values don't much matter (it's used as a heuristic on which parts to hash, apparently) I double- and triple-checked this one, because I did make changes to "mincore()", but those didn't go into the affected kernels anyway (ie they are not in plain 2.6.19, nor in 2.6.18.3 either)
Correct, mincore is only used to check if it should delay the hash checking.
"madvise(MADV_WILLNEED)" "msync(MS_ASYNC)" (or MS_SYNC if you use a command line flag) "munmap()" of course - it never seems to mix mmap() and write() - it does _only_ mmap. - it seems to mmap/munmap the shared files in nice 64-page chunks, all 64-page aligned in the file (ie it does NOT create one big mapping, it has some kind of LRU of thse 64-page chunks). The only exception being the last chunk, which it maps byte-accurate to the size.
The length of the chunks is only page aligned on single file torrents, not so on multi-file torrents. I've attached a patch for rtorrent that will extend the length to the page boundary.
- I haven't checked whether it only ever has the same chunk mapped once at a time.
This should be the case, but two mapped chunks may share a page, sometimes with different r/w permissions. Jari Sundell
Attachment:
extend_mapping.diff
Description: Binary data
- References:
- Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- From: "Gordon Farquharson" <[email protected]>
- Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- From: Andrew Morton <[email protected]>
- Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- From: Andrei Popa <[email protected]>
- Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- From: Andrew Morton <[email protected]>
- Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- From: Andrei Popa <[email protected]>
- Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- From: Linus Torvalds <[email protected]>
- Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- From: Linus Torvalds <[email protected]>
- Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- From: Nick Piggin <[email protected]>
- Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- From: Linus Torvalds <[email protected]>
- Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- Prev by Date: limiting node (NUMA) memory
- Next by Date: Re: Oops in 2.6.19.1
- Previous by thread: Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- Next by thread: Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
- Index(es):