Messages in this thread | | | Date | Mon, 12 Apr 2010 14:40:22 -0400 | From | Rik van Riel <> | Subject | Re: [PATCH -v2] rmap: make anon_vma_prepare link in all the anon_vmas of a mergeable VMA |
| |
On 04/12/2010 12:26 PM, Linus Torvalds wrote:
> But there is a _much_ more subtle case that involved swapping. > > So guys, here's my fairly simple theory on what happens:
That bug looks entirely possible. Given that Borislav has heavy swapping going on, it is quite possible that this is the bug he has been triggering.
> The patch below is my largely mindless try at fixing this. It's untested. > I'm not entirely sure that it actually works. But it makes some amount of > conceptual sense. No?
The patch would help avoid the bug you described.
It does have the drawback of moving all the pages of child processes back into the anon_vma of the parent process after swapin, even if they are privately owned pages by the child process.
I am guessing it may need a check to see whether the page and swap slot are exclusively owned by the current process.
Page or swap slot shared? => oldest anon_vma Page and swap slot exclusive? => newest anon_vma
I suspect the easiest way to achieve this would be to pass a flag in from do_swap_page, where we already check this, a few lines above calling page_add_anon_rmap:
if ((flags & FAULT_FLAG_WRITE) && reuse_swap_page(page)) { pte = maybe_mkwrite(pte_mkdirty(pte), vma); flags &= ~FAULT_FLAG_WRITE; }
| |