mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
page-read: introduce dup_page_read
The dup_page_read performs a shallow copy of a page_read object. It is required for implementation of fork event in lazy-pages daemon. When a restored process fork()'s a child, the lazy-pages daemon will handle page faults of the child process, and it will use the parent process memory dump for that. travis-ci: success for lazy-pages: add non-#PF events handling (rev2) Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
00436b7c2b
commit
fb90982db5
@ -112,6 +112,13 @@ int pagemap_enqueue_iovec(struct page_read *pr, void *buf,
|
||||
unsigned long len, struct list_head *to);
|
||||
int pagemap_render_iovec(struct list_head *from, struct task_restore_args *ta);
|
||||
|
||||
/*
|
||||
* Create a shallow copy of page_read object.
|
||||
* The new object shares the pagemap structures with the original, but
|
||||
* maintains its own set of references to those structures.
|
||||
*/
|
||||
extern void dup_page_read(struct page_read *src, struct page_read *dst);
|
||||
|
||||
extern int dedup_one_iovec(struct page_read *pr, unsigned long base,
|
||||
unsigned long len);
|
||||
|
||||
|
@ -819,3 +819,16 @@ int open_page_read(int pid, struct page_read *pr, int pr_flags)
|
||||
{
|
||||
return open_page_read_at(get_service_fd(IMG_FD_OFF), pid, pr, pr_flags);
|
||||
}
|
||||
|
||||
|
||||
#define DUP_IDS_BASE 1000
|
||||
|
||||
void dup_page_read(struct page_read *src, struct page_read *dst)
|
||||
{
|
||||
static int dup_ids = 1;
|
||||
|
||||
memcpy(dst, src, sizeof(*dst));
|
||||
INIT_LIST_HEAD(&dst->async);
|
||||
dst->id = src->id + DUP_IDS_BASE * dup_ids++;
|
||||
dst->reset(dst);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user