Re: context_switching&machine_suspend()

Gabor Kuti (ksx@sch.bme.hu)
Tue, 27 Oct 1998 11:04:26 +0100 (MET)


On 26 Oct 1998, Regis Duchesne wrote:

> > - Open a file where the image will be written [yes, here comes the chicken
> > & egg problem....]
> Why is this such a problem? After all, you are just doing a "snapshot"
> of the kernel at a given time.
>
> It is not a problem if the saved state is not the latest one.
>
> What I mean is:
>
> - SysRq request to save the kernel state
> - Atomic creation of the snapshot file
> mylabel:
> - Save the snapshot file on disk. During this operation, the kernel
> state is modified, it is different from the snapshot, but we don't
> care, we don't want to save _the latest_ kernel state before the
> kernel is stopped, we want to save _a_ kernel state.
>
> Then later,
> - Load the snapshot, modify it so that when we activate
> it, we don't go to mylabel.
> - Activate the modified snapshot == make it the running kernel state
Ok, then the snapshot wouldn't go directly to disk.. This was my first
idea anyway but I tried to find another way because it probably needs
ramdisk support [this actually wouldn't be that much trouble] because
otherwise I don't know how to take care when we overlap a free page.
You might say that we alloc e.g. 2^5 pages but what if they are not enough
[but as I know we would get _copy on write_ pages, right?] or they are not
continuous..? I have to look after these questions.

So if __get_free_pages(GFP_KERNEL, 5) is successful, continuous and
copy_on_write pages then this is the way otherwise ramdisk? But what if
the allocation isn't successful? Or after purging unneened buffer_heads
there will there be enough space? Can we rely on this? But this is a hard
code :( And __get_free_pages may block. Ramdisk is at least dynamic. And
may be released easily [free pages too]. Oh ramdisk gets its pages also by
__get_free_page :()

And I don't think that we need to change the flow of operation like above
with mylabel. In my opinion save&restore functions should be
kernel_threads [which are 'normal' processes anyway] so after
saving&restoring they might exit without problem.
Of course we need to make sure that no other processes get to run or no
irq is enabled.

But anyway.. the conception gets to be clearer.

Seasons
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
"One who has time to complain has time to submit patches." <chinese proverb>
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/