Commit c8e1cb33 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6f4229db
......@@ -1386,7 +1386,6 @@ void test_file_access_mmapoverlay(void)
xmunmap(b0, PS);
xmunmap(b2, PS);
// XXX verify notify_munmap was correctly called
/* map vma back - dirty pages should be there _and_ mapped to vma.
* (this differs from !wcfs case which does not mmap dirty pages until access) */
......
......@@ -707,16 +707,43 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
page = pagemap_get(&fileh->pagemap, pagen);
/* wcfs: all dirty pages are mmapped when vma is created.
* thus here, if page is present in pagemap, it can be only either
* thus here, normally, if page is present in pagemap, it can be only either
* - a page we just loaded for dirtying, or
* - a page that is in progress of being loaded.
*
* however it can be also a *dirty* page due to simultaneous write
* access from 2 threads:
*
* T1 T2
*
* write pagefault write pagefault
* virt_lock
* page.state = PAGE_LOADING
* virt_unlock
* # start loading the page
* ...
* # loading completed
* virt_lock
* page.state = PAGE_LOADED_FOR_WRITE
* virt_unlock
* return VM_RETRY
* virt_lock
* # sees page.state = PAGE_LOADED_FOR_WRITE
* page.state = PAGE_DIRTY
* virt_unlock
*
* # retrying
* virt_lock
* # sees page.state = PAGE_DIRTY <--
*
*
* ( PAGE_LOADED_FOR_WRITE is used only to verify that in wcfs mode we
* always keep all dirty pages mmapped on fileh_open and so pagefault
* handler must not see a PAGE_LOADED page. )
*/
if (fileh->mmap_overlay && page)
ASSERT(page->state == PAGE_LOADED_FOR_WRITE || page->state == PAGE_LOADING);
ASSERT(page->state == PAGE_LOADED_FOR_WRITE || page->state == PAGE_LOADING ||
page->state == PAGE_DIRTY);
/* (4) no page found - allocate new from ram */
while (!page) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment