Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
bfe77ea7
Commit
bfe77ea7
authored
May 15, 2013
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mem: Add comments
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
1c9a91a7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
mem.c
mem.c
+38
-0
No files found.
mem.c
View file @
bfe77ea7
...
...
@@ -211,6 +211,15 @@ static int page_in_parent(unsigned long vaddr, u64 map, struct mem_snap_ctx *sna
return
0
;
}
/*
* This routine finds out what memory regions to grab from the
* dumpee. The iovs generated are then fed into vmsplice to
* put the memory into the page-pipe's pipe.
*
* "Holes" in page-pipe are regions, that should be dumped, but
* the memory contents is present in the pagent image set.
*/
static
int
generate_iovs
(
struct
vma_area
*
vma
,
int
pagemap
,
struct
page_pipe
*
pp
,
u64
*
map
,
struct
mem_snap_ctx
*
snap
)
{
...
...
@@ -310,6 +319,10 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
pr_debug
(
" Private vmas %lu/%lu pages
\n
"
,
vma_area_list
->
longest
,
vma_area_list
->
priv_size
);
/*
* Step 0 -- prepare
*/
snap
=
mem_snap_init
(
ctl
);
if
(
IS_ERR
(
snap
))
goto
out
;
...
...
@@ -333,6 +346,10 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
if
(
!
pp
)
goto
out_close
;
/*
* Step 1 -- generate the pagemap
*/
list_for_each_entry
(
vma_area
,
&
vma_area_list
->
h
,
list
)
{
if
(
!
privately_dump_vma
(
vma_area
))
continue
;
...
...
@@ -344,6 +361,10 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
debug_show_page_pipe
(
pp
);
/*
* Step 2 -- grab pages into page-pipe
*/
args
->
off
=
0
;
list_for_each_entry
(
ppb
,
&
pp
->
bufs
,
l
)
{
ret
=
parasite_send_fd
(
ctl
,
ppb
->
p
[
1
]);
...
...
@@ -364,6 +385,11 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
timing_stop
(
TIME_MEMDUMP
);
/*
* Step 3 -- write pages into image (or delay writing for
* pre-dump action (see pre_dump_one_task)
*/
if
(
pp_ret
)
*
pp_ret
=
pp
;
else
{
...
...
@@ -380,6 +406,10 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
timing_stop
(
TIME_MEMWRITE
);
}
/*
* Step 4 -- clean up
*/
task_reset_dirty_track
(
ctl
->
pid
.
real
);
out_pp:
if
(
ret
||
!
pp_ret
)
...
...
@@ -403,6 +433,14 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl,
pargs
=
prep_dump_pages_args
(
ctl
,
vma_area_list
);
/*
* Add PROT_READ protection for all VMAs we're about to
* dump if they don't have one. Otherwise we'll not be
* able to read the memory contents.
*
* Afterwards -- reprotect memory back.
*/
pargs
->
add_prot
=
PROT_READ
;
ret
=
parasite_execute
(
PARASITE_CMD_MPROTECT_VMAS
,
ctl
);
if
(
ret
)
{
...
...
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