All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oren Laadan <orenl@cs.columbia.edu>
To: Mike Waychison <mikew@google.com>
Cc: jeremy@goop.org, arnd@arndb.de, linux-api@vger.kernel.org,
	containers@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	linux-mm@kvack.org, Linux Torvalds <torvalds@osdl.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [RFC v11][PATCH 05/13] Dump memory address space
Date: Thu, 18 Dec 2008 15:11:02 -0500	[thread overview]
Message-ID: <494AAE56.6010704@cs.columbia.edu> (raw)
In-Reply-To: <494A9350.1060309@google.com>



Mike Waychison wrote:
> Oren Laadan wrote:
>>
>> Mike Waychison wrote:
>>> Comments below.
>>
>> Thanks for the detailed review.
>>
>>> 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. Then comes the actual contents,
>>>> in one or more chunk: each chunk begins with a header that specifies
>>>> how many pages it holds, then the virtual addresses of all the dumped
>>>> pages in that chunk, followed by the actual contents of all dumped
>>>> pages. A header with zero number of pages marks the end of the
>>>> contents.
>>>> Then comes the next VMA and so on.
>>>>
>>
>> [...]
>>
>>>> +    mutex_lock(&mm->context.lock);
>>>> +
>>>> +    hh->ldt_entry_size = LDT_ENTRY_SIZE;
>>>> +    hh->nldt = mm->context.size;
>>>> +
>>>> +    cr_debug("nldt %d\n", hh->nldt);
>>>> +
>>>> +    ret = cr_write_obj(ctx, &h, hh);
>>>> +    cr_hbuf_put(ctx, sizeof(*hh));
>>>> +    if (ret < 0)
>>>> +        goto out;
>>>> +
>>>> +    ret = cr_kwrite(ctx, mm->context.ldt,
>>>> +            mm->context.size * LDT_ENTRY_SIZE);
>>> Do we really want to emit anything under lock?  I realize that this
>>> patch goes and does a ton of writes with mmap_sem held for read -- is
>>> this ok?
>>
>> Because all tasks in the container must be frozen during the checkpoint,
>> there is no performance penalty for keeping the locks. Although the
>> object
>> should not change in the interim anyways, the locks protects us from,
>> e.g.
>> the task unfreezing somehow, or being killed by the OOM killer, or any
>> other change incurred from the "outside world" (even future code).
>>
>> Put in other words - in the long run it is safer to assume that the
>> underlying object may otherwise change.
>>
>> (If we want to drop the lock here before cr_kwrite(), we need to copy the
>> data to a temporary buffer first. If we also want to drop mmap_sem(), we
>> need to be more careful with following the vma's.)
>>
>> Do you see a reason to not keeping the locks ?
>>
> 
> I just thought it was a bit ugly, but I can't think of a case
> specifically where it's going to cause us harm.  If tasks are frozen,
> are they still subject to the oom killer?   Even that should be
> reasonably ok considering that the exit-path requires a
> down_read(mmap_sem) (at least, it used to..  I haven't gone over that
> path in a while..).

Excatly: this is safe because we keep the lock. It all boils down to
two points: holding the locks doesn't impair performance or functionality,
and it protects us against existing (if any) and future undesired
interactions with other code.

[...]

Oren.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Oren Laadan <orenl@cs.columbia.edu>
To: Mike Waychison <mikew@google.com>
Cc: jeremy@goop.org, arnd@arndb.de, linux-api@vger.kernel.org,
	containers@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	linux-mm@kvack.org,
	Linux Torvalds <torvalds@linux-foundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [RFC v11][PATCH 05/13] Dump memory address space
Date: Thu, 18 Dec 2008 15:11:02 -0500	[thread overview]
Message-ID: <494AAE56.6010704@cs.columbia.edu> (raw)
In-Reply-To: <494A9350.1060309@google.com>



Mike Waychison wrote:
> Oren Laadan wrote:
>>
>> Mike Waychison wrote:
>>> Comments below.
>>
>> Thanks for the detailed review.
>>
>>> 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. Then comes the actual contents,
>>>> in one or more chunk: each chunk begins with a header that specifies
>>>> how many pages it holds, then the virtual addresses of all the dumped
>>>> pages in that chunk, followed by the actual contents of all dumped
>>>> pages. A header with zero number of pages marks the end of the
>>>> contents.
>>>> Then comes the next VMA and so on.
>>>>
>>
>> [...]
>>
>>>> +    mutex_lock(&mm->context.lock);
>>>> +
>>>> +    hh->ldt_entry_size = LDT_ENTRY_SIZE;
>>>> +    hh->nldt = mm->context.size;
>>>> +
>>>> +    cr_debug("nldt %d\n", hh->nldt);
>>>> +
>>>> +    ret = cr_write_obj(ctx, &h, hh);
>>>> +    cr_hbuf_put(ctx, sizeof(*hh));
>>>> +    if (ret < 0)
>>>> +        goto out;
>>>> +
>>>> +    ret = cr_kwrite(ctx, mm->context.ldt,
>>>> +            mm->context.size * LDT_ENTRY_SIZE);
>>> Do we really want to emit anything under lock?  I realize that this
>>> patch goes and does a ton of writes with mmap_sem held for read -- is
>>> this ok?
>>
>> Because all tasks in the container must be frozen during the checkpoint,
>> there is no performance penalty for keeping the locks. Although the
>> object
>> should not change in the interim anyways, the locks protects us from,
>> e.g.
>> the task unfreezing somehow, or being killed by the OOM killer, or any
>> other change incurred from the "outside world" (even future code).
>>
>> Put in other words - in the long run it is safer to assume that the
>> underlying object may otherwise change.
>>
>> (If we want to drop the lock here before cr_kwrite(), we need to copy the
>> data to a temporary buffer first. If we also want to drop mmap_sem(), we
>> need to be more careful with following the vma's.)
>>
>> Do you see a reason to not keeping the locks ?
>>
> 
> I just thought it was a bit ugly, but I can't think of a case
> specifically where it's going to cause us harm.  If tasks are frozen,
> are they still subject to the oom killer?   Even that should be
> reasonably ok considering that the exit-path requires a
> down_read(mmap_sem) (at least, it used to..  I haven't gone over that
> path in a while..).

Excatly: this is safe because we keep the lock. It all boils down to
two points: holding the locks doesn't impair performance or functionality,
and it protects us against existing (if any) and future undesired
interactions with other code.

[...]

Oren.


  reply	other threads:[~2008-12-18 20:11 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-05 17:31 [RFC v11][PATCH 00/13] Kernel based checkpoint/restart Oren Laadan
2008-12-05 17:31 ` Oren Laadan
2008-12-05 17:31 ` Oren Laadan
2008-12-05 17:31 ` [RFC v11][PATCH 01/13] Create syscalls: sys_checkpoint, sys_restart Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31 ` [RFC v11][PATCH 04/13] x86 support for checkpoint/restart Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-17  2:19   ` Mike Waychison
2008-12-17  2:19     ` Mike Waychison
     [not found]     ` <494861CA.8000403-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2008-12-17 15:23       ` Oren Laadan
2008-12-17 15:23     ` Oren Laadan
2008-12-17 15:23       ` Oren Laadan
     [not found]   ` <1228498282-11804-5-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2008-12-17  2:19     ` Mike Waychison
2008-12-05 17:31 ` [RFC v11][PATCH 06/13] Restore memory address space Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31 ` [RFC v11][PATCH 10/13] External checkpoint of a task other than ourself Oren Laadan
2008-12-05 17:31 ` Oren Laadan
2008-12-05 17:31   ` Oren Laadan
     [not found] ` <1228498282-11804-1-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2008-12-05 17:31   ` [RFC v11][PATCH 01/13] Create syscalls: sys_checkpoint, sys_restart Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 02/13] Checkpoint/restart: initial documentation Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 03/13] General infrastructure for checkpoint restart Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31     ` Oren Laadan
     [not found]     ` <1228498282-11804-4-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2008-12-06  7:26       ` Joe Perches
2008-12-06  7:26         ` Joe Perches
2008-12-06  7:26         ` Joe Perches
2008-12-06  7:26       ` Joe Perches
2008-12-16 19:04       ` Mike Waychison
2008-12-16 21:54       ` Mike Waychison
2008-12-16 19:04     ` Mike Waychison
2008-12-16 19:04       ` Mike Waychison
2008-12-16 19:28       ` Linus Torvalds
2008-12-16 19:28         ` Linus Torvalds
     [not found]       ` <4947FBC8.2000601-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2008-12-16 19:28         ` Linus Torvalds
2008-12-16 21:54     ` Mike Waychison
2008-12-16 21:54       ` Mike Waychison
     [not found]       ` <49482394.10006-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2008-12-16 22:14         ` Dave Hansen
2008-12-16 22:14       ` Dave Hansen
2008-12-16 22:14         ` Dave Hansen
2008-12-16 22:43         ` Mike Waychison
2008-12-16 22:43           ` Mike Waychison
2008-12-17  0:13           ` Dave Hansen
2008-12-17  0:13             ` Dave Hansen
     [not found]           ` <49482F14.1040407-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2008-12-17  0:13             ` Dave Hansen
2008-12-16 22:43         ` Mike Waychison
2008-12-16 23:42         ` Oren Laadan
2008-12-16 23:42           ` Oren Laadan
     [not found]           ` <49483D01.1050603-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2008-12-17  0:42             ` Mike Waychison
2008-12-17  0:42           ` Mike Waychison
2008-12-17  0:42             ` Mike Waychison
     [not found]             ` <49484AE2.3000007-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2008-12-17  2:08               ` Oren Laadan
2008-12-17  2:08             ` Oren Laadan
2008-12-17  2:08               ` Oren Laadan
2008-12-16 23:42         ` Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 04/13] x86 support for checkpoint/restart Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 05/13] Dump memory address space Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-18  2:26     ` Mike Waychison
2008-12-18  2:26       ` Mike Waychison
2008-12-18 11:10       ` Oren Laadan
2008-12-18 11:10         ` Oren Laadan
2008-12-18 18:15         ` Mike Waychison
2008-12-18 18:15           ` Mike Waychison
2008-12-18 20:11           ` Oren Laadan [this message]
2008-12-18 20:11             ` Oren Laadan
     [not found]           ` <494A9350.1060309-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2008-12-18 18:21             ` Dave Hansen
