From: Bojan Smojver <bojan@rexursive.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Nigel Cunningham <nigel@tuxonice.net>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH]: Compress hibernation image with LZO (in-kernel)
Date: Tue, 03 Aug 2010 11:59:10 +1000 [thread overview]
Message-ID: <1280800750.3305.4.camel@shrek.rexursive.com> (raw)
In-Reply-To: <1280713381.2673.2.camel@shrek.rexursive.com>
On Mon, 2010-08-02 at 11:43 +1000, Bojan Smojver wrote:
> OK, get it. Will rework.
What I did today was:
1. Introduced a global variable in swap.c called swsusp_lzo_buffers. It
was declared in kernel/power/power.h as:
---------------------
extern void *swsusp_lzo_buffers;
---------------------
2. Allocation in save_image() then went like this:
---------------------
swsusp_lzo_buffers = vmalloc(LZO_WRK_SIZE + LZO_UNC_SIZE + LZO_OVH_SIZE)
;
if (!swsusp_lzo_buffers) {
printk(KERN_ERR "PM: Failed to allocate LZO buffers\n");
free_page((unsigned long)page);
return -ENOMEM;
}
wrk = swsusp_lzo_buffers;
buf = swsusp_lzo_buffers + LZO_WRK_SIZE;
---------------------
3. Deallocation in save_image() had (this is after everything has been
written to disk):
---------------------
vfree(swsusp_lzo_buffers);
swsusp_lzo_buffers = NULL;
---------------------
4. swsusp_free() had (note memset(), which would crash the kernel if
this was already freed, but pointer not NULL):
---------------------
printk (KERN_ERR "In swsusp_free().\n");
if (swsusp_lzo_buffers) {
printk (KERN_ERR "Freeing vmalloc() buffers.\n");
memset(swsusp_lzo_buffers, 0, 80 * PAGE_SIZE);
vfree(swsusp_lzo_buffers);
}
---------------------
>From all this, I only got "In swsusp_free()" printed on resume. So, it
seems that save_image() does indeed free those vmalloc()-ed buffers and
they are not saved in the image.
I even put this in hibernate.c:
---------------------
/* Restore control flow magically appears here */
restore_processor_state();
if (!in_suspend)
platform_leave(platform_mode);
printk(KERN_ERR "Resumed, checking swsusp_lzo_buffers.\n");
if (swsusp_lzo_buffers) {
printk (KERN_ERR "Setting vmalloc() buffers.\n");
memset(swsusp_lzo_buffers, 0, 80 * PAGE_SIZE);
}
---------------------
This printed just "Resumed, checking swsusp_lzo_buffers.", meaning it
was already set to NULL.
Any further comments on this? Nigel, what do you reckon?
PS. I also enhanced the patch to use overlapping compression in order to
save memory. Looks like that's causing it to be slower on compression
(we go down from 130 - 150 MB/s to around 105 - 110 MB/s), but still
over 3 times faster than regular swsusp code. Decompression remains
roughly the same around 100+ MB/s (this is double the speed of current
swsusp code). I will post this a bit later on.
--
Bojan
next prev parent reply other threads:[~2010-08-03 1:59 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-30 4:46 [PATCH]: Compress hibernation image with LZO (in-kernel) Bojan Smojver
2010-07-30 10:44 ` Bojan Smojver
2010-07-30 22:05 ` Nigel Cunningham
2010-07-30 22:19 ` Bojan Smojver
2010-07-30 23:22 ` Bojan Smojver
2010-07-30 23:40 ` Nigel Cunningham
2010-07-31 1:03 ` Bojan Smojver
2010-07-31 1:18 ` Nigel Cunningham
2010-07-31 1:33 ` Bojan Smojver
2010-07-31 4:41 ` Bojan Smojver
2010-07-31 5:03 ` Bojan Smojver
2010-08-02 0:17 ` KAMEZAWA Hiroyuki
2010-08-02 0:54 ` Bojan Smojver
2010-08-02 1:10 ` KAMEZAWA Hiroyuki
2010-08-02 1:21 ` Bojan Smojver
2010-08-02 1:27 ` KAMEZAWA Hiroyuki
2010-08-02 1:43 ` Bojan Smojver
2010-08-03 1:59 ` Bojan Smojver [this message]
2010-08-03 2:30 ` Bojan Smojver
2010-08-04 2:42 ` Nigel Cunningham
2010-08-04 2:47 ` Bojan Smojver
2010-08-04 4:04 ` Bojan Smojver
2010-08-04 4:23 ` Nigel Cunningham
2010-08-04 5:12 ` Bojan Smojver
2010-08-04 5:58 ` Bojan Smojver
2010-08-05 1:26 ` Bojan Smojver
2010-08-03 6:34 ` Bojan Smojver
2010-08-04 1:50 ` Nigel Cunningham
2010-08-04 1:58 ` Bojan Smojver
2010-08-04 2:02 ` KAMEZAWA Hiroyuki
2010-08-04 2:14 ` Bojan Smojver
2010-08-04 2:18 ` KAMEZAWA Hiroyuki
2010-08-04 2:37 ` Nigel Cunningham
2010-08-04 2:24 ` Nigel Cunningham
2010-08-04 2:24 ` KAMEZAWA Hiroyuki
2010-08-04 2:38 ` Nigel Cunningham
2010-08-05 6:26 ` Pavel Machek
2010-08-05 6:55 ` Bojan Smojver
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=1280800750.3305.4.camel@shrek.rexursive.com \
--to=bojan@rexursive.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nigel@tuxonice.net \
/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