Commit 3a82b464 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b24422e5
...@@ -471,8 +471,8 @@ void fileh_dirty_discard(BigFileH *fileh) ...@@ -471,8 +471,8 @@ void fileh_dirty_discard(BigFileH *fileh)
BUG_ON(page->state != PAGE_DIRTY); BUG_ON(page->state != PAGE_DIRTY);
fprintf(stderr, "discard p%ld\n", page->f_pgoffset); fprintf(stderr, "discard p%ld\n", page->f_pgoffset);
pagemap_del(&fileh->pagemap, page->f_pgoffset);
page_drop_memory(page); page_drop_memory(page);
page_del(page); page_del(page);
// XXX wcfs: remmap page(s) to base file // XXX wcfs: remmap page(s) to base file
} }
...@@ -515,6 +515,8 @@ void fileh_invalidate_page(BigFileH *fileh, pgoff_t pgoffset) ...@@ -515,6 +515,8 @@ void fileh_invalidate_page(BigFileH *fileh, pgoff_t pgoffset)
/* else we just make sure to drop page memory */ /* else we just make sure to drop page memory */
else { else {
page_drop_memory(page); page_drop_memory(page);
// XXX + page_del ?
// XXX + pagemap_del ?
} }
} }
...@@ -774,6 +776,7 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write) ...@@ -774,6 +776,7 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
if (page->state == PAGE_LOADING_INVALIDATED) { if (page->state == PAGE_LOADING_INVALIDATED) {
page_drop_memory(page); page_drop_memory(page);
page_del(page); page_del(page);
// XXX + pagemap_del ?
// list_del(&page->lru); // list_del(&page->lru);
// bzero(page, sizeof(*page)); /* just in case */ // bzero(page, sizeof(*page)); /* just in case */
// free(page); // free(page);
...@@ -880,6 +883,7 @@ static int __ram_reclaim(RAM *ram) ...@@ -880,6 +883,7 @@ static int __ram_reclaim(RAM *ram)
} }
/* PAGE_EMPTY pages without mappers go away */ /* PAGE_EMPTY pages without mappers go away */
// XXX merge vvv with ^^^ : page_drop_memory + pagemap_del + page_del
if (page->state == PAGE_EMPTY) { if (page->state == PAGE_EMPTY) {
BUG_ON(page->refcnt != 0); // XXX what for then we have refcnt? -> vs discard BUG_ON(page->refcnt != 0); // XXX what for then we have refcnt? -> vs discard
...@@ -945,6 +949,7 @@ void *page_mmap(Page *page, void *addr, int prot) ...@@ -945,6 +949,7 @@ void *page_mmap(Page *page, void *addr, int prot)
} }
// XXX -> page_drop = drop memory, delete page from pagemap, delete page
static void page_drop_memory(Page *page) static void page_drop_memory(Page *page)
{ {
/* Memory for this page goes out. 1) unmap it from all mmaps */ /* Memory for this page goes out. 1) unmap it from all mmaps */
...@@ -973,8 +978,14 @@ static void page_drop_memory(Page *page) ...@@ -973,8 +978,14 @@ static void page_drop_memory(Page *page)
// XXX touch lru? // XXX touch lru?
} }
/* page_del deletes Page struct (but not page memory - see page_drop_memory). */ /* page_del deletes Page struct (but not page memory - see page_drop_memory).
*
* The page is removed from ram->lru.
*/
static void page_del(Page *page) { static void page_del(Page *page) {
BUG_ON(page->refcnt != 0);
BUG_ON(page->state == PAGE_DIRTY); // XXX + PAGE_LOADING ?
list_del(&page->lru); list_del(&page->lru);
bzero(page, sizeof(*page)); /* just in case */ bzero(page, sizeof(*page)); /* just in case */
free(page); free(page);
......
...@@ -1786,7 +1786,7 @@ def test_wcfs_watch_vs_access(): ...@@ -1786,7 +1786,7 @@ def test_wcfs_watch_vs_access():
# verify that on pin message, while under pagefault, we can mmap @at/f[blk] # verify that on pin message, while under pagefault, we can mmap @at/f[blk]
# into where head/f[blk] was mmaped; the result of original pagefaulting read # into where head/f[blk] was mmaped; the result of original pagefaulting read
# must be from newly insterted mapping. # must be from newly inserted mapping.
# #
# TODO same with two mappings to the same file, but only one changing blk mmap # TODO same with two mappings to the same file, but only one changing blk mmap
# -> one read gets changed data, one read gets data from @head. # -> one read gets changed data, one read gets data from @head.
......
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