Re: [RFC v2][PATCH 2/9] General infrastructure for checkpoint restart

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Oren Laadan
Date: Tuesday, August 26, 2008 - 5:38 pm

Dave Hansen wrote:

I disagree. It's more than "allocate memory", it's: "give me some room on
the buffer". When we don't care about downtime (like now), it's enough to
kmalloc a temporary buffer and flush (write to the FD) immediately.

But when we will care about downtime, "the buffer" will be memory in kernel
where the entire checkpoint image data will be kept while the container is
frozen (memory contents need only be marked copy-on-write, not explicitly
buffered).

In this setting, cr_kwrite() will not really write the data to the FD, but
only record somewhere that the data exists. Only after the container resumes
execution will we eventually write the data to the FD and free the buffer.

(This is also useful in case you want to keep the checkpoint image entirely
in memory without flushing to any FD; and yes, there are use-cases for that).

So for this, instead of using kmalloc() to allocate a temp-buf, fill it with
data, and then copy that data to the actual (big) buffer, the mechanism
provides a shortcut to allocate space directly on the buffer, and save the
copy.


But you miss the point: the writing to the file descriptor in the (future)
optimized version will _not_ happen while the container is frozen. Only
much later after the container resumes, so at the end it will be:
(1) freeze container (2) dump data to in-kernel buffer (mark dirty pages
copy-on-write) (3) unfreeze container (4) write in-kernel buffer to FD.

By deferring step #4 until after the freeze-period, you can save tens and
hundreds of milliseconds, and seconds. Now the goal is to make step #2 be
as fast as possible, and every millisecond (and less) counts, e.g. to take
fast checkpoints of interactive desktops. And my experience is that in
such "workload" repetitive kmalloc/kfree inside that dump loop has a
measurable impact on performance (of course, for those objects which are
abundant).


Actually it simplifies *many* error paths -- in *all* cr_write_...()
functions - including the future ones (and there are many to come).


You can see how it's used in the code that dumps files. Or look at the next
incarnation of the patch.

Oren.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC v2][PATCH 1/9] kernel based checkpoint-restart, Oren Laadan, (Wed Aug 20, 7:58 pm)
[RFC v2][PATCH 3/9] x86 support for checkpoint/restart, Oren Laadan, (Wed Aug 20, 8:04 pm)
[RFC v2][PATCH 4/9] Memory management - dump state, Oren Laadan, (Wed Aug 20, 8:05 pm)
[RFC v2][PATCH 5/9] Memory managemnet - restore state, Oren Laadan, (Wed Aug 20, 8:05 pm)
[RFC v2][PATCH 7/9] Infrastructure for shared objects, Oren Laadan, (Wed Aug 20, 8:06 pm)
[RFC v2][PATCH 8/9] File descriprtors - dump state, Oren Laadan, (Wed Aug 20, 8:07 pm)
[RFC v2][PATCH 9/9] File descriprtors (restore), Oren Laadan, (Wed Aug 20, 8:07 pm)
Re: [RFC v2][PATCH 1/9] kernel based checkpoint-restart, Oren Laadan, (Wed Aug 20, 10:15 pm)
Re: [RFC v2][PATCH 9/9] File descriprtors (restore), Oren Laadan, (Wed Aug 20, 10:26 pm)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Ingo Molnar, (Thu Aug 21, 12:30 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Justin P. Mattock, (Thu Aug 21, 1:01 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Louis Rilling, (Thu Aug 21, 2:53 am)
Re: [RFC v2][PATCH 5/9] Memory managemnet - restore state, Louis Rilling, (Thu Aug 21, 3:07 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Balbir Singh, (Thu Aug 21, 3:28 am)
Re: [RFC v2][PATCH 7/9] Infrastructure for shared objects, Louis Rilling, (Thu Aug 21, 3:40 am)
Re: [RFC v2][PATCH 8/9] File descriprtors - dump state, Louis Rilling, (Thu Aug 21, 4:06 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Ingo Molnar, (Thu Aug 21, 4:59 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Dave Hansen, (Fri Aug 22, 1:37 pm)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Oren Laadan, (Fri Aug 22, 2:21 pm)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Oren Laadan, (Sat Aug 23, 10:40 pm)
Re: [RFC v2][PATCH 8/9] File descriprtors - dump state, Oren Laadan, (Sun Aug 24, 8:28 pm)
Re: [RFC v2][PATCH 8/9] File descriprtors - dump state, Louis Rilling, (Mon Aug 25, 3:30 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Dave Hansen, (Tue Aug 26, 9:33 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Oren Laadan, (Tue Aug 26, 5:14 pm)
Re: [RFC v2][PATCH 2/9] General infrastructure for checkpo ..., Oren Laadan, (Tue Aug 26, 5:38 pm)
Re: [RFC v2][PATCH 7/9] Infrastructure for shared objects, Louis Rilling, (Wed Aug 27, 1:26 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Dave Hansen, (Wed Aug 27, 8:41 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Louis Rilling, (Wed Aug 27, 8:57 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Dave Hansen, (Wed Aug 27, 9:12 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Jeremy Fitzhardinge, (Wed Aug 27, 9:19 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Serge E. Hallyn, (Wed Aug 27, 1:34 pm)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Dave Hansen, (Wed Aug 27, 1:38 pm)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Serge E. Hallyn, (Wed Aug 27, 1:48 pm)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Dave Hansen, (Wed Aug 27, 1:56 pm)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Oren Laadan, (Sun Aug 31, 12:16 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Cedric Le Goater, (Sun Aug 31, 10:34 am)
Re: [RFC v2][PATCH 4/9] Memory management - dump state, Serge E. Hallyn, (Tue Sep 2, 8:32 am)