public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave@sr71.net>
To: Oren Laadan <orenl@cs.columbia.edu>
Cc: containers@lists.linux-foundation.org,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	arnd@arndb.de, linux-kernel@vger.kernel.org
Subject: Re: [RFC v2][PATCH 2/9] General infrastructure for checkpoint restart
Date: Tue, 26 Aug 2008 09:42:29 -0700	[thread overview]
Message-ID: <1219768949.8680.26.camel@nimitz> (raw)
In-Reply-To: <48B21D3C.8090601@cs.columbia.edu>

On Sun, 2008-08-24 at 22:47 -0400, Oren Laadan wrote:
> > I replaced all of the uses of these with kmalloc()/kfree() and stack
> > allocations.  I'm really not sure what these buy us since our allocators
> > are already so fast.  tbuf, especially, worries me if it gets used in
> > any kind of nested manner we're going to get some really fun bugs.
> 
> I disagree with putting some of the cr_hdr_... on the stack: first, if they
> grow in size, it's easy to forget to change the allocation to stack.

I can buy that. 

> Second,
> using a standard code/handling for all cr_hdr_... makes the code more readable
> and easier for others to extend by simply following existing code.

It actually makes it harder for others to jump into because they see
something which is basically a kmalloc() to the rest of the kernel.  We
don't have ext2_alloc() or usb_alloc(), so I'm not sure we should have
cr_alloc(), effectively.

> The main argument for ->hbuf is that eventually we would like to buffer
> data in the kernel to avoid potentially slow writing/reading when processes
> are frozen during checkpoint/restart.

Um, we're writing to a file descriptor and kmap()'ing.  Those can both
potentially be very, very slow.  I don't think that a few kmalloc()s
thrown in there are going to be noticeable.

> By using the simple cr_get_hbuf() and
> cr_put_hbuf() we prepare for that: now they just allocate room in ->hbuf,
> but later they will provide a pointer directly in the data buffer. Moreover,
> it simplifies the error path since cleanup (of ->hbuf) is implicit.

It simplifies *one* error path.  But, it complicates the ctx creation
and makes *that* error path more complex.  Pick your poison, I guess.

> Also,
> it is designed to allow checkpoint and restart function to be called in a
> nested manner, again simplifying the code. Finally, my experience was that
> it can impact performance if you are after very short downtimes, especially
> for the checkpoint.

Right, but I'm comparing it to kmalloc()  Certainly kmalloc()s can be
used in a nested manner.

> >> +/* read the checkpoint header */
> >> +static int cr_read_hdr(struct cr_ctx *ctx)
> >> +{
> >> +	struct cr_hdr_head *hh = cr_hbuf_get(ctx, sizeof(*hh));
> >> +	int ret;
> >> +
> >> +	ret = cr_read_obj_type(ctx, hh, sizeof(*hh), CR_HDR_HEAD);
> >> +	if (ret < 0)
> >> +		return ret;
> >> +	else if (ret != 0)
> >> +		return -EINVAL;
> > 
> > How about just making cr_read_obj_type() stop returning positive values?
> > Is it ever valid for it to return >0?
> 
> The idea with cr_read_obj_type() is that it returns the 'ptag' - parent tag -
> field of the object that it reads in. The 'ptag' is the tag of the parent
> object, and is useful in several places. For instance, the 'ptag' of an MM
> header identifies (is equal to) the 'tag' of TASK to which it belongs. In
> this case, the 'ptag' should be zero because it has no parent object.
> 
> I'll change the variable name from 'ret' to 'ptag' to make it more obvious.

Since this ptag isn't actually used, I can't really offer a suggestion.
I don't see the whole picture.

-- Dave


  reply	other threads:[~2008-08-26 16:42 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 [this message]
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
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=1219768949.8680.26.camel@nimitz \
    --to=dave@sr71.net \
    --cc=arnd@arndb.de \
    --cc=containers@lists.linux-foundation.org \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orenl@cs.columbia.edu \
    /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