Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
0ff122c6
Commit
0ff122c6
authored
Jul 10, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ccf4b8b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
9 deletions
+31
-9
bigfile/tests/test_virtmem.c
bigfile/tests/test_virtmem.c
+8
-0
bigfile/virtmem.c
bigfile/virtmem.c
+23
-9
No files found.
bigfile/tests/test_virtmem.c
View file @
0ff122c6
...
...
@@ -1411,8 +1411,11 @@ void test_file_access_mmapbase(void)
/* discard - changes should go away */
diag
(
"discard"
);
fprintf
(
stderr
,
"
\n\n\n\n
"
);
fileh_dirty_discard
(
fh
);
CHECK_NOPAGE
(
100
);
ok1
(
!
M
(
vma
,
0
));
CHECK_NOPAGE
(
100
);
ok1
(
!
M
(
vma
,
1
));
CHECK_NOPAGE
(
101
);
ok1
(
!
M
(
vma
,
2
));
CHECK_NOPAGE
(
102
);
...
...
@@ -1423,6 +1426,11 @@ void test_file_access_mmapbase(void)
ok1
(
!
M
(
vma2
,
2
));
ok1
(
!
M
(
vma2
,
3
));
CHECK_MRU
(
/*empty*/
);
CHECK_DIRTY
(
/*empty*/
);
// XXX read vma[0] (and other discarded pages) gives pristine data
// XXX writeout STORE, MARK, STORE+MARK
...
...
bigfile/virtmem.c
View file @
0ff122c6
...
...
@@ -39,6 +39,7 @@
static
size_t
page_size
(
const
Page
*
page
);
static
void
page_drop_memory
(
Page
*
page
);
static
void
page_del
(
Page
*
page
);
static
void
*
vma_page_addr
(
VMA
*
vma
,
Page
*
page
);
static
pgoff_t
vma_addr_fpgoffset
(
VMA
*
vma
,
uintptr_t
addr
);
static
void
vma_mmap_page
(
VMA
*
vma
,
Page
*
page
);
...
...
@@ -195,9 +196,10 @@ void fileh_close(BigFileH *fileh)
* currently being done in another thread */
BUG_ON
(
page
->
state
==
PAGE_LOADING
);
page_drop_memory
(
page
);
list_del
(
&
page
->
lru
);
bzero
(
page
,
sizeof
(
*
page
));
/* just in case */
free
(
page
);
page_del
(
page
);
// list_del(&page->lru);
// bzero(page, sizeof(*page)); /* just in case */
// free(page);
}
BUG_ON
(
!
list_empty
(
&
fileh
->
dirty_pages
));
...
...
@@ -468,7 +470,10 @@ void fileh_dirty_discard(BigFileH *fileh)
page
=
list_entry
(
hpage
,
typeof
(
*
page
),
in_dirty
);
BUG_ON
(
page
->
state
!=
PAGE_DIRTY
);
fprintf
(
stderr
,
"discard p%ld
\n
"
,
page
->
f_pgoffset
);
page_drop_memory
(
page
);
page_del
(
page
);
// XXX wcfs: remmap page(s) to base file
}
...
...
@@ -768,9 +773,10 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
* removed it from pagemap */
if
(
page
->
state
==
PAGE_LOADING_INVALIDATED
)
{
page_drop_memory
(
page
);
list_del
(
&
page
->
lru
);
bzero
(
page
,
sizeof
(
*
page
));
/* just in case */
free
(
page
);
page_del
(
page
);
// list_del(&page->lru);
// bzero(page, sizeof(*page)); /* just in case */
// free(page);
}
/* else just mark the page as loaded ok */
...
...
@@ -879,9 +885,10 @@ static int __ram_reclaim(RAM *ram)
/* delete page & its entry in fileh->pagemap */
pagemap_del
(
&
page
->
fileh
->
pagemap
,
page
->
f_pgoffset
);
list_del
(
&
page
->
lru
);
bzero
(
page
,
sizeof
(
*
page
));
/* just in case */
free
(
page
);
page_del
(
page
);
// list_del(&page->lru);
// bzero(page, sizeof(*page)); /* just in case */
// free(page);
}
}
...
...
@@ -966,6 +973,13 @@ static void page_drop_memory(Page *page)
// XXX touch lru?
}
/* page_del deletes Page struct (but not page memory - see page_drop_memory). */
static
void
page_del
(
Page
*
page
)
{
list_del
(
&
page
->
lru
);
bzero
(
page
,
sizeof
(
*
page
));
/* just in case */
free
(
page
);
}
/* vma: page -> addr where it should-be mmaped in vma */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment