All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bojan Smojver <bojan@rexursive.com>
To: Nigel Cunningham <nigel@tuxonice.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH]: Compress hibernation image with LZO (in-kernel)
Date: Sat, 31 Jul 2010 11:03:04 +1000	[thread overview]
Message-ID: <1280538184.2583.11.camel@shrek.rexursive.com> (raw)
In-Reply-To: <4C5362E7.3000706@tuxonice.net>

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

On Sat, 2010-07-31 at 09:40 +1000, Nigel Cunningham wrote:

> How about vmallocing the cmp as well? That would greatly reduce the 
> potential for page allocation failures while still letting you use an 
> order 6 area.

In save_image(), that worked. In load_image() it would cause a crash
(something about kernel not being able to satisfy paging request). So, I
just made it __get_free_pages() instead. But, yeah good point.

Keep in mind that I have absolutely no idea how kernel memory allocation
works. I'm kinda coping and pasting code and hoping it doesn't crash :-)

> > PS. I guess with this, read_sync can simply disappear as well.
> 
> I haven't looked at the code for a while, but it might still be needed 
> for the header? I know that in TuxOnIce, I need to read the first page 
> synchronously when bootstrapping reading the image (can't read the next 
> page until you know where it is, and its location is on the first page). 
> Since swsusp uses those index pages, I think it would have the same 
> issue - they would need to be read before it could read the following 
> pages. Of course I'm going off memory :)

I think it can go, because the header is already read/written with &bio
set to NULL (sync read). See patch to remove read_sync.

-- 
Bojan

[-- Attachment #2: hibernate-no-sync_read.patch --]
[-- Type: text/x-patch, Size: 1518 bytes --]

diff --git a/kernel/power/power.h b/kernel/power/power.h
index 006270f..a760cf8 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -103,10 +103,6 @@ struct snapshot_handle {
 	void		*buffer;	/* address of the block to read from
 					 * or write to
 					 */
-	int		sync_read;	/* Set to one to notify the caller of
-					 * snapshot_write_next() that it may
-					 * need to call wait_on_bio_chain()
-					 */
 };
 
 /* This macro returns the address from/to which the caller of
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 25ce010..f24ee24 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -2135,8 +2135,6 @@ int snapshot_write_next(struct snapshot_handle *handle)
 	if (handle->cur > 1 && handle->cur > nr_meta_pages + nr_copy_pages)
 		return 0;
 
-	handle->sync_read = 1;
-
 	if (!handle->cur) {
 		if (!buffer)
 			/* This makes the buffer be freed by swsusp_free() */
@@ -2169,7 +2167,6 @@ int snapshot_write_next(struct snapshot_handle *handle)
 			memory_bm_position_reset(&orig_bm);
 			restore_pblist = NULL;
 			handle->buffer = get_buffer(&orig_bm, &ca);
-			handle->sync_read = 0;
 			if (IS_ERR(handle->buffer))
 				return PTR_ERR(handle->buffer);
 		}
@@ -2178,8 +2175,6 @@ int snapshot_write_next(struct snapshot_handle *handle)
 		handle->buffer = get_buffer(&orig_bm, &ca);
 		if (IS_ERR(handle->buffer))
 			return PTR_ERR(handle->buffer);
-		if (handle->buffer != buffer)
-			handle->sync_read = 0;
 	}
 	handle->cur++;
 	return PAGE_SIZE;

  reply	other threads:[~2010-07-31  1:03 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 [this message]
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
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=1280538184.2583.11.camel@shrek.rexursive.com \
    --to=bojan@rexursive.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 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.