Commit d3fe8249 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 38c08e6e
...@@ -1183,6 +1183,7 @@ void test_file_access_mmapbase(void) ...@@ -1183,6 +1183,7 @@ void test_file_access_mmapbase(void)
VMA vma_struct, *vma = &vma_struct; VMA vma_struct, *vma = &vma_struct;
// Page *page0, *page2, *page3; // Page *page0, *page2, *page3;
Page *page0, *page2; Page *page0, *page2;
blk_t *b0, *b2;
size_t PS, PSb; size_t PS, PSb;
int fd, err; int fd, err;
...@@ -1314,6 +1315,43 @@ void test_file_access_mmapbase(void) ...@@ -1314,6 +1315,43 @@ void test_file_access_mmapbase(void)
CHECK_MRU (page0, page2); CHECK_MRU (page0, page2);
CHECK_DIRTY (page0, page2); CHECK_DIRTY (page0, page2);
/* unmap vma - dirty pages should stay in fh->pagemap and memory should
* not be forgotten */
diag("vma_unmap");
vma_unmap(vma);
ok1(list_empty(&fh->mmaps));
CHECK_PAGE (page0, 100, PAGE_DIRTY, 0);
CHECK_NOPAGE( 101 );
CHECK_PAGE (page2, 102, PAGE_DIRTY, 0);
CHECK_NOPAGE( 103 );
CHECK_MRU (page0, page2);
CHECK_DIRTY (page0, page2);
b0 = page_mmap(page0, NULL, PROT_READ); ok1(b0);
b2 = page_mmap(page2, NULL, PROT_READ); ok1(b2);
ok1(b0[0] == 10);
ok1(b0[1] == 100);
ok1(b0[PSb - 1] == 100);
ok1(b2[0] == 12);
ok1(b2[1] == 102);
ok1(b2[PSb - 1] == 102);
xmunmap(b0, PS);
xmunmap(b2, PS);
// XXX verify notify_munmap was correctly called
#undef CHECK_MRU #undef CHECK_MRU
#undef CHECK_PAGE #undef CHECK_PAGE
#undef CHECK_NOPAGE #undef CHECK_NOPAGE
......
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