* [PATCH] PM:Hibernation: drop the check of swap space size for compressed image
@ 2012-01-09 4:56 Barry Song
2012-01-09 10:10 ` Pavel Machek
0 siblings, 1 reply; 2+ messages in thread
From: Barry Song @ 2012-01-09 4:56 UTC (permalink / raw)
To: linux-arm-kernel
From: Barry Song <Baohua.Song@csr.com>
For compressed image, the space required is not known until
we finish compressing and writing all pages.
This patch drops the check, and if swap space is not enough
finally, system can still restore to normal after writing
swap fails for compressed images.
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
kernel/power/swap.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 11a594c..c8306a5 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -774,8 +774,7 @@ static int enough_swap(unsigned int nr_pages, unsigned int flags)
pr_debug("PM: Free swap pages: %u\n", free_swap);
- required = PAGES_FOR_IO + ((flags & SF_NOCOMPRESS_MODE) ?
- nr_pages : (nr_pages * LZO_CMP_PAGES) / LZO_UNC_PAGES + 1);
+ required = PAGES_FOR_IO + nr_pages;
return free_swap > required;
}
@@ -803,10 +802,12 @@ int swsusp_write(unsigned int flags)
printk(KERN_ERR "PM: Cannot get swap writer\n");
return error;
}
- if (!enough_swap(pages, flags)) {
- printk(KERN_ERR "PM: Not enough free swap\n");
- error = -ENOSPC;
- goto out_finish;
+ if (flags & SF_NOCOMPRESS_MODE) {
+ if (!enough_swap(pages, flags)) {
+ printk(KERN_ERR "PM: Not enough free swap\n");
+ error = -ENOSPC;
+ goto out_finish;
+ }
}
memset(&snapshot, 0, sizeof(struct snapshot_handle));
error = snapshot_read_next(&snapshot);
--
1.7.1
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] PM:Hibernation: drop the check of swap space size for compressed image
2012-01-09 4:56 [PATCH] PM:Hibernation: drop the check of swap space size for compressed image Barry Song
@ 2012-01-09 10:10 ` Pavel Machek
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2012-01-09 10:10 UTC (permalink / raw)
To: linux-arm-kernel
On Mon 2012-01-09 12:56:23, Barry Song wrote:
> From: Barry Song <Baohua.Song@csr.com>
>
> For compressed image, the space required is not known until
> we finish compressing and writing all pages.
> This patch drops the check, and if swap space is not enough
> finally, system can still restore to normal after writing
> swap fails for compressed images.
>
> Signed-off-by: Barry Song <Baohua.Song@csr.com>
ACK.
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-09 10:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-09 4:56 [PATCH] PM:Hibernation: drop the check of swap space size for compressed image Barry Song
2012-01-09 10:10 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).