Hi,
On Sunday 26 February 2006 19:53, Pavel Machek wrote:
> > > > > I did try shrink_all_memory() five times, with .5 second delay between
> > > > > them, and it freed more memory at later tries.
> > > >
> > > > I wonder if the delays are essential or if so, whether they may be shorter
> > > > than .5 sec.
> > >
> > > I was using this with some success... (Warning, against old
> > > kernel). But, as I said, I consider it ugly, and it would be better to
> > > fix shrink_all_memory.
> >
> > Appended is a patch against the current -mm.
> > [It also makes
> > swsusp_shrink_memory() behave as documented for image_size = 0.
> > Currently, if it states there's enough free RAM to suspend, it won't bother
> > to free a single page.]
>
> Could we get bugfix part separately?
Sure. Appended is the bugfix (I haven't tested it separately yet, but I think
it's simple enough) ...
---
Make swsusp_shrink_memory() behave as documented when image_size = 0.
Signed-off-by: Rafael J. Wysocki <[email protected]>
---
kernel/power/swsusp.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
Index: linux-2.6.16-rc4-mm2/kernel/power/swsusp.c
===================================================================
--- linux-2.6.16-rc4-mm2.orig/kernel/power/swsusp.c 2006-02-26 15:12:04.000000000 +0100
+++ linux-2.6.16-rc4-mm2/kernel/power/swsusp.c 2006-02-27 00:25:34.000000000 +0100
@@ -194,14 +194,15 @@ int swsusp_shrink_memory(void)
for_each_zone (zone)
if (!is_highmem(zone))
tmp -= zone->free_pages;
- if (tmp > 0) {
- tmp = shrink_all_memory(SHRINK_BITE);
- if (!tmp)
+ if (tmp > 0 || size > image_size / PAGE_SIZE) {
+ long freed = shrink_all_memory(SHRINK_BITE);
+
+ if (freed > 0) {
+ pages += freed;
+ tmp = freed;
+ } else if (tmp > 0) {
return -ENOMEM;
- pages += tmp;
- } else if (size > image_size / PAGE_SIZE) {
- tmp = shrink_all_memory(SHRINK_BITE);
- pages += tmp;
+ }
}
printk("\b%c", p[i++%4]);
} while (tmp > 0);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]