From: Oren Laadan <orenl@cs.columbia.edu>
To: Louis.Rilling@kerlabs.com
Cc: dave@linux.vnet.ibm.com, arnd@arndb.de, jeremy@goop.org,
linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org
Subject: Re: [RFC v2][PATCH 4/9] Memory management - dump state
Date: Fri, 22 Aug 2008 17:21:27 -0400 [thread overview]
Message-ID: <48AF2DD7.9030902@cs.columbia.edu> (raw)
In-Reply-To: <20080821095316.GH581@hawkmoon.kerlabs.com>
Thanks Louis for all the comments. Will fix in v3.
Oren.
Louis Rilling wrote:
> On Wed, Aug 20, 2008 at 11:05:15PM -0400, Oren Laadan wrote:
>> For each VMA, there is a 'struct cr_vma'; if the VMA is file-mapped,
>> it will be followed by the file name. The cr_vma->npages will tell
>> how many pages were dumped for this VMA. Then it will be followed
>> by the actual data: first a dump of the addresses of all dumped
>> pages (npages entries) followed by a dump of the contents of all
>> dumped pages (npages pages). Then will come the next VMA and so on.
>
> [...]
>
>> diff --git a/checkpoint/ckpt_mem.c b/checkpoint/ckpt_mem.c
>> new file mode 100644
>> index 0000000..a23aa29
>> --- /dev/null
>> +++ b/checkpoint/ckpt_mem.c
>
> [...]
>
>> +/**
>> + * cr_vma_fill_pgarr - fill a page-array with addr/page tuples for a vma
>> + * @ctx - checkpoint context
>> + * @pgarr - page-array to fill
>> + * @vma - vma to scan
>> + * @start - start address (updated)
>> + */
>> +static int cr_vma_fill_pgarr(struct cr_ctx *ctx, struct cr_pgarr *pgarr,
>> + struct vm_area_struct *vma, unsigned long *start)
>> +{
>> + unsigned long end = vma->vm_end;
>> + unsigned long addr = *start;
>> + struct page **pagep;
>> + unsigned long *addrp;
>> + int cow, nr, ret = 0;
>> +
>> + nr = pgarr->nleft;
>> + pagep = &pgarr->pages[pgarr->nused];
>> + addrp = &pgarr->addrs[pgarr->nused];
>> + cow = !!vma->vm_file;
>> +
>> + while (addr < end) {
>> + struct page *page;
>> +
>> + /* simplified version of get_user_pages(): already have vma,
>> + * only need FOLL_TOUCH, and (for now) ignore fault stats */
>> +
>> + cond_resched();
>> + while (!(page = follow_page(vma, addr, FOLL_TOUCH))) {
>> + ret = handle_mm_fault(vma->vm_mm, vma, addr, 0);
>> + if (ret & VM_FAULT_ERROR) {
>> + if (ret & VM_FAULT_OOM)
>> + ret = -ENOMEM;
>> + else if (ret & VM_FAULT_SIGBUS)
>> + ret = -EFAULT;
>> + else
>> + BUG();
>> + break;
>> + }
>
> + ret = 0;
>
>> + cond_resched();
>> + }
>> +
>> + if (IS_ERR(page)) {
>> + ret = PTR_ERR(page);
>> + break;
>> + }
>
> Need to check ret here:
>
> + if (ret)
> break;
>
>> +
>> + if (page == ZERO_PAGE(0))
>> + page = NULL; /* zero page: ignore */
>> + else if (cow && page_mapping(page) != NULL)
>> + page = NULL; /* clean cow: ignore */
>> + else {
>> + get_page(page);
>> + *(addrp++) = addr;
>> + *(pagep++) = page;
>> + if (--nr == 0) {
>> + addr += PAGE_SIZE;
>> + break;
>> + }
>> + }
>> +
>> + addr += PAGE_SIZE;
>> + }
>> +
>> + if (unlikely(ret < 0)) {
>> + nr = pgarr->nleft - nr;
>> + while (nr--)
>> + page_cache_release(*(--pagep));
>> + return ret;
>> + }
>> +
>> + *start = addr;
>> + return (pgarr->nleft - nr);
>> +}
>
> [...]
>
> Thanks,
>
> Louis
>
next prev parent reply other threads:[~2008-08-22 21:26 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-21 2:58 [RFC v2][PATCH 1/9] kernel based checkpoint-restart Oren Laadan
2008-08-21 3:03 ` [RFC v2][PATCH 1/9] Create trivial sys_checkpoint/sys_restart syscalls Oren Laadan
2008-08-21 5:17 ` Oren Laadan
2008-08-22 19:32 ` Dave Hansen
2008-08-22 20:11 ` Dave Hansen
2008-08-22 21:20 ` Oren Laadan
2008-08-21 3:04 ` [RFC v2][PATCH 2/9] General infrastructure for checkpoint restart Oren Laadan
2008-08-21 9:35 ` Louis Rilling
2008-08-24 5:58 ` Oren Laadan
2008-08-22 20:01 ` Dave Hansen
2008-08-25 2:47 ` Oren Laadan
2008-08-26 16:42 ` Dave Hansen
2008-08-27 0:38 ` Oren Laadan
2008-08-21 3:04 ` [RFC v2][PATCH 3/9] x86 support for checkpoint/restart Oren Laadan
2008-08-22 20:17 ` Dave Hansen
2008-08-21 3:05 ` [RFC v2][PATCH 4/9] Memory management - dump state Oren Laadan
2008-08-21 7:30 ` Ingo Molnar
2008-08-21 8:01 ` Justin P. Mattock
2008-08-21 10:28 ` Balbir Singh
2008-08-21 11:59 ` Ingo Molnar
2008-08-21 9:53 ` Louis Rilling
2008-08-22 21:21 ` Oren Laadan [this message]
2008-08-22 20:37 ` Dave Hansen
2008-08-24 5:40 ` Oren Laadan
2008-08-26 16:33 ` Dave Hansen
2008-08-27 0:14 ` Oren Laadan
2008-08-27 15:41 ` Dave Hansen
2008-08-27 15:57 ` Louis Rilling
2008-08-27 16:12 ` Dave Hansen
2008-08-27 16:19 ` Jeremy Fitzhardinge
2008-08-27 20:34 ` Serge E. Hallyn
2008-08-27 20:38 ` Dave Hansen
2008-08-27 20:48 ` Serge E. Hallyn
2008-08-27 20:56 ` Dave Hansen
2008-08-31 7:16 ` Oren Laadan
2008-08-31 17:34 ` Cedric Le Goater
2008-09-03 11:43 ` [Devel] " Andrey Mirkin
2008-09-03 12:15 ` Cedric Le Goater
2008-09-03 13:29 ` Andrey Mirkin
2008-09-02 15:32 ` Serge E. Hallyn
2008-08-21 3:05 ` [RFC v2][PATCH 5/9] Memory managemnet - restore state Oren Laadan
2008-08-21 10:07 ` Louis Rilling
2008-08-21 3:06 ` [RFC v2][PATCH 6/9] Checkpoint/restart: initial documentation Oren Laadan
2008-08-21 3:06 ` [RFC v2][PATCH 7/9] Infrastructure for shared objects Oren Laadan
2008-08-21 10:40 ` Louis Rilling
2008-08-26 17:01 ` Dave Hansen
2008-08-27 8:26 ` Louis Rilling
2008-08-21 3:07 ` [RFC v2][PATCH 8/9] File descriprtors - dump state Oren Laadan
2008-08-21 11:06 ` Louis Rilling
2008-08-25 3:28 ` Oren Laadan
2008-08-25 10:30 ` Louis Rilling
2008-08-21 3:07 ` [RFC v2][PATCH 9/9] File descriprtors (restore) Oren Laadan
2008-08-21 5:26 ` Oren Laadan
2008-08-21 5:15 ` [RFC v2][PATCH 1/9] kernel based checkpoint-restart Oren Laadan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48AF2DD7.9030902@cs.columbia.edu \
--to=orenl@cs.columbia.edu \
--cc=Louis.Rilling@kerlabs.com \
--cc=arnd@arndb.de \
--cc=containers@lists.linux-foundation.org \
--cc=dave@linux.vnet.ibm.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox