[CRIU] [PATCH 2/3] criu: pagemap: add reset method
Mike Rapoport
mike.rapoport at gmail.com
Tue Jun 28 06:50:05 PDT 2016
On Tue, Jun 28, 2016 at 4:05 PM, Pavel Emelyanov <xemul at virtuozzo.com> wrote:
> On 06/27/2016 07:53 AM, Mike Rapoport wrote:
>> Rather than do open/close to reset pagemap, just update it's state.
>>
>> Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
>> ---
>> criu/include/pagemap.h | 1 +
>> criu/pagemap.c | 14 ++++++++++++++
>> 2 files changed, 15 insertions(+)
>>
>> diff --git a/criu/include/pagemap.h b/criu/include/pagemap.h
>> index 5e6c4b2..b973caf 100644
>> --- a/criu/include/pagemap.h
>> +++ b/criu/include/pagemap.h
>> @@ -53,6 +53,7 @@ struct page_read {
>> void (*close)(struct page_read *);
>> void (*skip_pages)(struct page_read *, unsigned long len);
>> int (*seek_page)(struct page_read *pr, unsigned long vaddr, bool warn);
>> + void (*reset)(struct page_read *pr);
>>
>> /* Private data of reader */
>> struct cr_img *pmi;
>> diff --git a/criu/pagemap.c b/criu/pagemap.c
>> index 7babca3..0118bad 100644
>> --- a/criu/pagemap.c
>> +++ b/criu/pagemap.c
>> @@ -317,6 +317,19 @@ static void close_page_read(struct page_read *pr)
>> free_pagemaps(pr);
>> }
>>
>> +static void reset_pagemap(struct page_read *pr)
>> +{
>> + pr->cvaddr = 0;
>> + pr->pi_off = 0;
>> + pr->curr_pme = 0;
>> + pr->pe = NULL;
>> +
>> + /* FIXME: take care of bunch */
>
> Of what?!
of pr->bunch
I don't know what will happen when reset is called in the middle of
restore with auto dedup...
And I don't know if anything should happen...
>> +
>> + if (pr->parent)
>> + reset_pagemap(pr->parent);
>> +}
>> +
>> static int try_open_parent(int dfd, int pid, struct page_read *pr, int pr_flags)
>> {
>> int pfd, ret;
>> @@ -467,6 +480,7 @@ int open_page_read_at(int dfd, int pid, struct page_read *pr, int pr_flags)
>> pr->close = close_page_read;
>> pr->skip_pages = skip_pagemap_pages;
>> pr->seek_page = seek_pagemap_page;
>> + pr->reset = reset_pagemap;
>> pr->id = ids++;
>>
>> pr_debug("Opened page read %u (parent %u)\n",
>>
>
--
Sincerely yours,
Mike.
More information about the CRIU
mailing list