Commit 675e6415 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a0275a3c
...@@ -223,6 +223,19 @@ int M(VMA *vma, pgoff_t idx) { return bitmap_test_bit(vma->page_ismappedv, idx) ...@@ -223,6 +223,19 @@ int M(VMA *vma, pgoff_t idx) { return bitmap_test_bit(vma->page_ismappedv, idx)
ok1(!pagemap_get(&(fileh)->pagemap, (pgoffset))); \ ok1(!pagemap_get(&(fileh)->pagemap, (pgoffset))); \
} while (0) } while (0)
/* check that ram has MRU pages as specified by pagev */
void _check_mru(RAM *ram, Page *pagev[], int pagec) {
// XXX
}
// XXX + fail with line
// CHECK_MRU(ram, ...pagev)
#define CHECK_MRU(ram, ...) do { \
Page *__pagev[] = {__VA_ARGS__}; \
_check_mru(ram, __pagev, ARRAY_SIZE(__pagev)); \
} while(0)
/* vma_on_pagefault() assumes virtmem_lock is taken by caller and can ask it to /* vma_on_pagefault() assumes virtmem_lock is taken by caller and can ask it to
* retry. Handle fault to the end, like on_pagefault() does. */ * retry. Handle fault to the end, like on_pagefault() does. */
...@@ -450,11 +463,13 @@ void test_file_access_synthetic(void) ...@@ -450,11 +463,13 @@ void test_file_access_synthetic(void)
ok1(B(vma, 3*PSb + 1) == 103); ok1(B(vma, 3*PSb + 1) == 103);
ok1(B(vma, 3*PSb + PSb - 1) == 103); ok1(B(vma, 3*PSb + PSb - 1) == 103);
CHECK_MRU(ram, page0, page3, page2); /* page0 became MRU */
ok1(ram->lru_list.prev == &page0->lru); /* page0 became MRU */ ok1(ram->lru_list.prev == &page0->lru); /* page0 became MRU */
ok1(page0->lru.prev == &page3->lru); ok1(page0->lru.prev == &page3->lru);
ok1(page3->lru.prev == &page2->lru); ok1(page3->lru.prev == &page2->lru);
ok1(page2->lru.prev == &ram->lru_list); ok1(page2->lru.prev == &ram->lru_list);
//CHECK_DIRTY(fh, page0, page2);
ok1(fh->dirty_pages.prev == &page0->in_dirty); ok1(fh->dirty_pages.prev == &page0->in_dirty);
ok1(page0->in_dirty.prev == &page2->in_dirty); ok1(page0->in_dirty.prev == &page2->in_dirty);
ok1(page2->in_dirty.prev == &fh->dirty_pages); ok1(page2->in_dirty.prev == &fh->dirty_pages);
...@@ -1276,6 +1291,8 @@ void test_file_access_mmapbase(void) ...@@ -1276,6 +1291,8 @@ void test_file_access_mmapbase(void)
ok1(B(vma, 2*PSb + 1) == 102); ok1(B(vma, 2*PSb + 1) == 102);
ok1(B(vma, 2*PSb + PSb - 1) == 102); ok1(B(vma, 2*PSb + PSb - 1) == 102);
CHECK_MRU(ram, page2);
//CHECK_DIRTY(fh, page2);
ok1(ram->lru_list.prev == &page2->lru); ok1(ram->lru_list.prev == &page2->lru);
ok1(page2->lru.prev == &ram->lru_list); ok1(page2->lru.prev == &ram->lru_list);
...@@ -1317,7 +1334,7 @@ int main() ...@@ -1317,7 +1334,7 @@ int main()
{ {
tap_fail_callback = abort; // XXX to catch failure immediately tap_fail_callback = abort; // XXX to catch failure immediately
if (0) { if (1) {
test_vmamap(); test_vmamap();
test_file_access_synthetic(); test_file_access_synthetic();
test_file_access_pagefault(); test_file_access_pagefault();
......
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