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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
f82dc053
Commit
f82dc053
authored
Dec 24, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
dfd6b518
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
bigfile/virtmem.c
bigfile/virtmem.c
+20
-7
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+0
-7
No files found.
bigfile/virtmem.c
View file @
f82dc053
...
@@ -44,6 +44,7 @@ static void page_del(Page *page);
...
@@ -44,6 +44,7 @@ static void page_del(Page *page);
static
void
*
vma_page_addr
(
VMA
*
vma
,
Page
*
page
);
static
void
*
vma_page_addr
(
VMA
*
vma
,
Page
*
page
);
static
pgoff_t
vma_addr_fpgoffset
(
VMA
*
vma
,
uintptr_t
addr
);
static
pgoff_t
vma_addr_fpgoffset
(
VMA
*
vma
,
uintptr_t
addr
);
static
void
vma_mmap_page
(
VMA
*
vma
,
Page
*
page
);
static
void
vma_mmap_page
(
VMA
*
vma
,
Page
*
page
);
static
int
vma_page_infilerange
(
VMA
*
vma
,
Page
*
page
);
static
int
vma_page_ismapped
(
VMA
*
vma
,
Page
*
page
);
static
int
vma_page_ismapped
(
VMA
*
vma
,
Page
*
page
);
static
void
vma_page_ensure_unmapped
(
VMA
*
vma
,
Page
*
page
);
static
void
vma_page_ensure_unmapped
(
VMA
*
vma
,
Page
*
page
);
static
void
vma_page_ensure_notmappedrw
(
VMA
*
vma
,
Page
*
page
);
static
void
vma_page_ensure_notmappedrw
(
VMA
*
vma
,
Page
*
page
);
...
@@ -283,7 +284,7 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
...
@@ -283,7 +284,7 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
page
=
list_entry
(
hpage
,
typeof
(
*
page
),
in_dirty
);
page
=
list_entry
(
hpage
,
typeof
(
*
page
),
in_dirty
);
BUG_ON
(
page
->
state
!=
PAGE_DIRTY
);
BUG_ON
(
page
->
state
!=
PAGE_DIRTY
);
if
(
!
(
pgoffset
<=
page
->
f_pgoffset
&&
page
->
f_pgoffset
<
pgoffset
+
pglen
))
if
(
!
vma_page_infilerange
(
vma
,
page
))
continue
;
/* page is out of requested mmap coverage */
continue
;
/* page is out of requested mmap coverage */
// XXX notify watcher that we mmap RAM page in its range? -> no need
// XXX notify watcher that we mmap RAM page in its range? -> no need
...
@@ -889,8 +890,12 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
...
@@ -889,8 +890,12 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
if
(
fileh
->
mmap_overlay
)
{
if
(
fileh
->
mmap_overlay
)
{
list_for_each
(
hmmap
,
&
fileh
->
mmaps
)
{
list_for_each
(
hmmap
,
&
fileh
->
mmaps
)
{
VMA
*
vma2
=
list_entry
(
hmmap
,
typeof
(
*
vma2
),
same_fileh
);
VMA
*
vma2
=
list_entry
(
hmmap
,
typeof
(
*
vma2
),
same_fileh
);
if
(
vma2
!=
vma
)
if
(
vma2
==
vma
)
vma_mmap_page
(
vma2
,
page
);
continue
;
if
(
!
vma_page_infilerange
(
vma2
,
page
))
continue
;
/* page is out of vma2 file-range coverage */
vma_mmap_page
(
vma2
,
page
);
}
}
}
}
...
@@ -1092,15 +1097,23 @@ static void vma_mmap_page(VMA *vma, Page *page) {
...
@@ -1092,15 +1097,23 @@ static void vma_mmap_page(VMA *vma, Page *page) {
}
}
}
}
/* is `page
` mapped to
`vma` */
/* is `page
->fpgoffset` belongs to file-range covered by
`vma` */
static
int
vma_page_i
smapped
(
VMA
*
vma
,
Page
*
page
)
static
int
vma_page_i
nfilerange
(
VMA
*
vma
,
Page
*
page
)
{
{
pgoff_t
vma_fpgstop
;
pgoff_t
vma_fpgstop
;
ASSERT
(
vma
->
fileh
==
page
->
fileh
);
ASSERT
(
vma
->
fileh
==
page
->
fileh
);
vma_fpgstop
=
vma_addr_fpgoffset
(
vma
,
vma
->
addr_stop
);
vma_fpgstop
=
vma_addr_fpgoffset
(
vma
,
vma
->
addr_stop
);
if
(
!
(
vma
->
f_pgoffset
<=
page
->
f_pgoffset
&&
return
(
vma
->
f_pgoffset
<=
page
->
f_pgoffset
&&
page
->
f_pgoffset
<
vma_fpgstop
))
page
->
f_pgoffset
<
vma_fpgstop
);
}
/* is `page` mapped to `vma` */
static
int
vma_page_ismapped
(
VMA
*
vma
,
Page
*
page
)
{
ASSERT
(
vma
->
fileh
==
page
->
fileh
);
if
(
!
vma_page_infilerange
(
vma
,
page
))
return
0
;
return
0
;
return
bitmap_test_bit
(
vma
->
page_ismappedv
,
page
->
f_pgoffset
-
vma
->
f_pgoffset
);
return
bitmap_test_bit
(
vma
->
page_ismappedv
,
page
->
f_pgoffset
-
vma
->
f_pgoffset
);
...
...
wcfs/internal/wcfs_virtmem.cpp
View file @
f82dc053
...
@@ -505,17 +505,10 @@ void _Mapping::unmap() {
...
@@ -505,17 +505,10 @@ void _Mapping::unmap() {
FileH
f
=
mmap
->
fileh
;
FileH
f
=
mmap
->
fileh
;
//f->_mmaps.remove(mmap);
//f->_mmaps.remove(mmap);
printf
(
"
\n
before remove %p:
\n
"
,
mmap
.
_ptr
());
for
(
auto
x
:
f
->
_mmaps
)
printf
(
"
\t
%p
\n
"
,
x
.
_ptr
());
// FIXME keep mmaps sorted
// FIXME keep mmaps sorted
f
->
_mmaps
.
erase
(
f
->
_mmaps
.
erase
(
std
::
remove
(
f
->
_mmaps
.
begin
(),
f
->
_mmaps
.
end
(),
mmap
),
std
::
remove
(
f
->
_mmaps
.
begin
(),
f
->
_mmaps
.
end
(),
mmap
),
f
->
_mmaps
.
end
());
f
->
_mmaps
.
end
());
printf
(
"
\n
after remove:
\n
"
);
for
(
auto
x
:
f
->
_mmaps
)
printf
(
"
\t
%p
\n
"
,
x
.
_ptr
());
}
}
...
...
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