2008-12-18 18:21               ` Dave Hansen
2008-12-18 18:21               ` Dave Hansen
2008-12-18 18:21             ` Dave Hansen
2008-12-18 20:11             ` Oren Laadan
     [not found]         ` <494A2F94.2090800-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2008-12-18 15:05           ` Dave Hansen
2008-12-18 15:05           ` Dave Hansen
2008-12-18 15:05             ` Dave Hansen
2008-12-18 15:05             ` Dave Hansen
2008-12-18 15:54           ` Dave Hansen
2008-12-18 15:54             ` Dave Hansen
2008-12-18 15:54             ` Dave Hansen
2008-12-18 20:00             ` Oren Laadan
2008-12-18 20:00             ` Oren Laadan
2008-12-18 20:00               ` Oren Laadan
2008-12-18 15:54           ` Dave Hansen
2008-12-18 18:15           ` Mike Waychison
     [not found]       ` <4949B4ED.9060805-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2008-12-18 11:10         ` Oren Laadan
     [not found]     ` <1228498282-11804-6-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2008-12-18  2:26       ` Mike Waychison
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 06/13] Restore " Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 07/13] Infrastructure for shared objects Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 08/13] Dump open file descriptors Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 09/13] Restore open file descriprtors Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 10/13] External checkpoint of a task other than ourself Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 11/13] Track in-kernel when we expect checkpoint/restart to work Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 12/13] Checkpoint multiple processes Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31     ` Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31   ` [RFC v11][PATCH 13/13] Restart " Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-06  0:19   ` [RFC v11][PATCH 00/13] Kernel based checkpoint/restart Serge E. Hallyn
2008-12-06  0:19     ` Serge E. Hallyn
2008-12-06  0:19     ` Serge E. Hallyn
2008-12-06  0:19   ` Serge E. Hallyn
2008-12-09 19:42   ` Serge E. Hallyn
2008-12-09 19:42   ` Serge E. Hallyn
2008-12-09 19:42     ` Serge E. Hallyn
2008-12-09 19:42     ` Serge E. Hallyn
2008-12-16 18:43   ` Dave Hansen
2008-12-05 17:31 ` [RFC v11][PATCH 13/13] Restart multiple processes Oren Laadan
2008-12-05 17:31   ` Oren Laadan
2008-12-05 17:31 ` Oren Laadan
2008-12-16 18:43 ` [RFC v11][PATCH 00/13] Kernel based checkpoint/restart Dave Hansen
2008-12-16 18:43   ` Dave Hansen

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=494AAE56.6010704@cs.columbia.edu \
    --to=orenl@cs.columbia.edu \
    --cc=arnd@arndb.de \
    --cc=containers@lists.linux-foundation.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mikew@google.com \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@osdl.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.